I believe I have fixed the invisible mushroom bug. I have inspected all of the code which sets a tileType to something that didn't mark the tile as dirty. I believe the problem occurred because the code in update which placed/changed mushrooms assumed that the draw code which then mark the tile as dirty because the bug which caused the change which dirty that tile. But that is an assumption. If the bug is shot, perhaps the draw routine will not mark the tile dirty. So, now the tile is always marked dirty right at the point where the mushroom is placed. I believe this will fix the problem but more play testing is required to confirm I don't see it anymore.

This commit is contained in:
Jeremy Rand 2020-12-26 15:26:19 -05:00
parent cdded307f9
commit 8963a9d76c
4 changed files with 14 additions and 3 deletions

View File

@ -3,8 +3,6 @@ BUGS
This is a list of the software bugs (as opposed to the bugs in the game that you shoot) that still need attention:
* I have seen some mushrooms appear suddenly. Sometimes, if I am shooting, the shot "hits" an invisible mushroom which then becomes visible. My guess is that there is something wrong with the code which turns a centipede segment into a mushroom when shot and the tile isn't correctly marked dirty all the time.
* In theory, there shouldn't be a collision with an invisible mushroom but what happens is that when the shot overlaps with the tile, it becomes dirty. At that point, the mushroom will appear on the next frame and a collision can then occur.
* It is possible to shoot between two segments of a centipede. The problem is that there are black pixels between the segments and if things are timed just right (or just wrong), the shot can slot in at those black pixels and end up missing both segments.
* I am not sure how much can be done about this given how collisions are detected.
* The sound is muddy at times on real HW. Especially when lots of stuff is going on, the sound ends up coming out garbled. This isn't happening on emulators where everything is always quite clear. Perhaps I am reaching some limit of the Ensoniq. Do I need to reduce some sampling frequencies perhaps?
@ -12,6 +10,9 @@ This is a list of the software bugs (as opposed to the bugs in the game that you
FIXED
=======
* I have seen some mushrooms appear suddenly. Sometimes, if I am shooting, the shot "hits" an invisible mushroom which then becomes visible. My guess is that there is something wrong with the code which turns a centipede segment into a mushroom when shot and the tile isn't correctly marked dirty all the time.
* In theory, there shouldn't be a collision with an invisible mushroom but what happens is that when the shot overlaps with the tile, it becomes dirty. At that point, the mushroom will appear on the next frame and a collision can then occur.
* On the latest build (0136579125034f41f8415b496d5ba706e86d65d9) on real HW, I can play a game and finish that game. But when I try to start a second game, I crash. The stack looks corrupted and execution is way off in the weeds somewhere. This isn't happening on either emulator.
* I am thinking this is the same crash as the one which follows. I tried to reproduce this on real HW again with that debug in place but could not.
* I reproduced a crash on GSPlus after dying and starting a new game. From the stack, it was clear it was trying to draw a body segment but the jump instruction was set to garbage. I am hoping this is the same crash as the one saw on real HW.

View File

@ -177,6 +177,8 @@ updateFlea_nextTile anop
bne updateFlea_nextAction
lda #TILE_MUSHROOM4
sta tileType,x
lda #TILE_STATE_DIRTY
sta tileDirty,x
cpx #SPIDER_STARTING_TOP_ROW_OFFSET
blt updateFlea_nextAction
inc numInfieldMushrooms

View File

@ -127,7 +127,9 @@ updateScorpion_nextAction anop
updateScorpion_nextByteTest anop
and #$1
beq updateScorpion_done
bne updateScorpion_isNextByte
rtl
updateScorpion_isNextByte anop
lda scorpionState
cmp #SCORPION_STATE_LEFT
beq updateScorpion_screenLeft
@ -191,6 +193,8 @@ updateScorpion_maybePoison anop
ora #TILE_POISON_A_MUSHROOM
sta tileType,x
lda #TILE_STATE_DIRTY
sta tileDirty,x
updateScorpion_done anop
rtl

View File

@ -440,6 +440,8 @@ updateSpider_tilesUp anop
beq updateSpider_tilesUpCont
lda #TILE_EMPTY
sta tileType,x
lda #TILE_STATE_DIRTY
sta tileDirty,x
cpx #SPIDER_STARTING_TOP_ROW_OFFSET
blt updateSpider_tilesUpCont
dec numInfieldMushrooms
@ -517,6 +519,8 @@ updateSpider_tilesDown anop
beq updateSpider_tilesDownCont
lda #TILE_EMPTY
sta tileType,x
lda #TILE_STATE_DIRTY
sta tileDirty,x
cpx #SPIDER_STARTING_TOP_ROW_OFFSET
blt updateSpider_tilesDownCont
dec numInfieldMushrooms