Clamp mouse movement to a max of 8 pixels per frame. Add some code which will become the "refresh the mushrooms after death" implementation.

This commit is contained in:
Jeremy Rand 2020-11-24 22:59:08 -05:00
parent 34d16c9944
commit 7264cf907d
8 changed files with 61 additions and 10 deletions

View File

@ -7,6 +7,7 @@ This is a list of the software bugs (as opposed to the bugs in the game that you
* Sometimes centipede segments seem to be stacked one on top of another. You think there is just one left but you shoot it and there is one underneath it. This should not happen. * Sometimes centipede segments seem to be stacked one on top of another. You think there is just one left but you shoot it and there is one underneath it. This should not happen.
* A spider moving left to right went off screen and left garbage on the RHS as it exited. I have only seen this once. I think it coincided with the player dying. * A spider moving left to right went off screen and left garbage on the RHS as it exited. I have only seen this once. I think it coincided with the player dying.
* Sometimes when the player dies, the "you can shoot" indicator is left behind as garbage on-screen. * Sometimes when the player dies, the "you can shoot" indicator is left behind as garbage on-screen.
* If you die holding the mouse button down, your next game will start shooting without pressing the mouse button.

View File

@ -7,7 +7,7 @@
<key>Binary.xcscheme_^#shared#^_</key> <key>Binary.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>1</integer> <integer>2</integer>
</dict> </dict>
<key>BuGS.xcscheme_^#shared#^_</key> <key>BuGS.xcscheme_^#shared#^_</key>
<dict> <dict>
@ -17,7 +17,7 @@
<key>DiskImage.xcscheme_^#shared#^_</key> <key>DiskImage.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>2</integer> <integer>1</integer>
</dict> </dict>
<key>doNotBuild.xcscheme_^#shared#^_</key> <key>doNotBuild.xcscheme_^#shared#^_</key>
<dict> <dict>

View File

@ -17,6 +17,11 @@ gameMushroom start
STARTING_NUM_MUSHROOMS equ 30 STARTING_NUM_MUSHROOMS equ 30
resetMushrooms entry
; TODO - Write this code...
clc
rtl
addRandomMushrooms entry addRandomMushrooms entry
stz numInfieldMushrooms stz numInfieldMushrooms

View File

@ -114,9 +114,7 @@ updatePlayer_nextExplosion anop
sta playerExplosionOffset sta playerExplosionOffset
bra updatePlayer_drawExplosion bra updatePlayer_drawExplosion
updatePlayer_doneExplosion anop updatePlayer_doneExplosion anop
lda #PLAYER_RESTART_LEVEL_FRAME_COUNT lda #PLAYER_STATE_MUSHROOMS
sta playerFrameCount
lda #PLAYER_STATE_NONE
sta playerState sta playerState
rtl rtl
@ -160,6 +158,20 @@ jumpInst anop
nop nop
updatePlayer_notExploding anop updatePlayer_notExploding anop
cmp #PLAYER_STATE_MUSHROOMS
bne updatePlayer_notMushrooms
jsl resetMushrooms
bcc updatePlayer_doneMushrooms
rtl
updatePlayer_doneMushrooms anop
lda #PLAYER_RESTART_LEVEL_FRAME_COUNT
sta playerFrameCount
lda #PLAYER_STATE_NONE
sta playerState
rtl
updatePlayer_notMushrooms anop
ldx #0 ldx #0
ldy #0 ldy #0
; This code for reading the mouse data is based on some code which John Brooks helpfully provided, although I did things ; This code for reading the mouse data is based on some code which John Brooks helpfully provided, although I did things
@ -193,6 +205,12 @@ updatePlayer_handleDeltas anop
bit #$40 bit #$40
bne updatePlayer_negX bne updatePlayer_negX
and #$3f and #$3f
inc a
lsr a
cmp #9
blt updatePlayer_posXNoClamp
lda #8
updatePlayer_posXNoClamp anop
clc clc
adc mouseX adc mouseX
cmp #MOUSE_MAX_X cmp #MOUSE_MAX_X
@ -201,6 +219,13 @@ updatePlayer_handleDeltas anop
bra updatePlayer_doneX bra updatePlayer_doneX
updatePlayer_negX anop updatePlayer_negX anop
ora #$ffc0 ora #$ffc0
dec a
lsr a
ora #$8000
cmp #$fff8
bge updatePlayer_negXNoClamp
lda #$fff8
updatePlayer_negXNoClamp anop
clc clc
adc mouseX adc mouseX
bpl updatePlayer_doneX bpl updatePlayer_doneX
@ -213,6 +238,12 @@ updatePlayer_doneX anop
bit #$40 bit #$40
bne updatePlayer_negY bne updatePlayer_negY
and #$3f and #$3f
inc a
lsr a
cmp #9
blt updatePlayer_posYNoClamp
lda #8
updatePlayer_posYNoClamp anop
clc clc
adc mouseY adc mouseY
cmp #MOUSE_MAX_Y cmp #MOUSE_MAX_Y
@ -221,6 +252,13 @@ updatePlayer_doneX anop
bra updatePlayer_doneY bra updatePlayer_doneY
updatePlayer_negY anop updatePlayer_negY anop
ora #$ffc0 ora #$ffc0
dec a
lsr a
ora #$8000
cmp #$fff8
bge updatePlayer_negYNoClamp
lda #$fff8
updatePlayer_negYNoClamp anop
clc clc
adc mouseY adc mouseY
bpl updatePlayer_doneY bpl updatePlayer_doneY

View File

@ -21,7 +21,8 @@ SEGMENT_DIR_RIGHT equ 1
PLAYER_STATE_NONE equ 0 PLAYER_STATE_NONE equ 0
PLAYER_STATE_EXPLODING equ 1 PLAYER_STATE_EXPLODING equ 1
PLAYER_STATE_ONSCREEN equ 2 PLAYER_STATE_MUSHROOMS equ 2
PLAYER_STATE_ONSCREEN equ 3
; The code uses segmentPixelOffset and the segment speed to figure out whether to draw the shifted sprite ; The code uses segmentPixelOffset and the segment speed to figure out whether to draw the shifted sprite
; or the regular sprite. By AND-ing with the speed, if the result is 0, then we want a non-shifted sprite. ; or the regular sprite. By AND-ing with the speed, if the result is 0, then we want a non-shifted sprite.

View File

@ -71,6 +71,11 @@ levelStart_done anop
updateLevel entry updateLevel entry
lda gameRunning lda gameRunning
bne updateLevel_done bne updateLevel_done
lda playerState
cmp #PLAYER_STATE_EXPLODING
beq updateLevel_done
cmp #PLAYER_STATE_MUSHROOMS
beq updateLevel_done
lda nextLevelFrameCount lda nextLevelFrameCount
beq updateLevel_checkSegments beq updateLevel_checkSegments
dec a dec a
@ -79,6 +84,7 @@ updateLevel entry
jsl levelNext jsl levelNext
jmp levelStart jmp levelStart
updateLevel_checkSegments anop updateLevel_checkSegments anop
bne updateLevel_done
lda numSegments lda numSegments
bne updateLevel_done bne updateLevel_done
lda #NEXT_LEVEL_FRAME_COUNT lda #NEXT_LEVEL_FRAME_COUNT

View File

@ -14,8 +14,8 @@ g_limit_speed = 3
bram1[00] = 00 00 00 01 00 00 0d 06 02 01 01 00 01 00 00 00 bram1[00] = 00 00 00 01 00 00 0d 06 02 01 01 00 01 00 00 00
bram1[10] = 00 00 07 06 02 01 01 00 00 00 0f 06 06 00 05 06 bram1[10] = 00 00 07 06 02 01 01 00 00 00 0f 06 06 00 05 06
bram1[20] = 01 00 00 00 00 00 00 01 00 00 00 00 03 02 02 02 bram1[20] = 01 00 00 00 00 00 00 01 00 00 00 00 03 02 02 02
bram1[30] = 00 00 00 00 00 00 00 00 08 00 01 02 03 04 05 06 bram1[30] = 00 00 00 01 00 00 00 00 00 00 01 02 03 04 05 06
bram1[40] = 07 0a 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d bram1[40] = 07 00 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d
bram1[50] = 0e 0f ff ff ff ff ff ff ff 00 ff ff ff ff ff 81 bram1[50] = 0e 0f ff ff ff ff ff ff ff 00 ff ff ff ff ff 81
bram1[60] = ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff bram1[60] = ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
bram1[70] = ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff bram1[70] = ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
@ -26,7 +26,7 @@ bram1[b0] = ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
bram1[c0] = ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff bram1[c0] = ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
bram1[d0] = ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff bram1[d0] = ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
bram1[e0] = ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff bram1[e0] = ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
bram1[f0] = ff ff ff ff ff ff ff ff ff ff ff ff 52 06 f8 ac bram1[f0] = ff ff ff ff ff ff ff ff ff ff ff ff 41 f8 eb 52
bram3[00] = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 bram3[00] = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
bram3[10] = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 bram3[10] = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

View File

@ -27,7 +27,7 @@ sed -i "" "s:^s7d1 *=.*$:s7d1 = $DISKIMAGE:" config.txt
# This magic ensure that clicking stop in Xcode results in the emulator terminating. # This magic ensure that clicking stop in Xcode results in the emulator terminating.
$EMULATORPATH -fullscreen & $EMULATORPATH -fullscreen -mem 1572864 &
PID=$! PID=$!
trap 'kill $PID' SIGTERM SIGINT SIGHUP EXIT trap 'kill $PID' SIGTERM SIGINT SIGHUP EXIT