mirror of
https://github.com/jeremysrand/BuGS.git
synced 2025-01-16 22:30:52 +00:00
Simplify the handling of the dirty tiles to just store the dirty word and not keep the array of dirty tile offsets. Have the flea use game and non-game dirty tiles to fix the problem with LHS tiles being marked dirty all the time.
This commit is contained in:
parent
22a22d3533
commit
92c02ded0f
@ -102,7 +102,6 @@ gameDone anop
|
||||
|
||||
|
||||
drawDirtyGameTiles entry
|
||||
stz numDirtyGameTiles
|
||||
_drawDirtyGameRow 0
|
||||
_drawDirtyGameRow 1
|
||||
_drawDirtyGameRow 2
|
||||
|
@ -25,22 +25,19 @@ FLEA_FAST_UPDATES_PER_TILE equ TILE_PIXEL_HEIGHT/4-1
|
||||
|
||||
drawFlea entry
|
||||
lda fleaState
|
||||
beq drawFlea_done
|
||||
bne drawFlea_cont
|
||||
rtl
|
||||
|
||||
drawFlea_cont anop
|
||||
ldy fleaScreenOffset
|
||||
ldx fleaSprite
|
||||
jsl fleaJump
|
||||
|
||||
ldy numDirtyGameTiles
|
||||
_dirtyGameOrNonGameTile fleaTileOffsets
|
||||
_dirtyGameOrNonGameTile fleaTileOffsets+2
|
||||
_dirtyGameOrNonGameTile fleaTileOffsets+4
|
||||
_dirtyGameOrNonGameTile fleaTileOffsets+6
|
||||
|
||||
_dirtyGameTileWithY fleaTileOffsets
|
||||
_dirtyGameTileWithY fleaTileOffsets+2
|
||||
_dirtyGameTileWithY fleaTileOffsets+4
|
||||
_dirtyGameTileWithY fleaTileOffsets+6
|
||||
|
||||
sty numDirtyGameTiles
|
||||
|
||||
drawFlea_done anop
|
||||
rtl
|
||||
|
||||
|
||||
|
@ -60,10 +60,10 @@ drawSegments_handleTiles anop
|
||||
asl a
|
||||
tay
|
||||
|
||||
_dirtyGameTile segmentTileOffsets
|
||||
_dirtyGameTile segmentTileOffsets+2
|
||||
_dirtyGameTile segmentTileOffsets+4
|
||||
_dirtyGameTile segmentTileOffsets+6
|
||||
_dirtyGameTileWithY segmentTileOffsets
|
||||
_dirtyGameTileWithY segmentTileOffsets+2
|
||||
_dirtyGameTileWithY segmentTileOffsets+4
|
||||
_dirtyGameTileWithY segmentTileOffsets+6
|
||||
plx
|
||||
|
||||
drawSegments_skipSegment anop
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
macro
|
||||
_drawDirtyGameRow &rowNum
|
||||
trace on
|
||||
short i,m
|
||||
lda >BORDER_COLOUR_REGISTER
|
||||
and #$f0
|
||||
@ -64,48 +63,16 @@ _drawDirtyGameRow_wait&rowNum anop
|
||||
_drawDirtyGameRow_skip&tileOffset anop
|
||||
&tileOffset seta &tileOffset+2
|
||||
aif &tileOffset<&lastTileOffset,.drawDirtyGameRowLoop
|
||||
trace off
|
||||
|
||||
mend
|
||||
|
||||
; 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,y
|
||||
lda tileDirty,x
|
||||
bne _dirtyGameTile_skip&SYSCNT
|
||||
lda #TILE_STATE_DIRTY
|
||||
sta tileDirty,x
|
||||
txa
|
||||
ldx numDirtyGameTiles
|
||||
sta dirtyGameTiles,x
|
||||
inx
|
||||
inx
|
||||
stx 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 tileDirty,x
|
||||
bne _dirtyGameTileWithY_skip&SYSCNT
|
||||
ldx &tileOffset,y
|
||||
lda #TILE_STATE_DIRTY
|
||||
sta tileDirty,x
|
||||
txa
|
||||
sta dirtyGameTiles,y
|
||||
iny
|
||||
iny
|
||||
|
||||
_dirtyGameTileWithY_skip&SYSCNT anop
|
||||
mend
|
||||
|
||||
|
||||
@ -113,23 +80,20 @@ _dirtyGameTileWithY_skip&SYSCNT anop
|
||||
_dirtyGameOrNonGameTile &tileOffset
|
||||
|
||||
ldx &tileOffset
|
||||
cpx #RHS_FIRST_TILE_OFFSET
|
||||
bge _dirtyGameTile_nonGame&SYSCNT
|
||||
lda #TILE_STATE_DIRTY
|
||||
sta tileDirty,x
|
||||
bra _dirtyGameTile_skip&SYSCNT
|
||||
|
||||
_dirtyGameTile_nonGame&SYSCNT anop
|
||||
lda tileDirty,x
|
||||
bne _dirtyGameTile_skip&SYSCNT
|
||||
lda #TILE_STATE_DIRTY
|
||||
sta tileDirty,x
|
||||
txa
|
||||
cmp #RHS_FIRST_TILE_OFFSET
|
||||
bge _dirtyGameTile_nonGame&SYSCNT
|
||||
|
||||
ldy numDirtyGameTiles
|
||||
sta dirtyGameTiles,y
|
||||
iny
|
||||
iny
|
||||
sty numDirtyGameTiles
|
||||
bra _dirtyGameTile_skip&SYSCNT
|
||||
|
||||
_dirtyGameTile_nonGame&SYSCNT anop
|
||||
ldy numDirtyNonGameTiles
|
||||
txa
|
||||
sta dirtyNonGameTiles,y
|
||||
iny
|
||||
iny
|
||||
|
11
BuGS/tiles.c
11
BuGS/tiles.c
@ -37,12 +37,7 @@
|
||||
#define STARTING_NUM_MUSHROOMS 30
|
||||
#define STARTING_NUM_PLAYERS 3
|
||||
|
||||
#define ADD_DIRTY_GAME_TILE(tileNum) \
|
||||
if (!tileDirty[tileNum]) { \
|
||||
tileDirty[tileNum] = 1; \
|
||||
dirtyGameTiles[numDirtyGameTiles / 2] = ((tileNum) * sizeof(word)); \
|
||||
numDirtyGameTiles += 2; \
|
||||
}
|
||||
#define ADD_DIRTY_GAME_TILE(tileNum) tileDirty[tileNum] = 1;
|
||||
|
||||
#define ADD_DIRTY_NON_GAME_TILE(tileNum) \
|
||||
if (!tileDirty[tileNum]) { \
|
||||
@ -61,9 +56,6 @@ tTileOffset tileBelow[TOTAL_NUM_TILES];
|
||||
tTileOffset tileLeft[TOTAL_NUM_TILES];
|
||||
tTileOffset tileRight[TOTAL_NUM_TILES];
|
||||
|
||||
tTileOffset dirtyGameTiles[NUM_GAME_TILES + GAME_NUM_TILES_TALL];
|
||||
word numDirtyGameTiles;
|
||||
|
||||
tTileOffset dirtyNonGameTiles[NUM_NON_GAME_TILES];
|
||||
word numDirtyNonGameTiles;
|
||||
|
||||
@ -179,7 +171,6 @@ void initTiles(void)
|
||||
}
|
||||
}
|
||||
|
||||
numDirtyGameTiles = 0;
|
||||
numDirtyNonGameTiles = 0;
|
||||
}
|
||||
|
||||
|
@ -113,8 +113,6 @@ extern tTileOffset tileBelow[TOTAL_NUM_TILES];
|
||||
extern tTileOffset tileLeft[TOTAL_NUM_TILES];
|
||||
extern tTileOffset tileRight[TOTAL_NUM_TILES];
|
||||
|
||||
extern tTileOffset dirtyGameTiles[NUM_GAME_TILES + GAME_NUM_TILES_TALL];
|
||||
extern word numDirtyGameTiles;
|
||||
extern tTileOffset dirtyNonGameTiles[NUM_NON_GAME_TILES];
|
||||
extern word numDirtyNonGameTiles;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user