diff options
| author | Miquel Sabaté Solà <mikisabate@gmail.com> | 2025-04-01 21:19:45 +0200 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2025-04-02 21:23:51 +0200 |
| commit | 88728b89fed87326dae23619e2e93d4bd060a3ea (patch) | |
| tree | 4c1bf3af96e1e1ea200f9e5c08e3a672f5c4fe54 /src | |
| parent | 2f140cfb7ea73e631fce086327bcb3a674758b0e (diff) | |
| download | jetpac.nes-88728b89fed87326dae23619e2e93d4bd060a3ea.tar.gz jetpac.nes-88728b89fed87326dae23619e2e93d4bd060a3ea.zip | |
Adapt velocity constants for PAL
In 2f140cfb7ea7 ("player: First PAL implementation") the rate of
acceleration was adapted for PAL. Now the values for velocities have
been adapted as well, in a way that we get (virtually) the same
experience in PAL and in NTSC.
This has been done by moving the velocity constants into configurable
values, which are then picked up by a new bin/values.rb script. This
script allows us to write the constants in plain floating point numbers,
does the conversion to fixed point numbers as expected, and it also does
the same for PAL by applying the proper NTSC to PAL conversion.
As a cherry on top, some values have also been tuned to match the
original game more closely, even if some more fine tuning might still be
needed here and there.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/player.s | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/player.s b/src/player.s index 9cb73f3..ebf6dfb 100644 --- a/src/player.s +++ b/src/player.s @@ -62,19 +62,15 @@ INIT_Y_POSITION_LO = ((Background::GROUND_Y_COORD - PLAYER_HEIGHT) & $0F) << 4 INIT_Y_POSITION_HI = (Background::GROUND_Y_COORD - PLAYER_HEIGHT) >> 4 - ;; The initial position on the X axis is more or less at the center. + ;; The initial position on the X axis is right below the mid platform. INIT_X_POSITION_LO = $00 - INIT_X_POSITION_HI = $07 + INIT_X_POSITION_HI = $08 ;; Different acceleration/velocity constants. - GRAVITY = $28 - THROTTLE_UP = $D8 - THROTTLE_LEFT = $D8 - THROTTLE_RIGHT = $28 - BLAST_OFF = $F8 ; Initial velocity from ground. - WALK_LEFT = $F8 - WALK_RIGHT = $08 - REDUCE_FULL_SPEED = $10 ; Next velocity after hitting a ceiling at full speed. + ;; + ;; NOTE: automatically generated via `bin/values.rb`. Check the + ;; `config/values.yml` to understand the meaning of each constant. + .include "../config/values/player.s" zp_screen_y = $40 zp_position_y = $41 ; NOTE: 16-bit. @@ -553,7 +549,7 @@ lda #REDUCE_FULL_SPEED bne @correct_vertical_velocity @reduced_velocity: - lda #8 + lda #REDUCE_MID_SPEED @correct_vertical_velocity: sta zp_velocity_y rts @@ -639,7 +635,7 @@ ;; game did. sec sbc #PLAYER_WIDTH - ldx #$E8 + ldx #BOUNCE_LEFT bne @horizontal_eject @left_collision: @@ -647,7 +643,7 @@ ;; need to add the tile width to it. clc adc #8 - ldx #$18 + ldx #BOUNCE_RIGHT @horizontal_eject: ;; The screen coordinate has been computed into the `a` register, and |
