mirror of
https://github.com/lscharen/iigs-game-engine.git
synced 2024-06-10 01:29:29 +00:00
Enable all dirty bits to minimize per-frame, per-sprite work
This commit is contained in:
parent
88fba6cd15
commit
7bde48e36c
14
src/Sprite.s
14
src/Sprite.s
|
@ -307,7 +307,7 @@ _DoPhase1
|
||||||
bit #SPRITE_STATUS_REMOVED
|
bit #SPRITE_STATUS_REMOVED
|
||||||
beq :out
|
beq :out
|
||||||
|
|
||||||
lda #SPRITE_STATUS_EMPTY ; Mark as empty
|
lda #SPRITE_STATUS_EMPTY ; Mark as empty (zero value)
|
||||||
sta _Sprites+SPRITE_STATUS,y
|
sta _Sprites+SPRITE_STATUS,y
|
||||||
|
|
||||||
lda _SpriteBits,y ; Clear from the sprite bitmap
|
lda _SpriteBits,y ; Clear from the sprite bitmap
|
||||||
|
@ -384,10 +384,15 @@ phase2 dw :phase2_0
|
||||||
|
|
||||||
_DoPhase2
|
_DoPhase2
|
||||||
lda _Sprites+SPRITE_STATUS,y
|
lda _Sprites+SPRITE_STATUS,y
|
||||||
|
beq :out ; If phase 1 marked us as empty, do nothing
|
||||||
ora forceSpriteFlag
|
ora forceSpriteFlag
|
||||||
and #SPRITE_STATUS_ADDED+SPRITE_STATUS_MOVED+SPRITE_STATUS_UPDATED
|
and #SPRITE_STATUS_ADDED+SPRITE_STATUS_MOVED+SPRITE_STATUS_UPDATED
|
||||||
beq :out
|
beq :out
|
||||||
|
|
||||||
|
; Last thing to do, so go ahead and clear the flags
|
||||||
|
lda #SPRITE_STATUS_OCCUPIED
|
||||||
|
sta _Sprites+SPRITE_STATUS,y
|
||||||
|
|
||||||
; Mark the appropriate tiles as dirty and as occupied by a sprite so that the ApplyTiles
|
; Mark the appropriate tiles as dirty and as occupied by a sprite so that the ApplyTiles
|
||||||
; subroutine will combine the sprite data with the tile data into the code field where it
|
; subroutine will combine the sprite data with the tile data into the code field where it
|
||||||
; can be drawn to the screen. This routine is also responsible for setting the specific
|
; can be drawn to the screen. This routine is also responsible for setting the specific
|
||||||
|
@ -489,7 +494,8 @@ phase1_rtn
|
||||||
jmp (phase2,x)
|
jmp (phase2,x)
|
||||||
phase2_rtn
|
phase2_rtn
|
||||||
|
|
||||||
; Sprite rendering complete
|
; Sprite rendering complete, clear the dirty bits
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; _GetTileAt
|
; _GetTileAt
|
||||||
|
@ -726,6 +732,9 @@ _UpdateSpriteX
|
||||||
|
|
||||||
:ok
|
:ok
|
||||||
_UpdateSpriteXnc
|
_UpdateSpriteXnc
|
||||||
|
cmp _Sprites+SPRITE_ID,x ; Don't do anything if there is no change
|
||||||
|
beq :no_sprite_change
|
||||||
|
|
||||||
sta _Sprites+SPRITE_ID,x ; Keep a copy of the full descriptor
|
sta _Sprites+SPRITE_ID,x ; Keep a copy of the full descriptor
|
||||||
jsr _GetBaseTileAddr ; This applies the TILE_ID_MASK
|
jsr _GetBaseTileAddr ; This applies the TILE_ID_MASK
|
||||||
cmp _Sprites+TILE_DATA_OFFSET,x
|
cmp _Sprites+TILE_DATA_OFFSET,x
|
||||||
|
@ -740,6 +749,7 @@ _UpdateSpriteXnc
|
||||||
ora #SPRITE_STATUS_UPDATED
|
ora #SPRITE_STATUS_UPDATED
|
||||||
sta _Sprites+SPRITE_STATUS,x
|
sta _Sprites+SPRITE_STATUS,x
|
||||||
|
|
||||||
|
:no_sprite_change
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; Move a sprite to a new location. If the tile ID of the sprite needs to be changed, then
|
; Move a sprite to a new location. If the tile ID of the sprite needs to be changed, then
|
||||||
|
|
Loading…
Reference in New Issue
Block a user