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