mirror of
https://github.com/jeremysrand/BuGS.git
synced 2025-01-01 01:30:27 +00:00
Add code to support marking dirty tiles under head and body segments.
This commit is contained in:
parent
d8e9c6863b
commit
3a63b2ef1b
@ -33,10 +33,10 @@ drawFlea entry
|
||||
|
||||
ldy numDirtyGameTiles
|
||||
|
||||
_dirtyGameTile fleaTileOffsets
|
||||
_dirtyGameTile fleaTileOffsets+2
|
||||
_dirtyGameTile fleaTileOffsets+4
|
||||
_dirtyGameTile fleaTileOffsets+6
|
||||
_dirtyGameTileWithY fleaTileOffsets
|
||||
_dirtyGameTileWithY fleaTileOffsets+2
|
||||
_dirtyGameTileWithY fleaTileOffsets+4
|
||||
_dirtyGameTileWithY fleaTileOffsets+6
|
||||
|
||||
sty numDirtyGameTiles
|
||||
|
||||
@ -141,6 +141,8 @@ updateFlea_nextTile anop
|
||||
|
||||
updateFlea_bottom anop
|
||||
stz fleaState
|
||||
; Uncomment the next line to continuously display fleas.
|
||||
; jsl addFlea
|
||||
rtl
|
||||
|
||||
updateFlea_nextAction anop
|
||||
|
@ -173,6 +173,8 @@ updateScorpion_done anop
|
||||
|
||||
updateScorpion_offScreen anop
|
||||
stz scorpionState
|
||||
; Uncomment the following line to continuously add scorpions
|
||||
; jsl addScorpion
|
||||
rtl
|
||||
|
||||
updateScorpion_exploding anop
|
||||
|
@ -35,8 +35,10 @@ drawSegments entry
|
||||
ldx #SEGMENT_MAX_OFFSET
|
||||
drawSegments_nextSegment anop
|
||||
lda segmentStates,x
|
||||
beq drawSegments_skipSegment
|
||||
|
||||
bne drawSegments_cont
|
||||
jmp drawSegments_skipSegment
|
||||
|
||||
drawSegments_cont anop
|
||||
lda segmentFacing,x
|
||||
clc
|
||||
adc segmentSpriteOffset
|
||||
@ -46,15 +48,31 @@ drawSegments_nextSegment anop
|
||||
cmp #SEGMENT_STATE_HEAD
|
||||
beq drawSegments_head
|
||||
jsl segmentBodyJump
|
||||
bra drawSegments_skipSegment
|
||||
bra drawSegments_handleTiles
|
||||
|
||||
drawSegments_head anop
|
||||
jsl segmentHeadJump
|
||||
|
||||
|
||||
drawSegments_handleTiles anop
|
||||
phx
|
||||
txa
|
||||
asl a
|
||||
asl a
|
||||
tay
|
||||
|
||||
_dirtyGameTile segmentTileOffsets
|
||||
_dirtyGameTile segmentTileOffsets+2
|
||||
_dirtyGameTile segmentTileOffsets+4
|
||||
_dirtyGameTile segmentTileOffsets+6
|
||||
plx
|
||||
|
||||
drawSegments_skipSegment anop
|
||||
dex
|
||||
dex
|
||||
bpl drawSegments_nextSegment
|
||||
bmi drawSegments_done
|
||||
jmp drawSegments_nextSegment
|
||||
|
||||
drawSegments_done anop
|
||||
rtl
|
||||
|
||||
|
||||
@ -144,6 +162,7 @@ segmentDirections dc 12i2'SEGMENT_DIR_RIGHT'
|
||||
segmentFacing dc 12i2'SEGMENT_FACING_DOWN'
|
||||
segmentScreenOffsets dc 12i2'0'
|
||||
segmentScreenShifts dc 12i2'0'
|
||||
segmentTileOffsets dc 48i2'0'
|
||||
|
||||
SEGMENT_SPRITE_LAST_OFFSET gequ 7*4
|
||||
segmentSpriteOffset dc i2'SEGMENT_SPRITE_LAST_OFFSET'
|
||||
|
@ -514,6 +514,8 @@ updateSpider_downChangeDirDiagRight anop
|
||||
|
||||
updateSpider_offScreen anop
|
||||
stz spiderState
|
||||
; Uncomment the following line to continuously add
|
||||
; jsl addSpider
|
||||
rtl
|
||||
|
||||
|
||||
|
@ -7,22 +7,44 @@
|
||||
;
|
||||
|
||||
|
||||
; Call this with Y already loaded with the numDirtyGameTiles. Also, the new
|
||||
; numDirtyGameTiles is left in Y. The caller must store it.
|
||||
; This macro uses the Y register as an index into the tile offsets. This is
|
||||
; needed for segments because each segment has their own dirty tile offsets.
|
||||
macro
|
||||
_dirtyGameTile &tileOffset
|
||||
|
||||
ldx &tileOffset
|
||||
ldx &tileOffset,y
|
||||
lda tiles+TILE_DIRTY_OFFSET,x
|
||||
bne _dirtyGameTile_skip&SYSCNT
|
||||
lda #TILE_STATE_DIRTY
|
||||
sta tiles+TILE_DIRTY_OFFSET,x
|
||||
txa
|
||||
ldx numDirtyGameTiles
|
||||
sta dirtyGameTiles,x
|
||||
inx
|
||||
inx
|
||||
sta numDirtyGameTiles
|
||||
|
||||
_dirtyGameTile_skip&SYSCNT anop
|
||||
mend
|
||||
|
||||
|
||||
|
||||
; Call this with Y already loaded with the numDirtyGameTiles. Also, the new
|
||||
; numDirtyGameTiles is left in Y. The caller must store it.
|
||||
macro
|
||||
_dirtyGameTileWithY &tileOffset
|
||||
|
||||
ldx &tileOffset
|
||||
lda tiles+TILE_DIRTY_OFFSET,x
|
||||
bne _dirtyGameTileWithY_skip&SYSCNT
|
||||
lda #TILE_STATE_DIRTY
|
||||
sta tiles+TILE_DIRTY_OFFSET,x
|
||||
txa
|
||||
sta dirtyGameTiles,y
|
||||
iny
|
||||
iny
|
||||
|
||||
_dirtyGameTile_skip&SYSCNT anop
|
||||
_dirtyGameTileWithY_skip&SYSCNT anop
|
||||
mend
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user