Fix the bugs related to marking dirty tiles for the player. Everything seems to move smoothly now and works well at 2.8MHz. Next, I need to block the player from going over top of mushrooms.

This commit is contained in:
Jeremy Rand 2020-11-05 01:54:12 -05:00
parent edcddc0bd8
commit f58a831eb9
2 changed files with 11 additions and 2 deletions

View File

@ -117,8 +117,8 @@ updatePlayer_skipDeltas anop
updatePlayer_shift anop updatePlayer_shift anop
adc mouseYAddress,y adc mouseYAddress,y
sta mouseAddress
dec a dec a
sta mouseAddress
tay tay
jsl drawShipShift jsl drawShipShift
bra updatePlayer_dirty bra updatePlayer_dirty
@ -127,19 +127,27 @@ updatePlayer_dirty anop
lda mouseAddress lda mouseAddress
sec sec
sbc #SCREEN_ADDRESS sbc #SCREEN_ADDRESS
and #$fff8 and #$fffc
tax tax
lda >screenToTileOffset,x lda >screenToTileOffset,x
tax tax
lda #TILE_STATE_DIRTY lda #TILE_STATE_DIRTY
cpx #RHS_FIRST_TILE_OFFSET
bge updatePlayer_tileOffscreen1
sta tileDirty,x sta tileDirty,x
updatePlayer_tileOffscreen1 anop
ldy tileRight,x ldy tileRight,x
cpy #RHS_FIRST_TILE_OFFSET
bge updatePlayer_tileOffscreen2
sta tileDirty,y sta tileDirty,y
updatePlayer_tileOffscreen2 anop
ldy tileBelow,x ldy tileBelow,x
cpy #INVALID_TILE_NUM cpy #INVALID_TILE_NUM
beq updatePlayer_done beq updatePlayer_done
sta tileDirty,y sta tileDirty,y
ldx tileRight,y ldx tileRight,y
cpx #RHS_FIRST_TILE_OFFSET
bge updatePlayer_done
sta tileDirty,x sta tileDirty,x
updatePlayer_done anop updatePlayer_done anop

View File

@ -8,6 +8,7 @@ s6d2 =
s7d1 = /Users/jrand/Library/Developer/Xcode/DerivedData/BuGS-bffpexoblaghkzcbtjtzxeulnuto/Build/Products/Debug/BuGS.2mg s7d1 = /Users/jrand/Library/Developer/Xcode/DerivedData/BuGS-bffpexoblaghkzcbtjtzxeulnuto/Build/Products/Debug/BuGS.2mg
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