Fix a crash that would happen if the last centipede segment collided with the player. Both level and player code was trying to start the next level and the corrupted things badly. Now, the level code is always responsible for starting the next level. The player code only restarts a level when the player dies and doesn't finish the level.

This commit is contained in:
Jeremy Rand 2020-11-19 23:45:23 -05:00
parent fd40c12d31
commit 868f4a3199
3 changed files with 9 additions and 4 deletions

View File

@ -7,11 +7,15 @@ 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.
* 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.
* I have seen a couple of crashes. I think an off-screen centipede segment is getting "shot" at the beginning of a level leading to a crash. Almost definitely related to collision and shot handling.
* I am seeing other crashes where the PC ends up in bank 22 or so. Need to dig into the stack to figure out where it is coming from.
FIXED
=======
* A shot is able to pass through an almost gone mushroom if lined up just right. Best to change the sprite code for the shot to scan the two pixels below for a collision.
* I have seen a couple of crashes. I think an off-screen centipede segment is getting "shot" at the beginning of a level leading to a crash. Almost definitely related to collision and shot handling.
* I am seeing other crashes where the PC ends up in bank 22 or so. Need to dig into the stack to figure out where it is coming from.
* I have confirmed that we are jumping to band 22 from segmentBodyJump_jumpInst. Not sure how a bad address is ending up in the jump table here.
* Seems to happen pretty reliably if I die from the last segment and progress to the next level.
* Caused by both gamePlayer.s and level.s calling start level when the last segment is the one which kills the player. The player code now defers to the level code to handle starting the level after the player dies that way.

View File

@ -86,7 +86,8 @@ updatePlayer_gameRunning anop
beq updatePlayer_gameOver
lda numSegments
bne updatePlayer_notNextLevel
jsl levelNext
; If we are going to the next level, let updateLevel handle that for us.
rtl
updatePlayer_notNextLevel anop
jmp startLevel
updatePlayer_gameOver anop

View File

@ -1740,7 +1740,6 @@ isSegmentCollision_returnTrue anop
; Call this with the segment num * 2 in the X register
shootSegment entry
jsl explodeSegment
phx
lda segmentStates,x
cmp #SEGMENT_STATE_BODY
@ -1751,6 +1750,7 @@ shootSegment_body anop
jsl scoreAddTen
shootSegment_doneScore anop
plx
jsl explodeSegment
ldy segmentPosOffset,x
lda segmentCurrentTile,y