mirror of
https://github.com/lscharen/iigs-game-engine.git
synced 2025-01-30 06:31:55 +00:00
Add back support for SPRITE_HIDE control bit
This commit is contained in:
parent
e9a2b8569b
commit
552d32d0fa
25
src/Sprite.s
25
src/Sprite.s
@ -223,9 +223,11 @@ _DoPhase1
|
||||
trb SpriteMap
|
||||
lda #SPRITE_STATUS_EMPTY ; Mark as empty so no error if we try to Add a sprite here again
|
||||
sta _Sprites+SPRITE_STATUS,y
|
||||
:hidden
|
||||
jmp _ClearSpriteFromTileStore ; Clear the tile flags, add to the dirty tile list and done
|
||||
|
||||
:hidden
|
||||
jmp _ClearSpriteFromTileStore
|
||||
|
||||
:no_clear
|
||||
|
||||
; If the sprite is hidden, then treat it like it's offscreen and clear it from the tile store. Because
|
||||
@ -263,8 +265,9 @@ _DoPhase1
|
||||
:updated
|
||||
jsr _CalcDirtySprite ; This function preserves Y
|
||||
|
||||
lda #SPRITE_STATUS_OCCUPIED ; Clear the dirty bits (ADDED, UPDATED, MOVED)
|
||||
sta _Sprites+SPRITE_STATUS,y
|
||||
lda #$FFFF!{SPRITE_STATUS_ADDED.SPRITE_STATUS_UPDATED.SPRITE_STATUS_MOVED}
|
||||
and _Sprites+SPRITE_STATUS,y
|
||||
sta _Sprites+SPRITE_STATUS,y ; Clear the dirty bits (ADDED, UPDATED, MOVED)
|
||||
|
||||
jmp _MarkDirtySpriteTiles
|
||||
|
||||
@ -380,7 +383,7 @@ _AddSprite
|
||||
|
||||
sta _Sprites+SPRITE_ID,x ; Keep a copy of the full descriptor
|
||||
|
||||
lda #SPRITE_STATUS_OCCUPIED+SPRITE_STATUS_ADDED
|
||||
lda #SPRITE_STATUS_ADDED
|
||||
sta _Sprites+SPRITE_STATUS,x
|
||||
|
||||
stz _Sprites+VBUFF_ADDR,x ; Clear the VBUFF address, just to initialize it
|
||||
@ -779,7 +782,7 @@ _UpdateSprite
|
||||
; Do some work to see if only the H or V bits have changed. If so, merge them into the
|
||||
; SPRITE_ID
|
||||
eor _Sprites+SPRITE_ID,x ; If either bit has changed, this will be non-zero
|
||||
and #SPRITE_VFLIP+SPRITE_HFLIP
|
||||
and #SPRITE_VFLIP+SPRITE_HFLIP+SPRITE_HIDE
|
||||
bne :sprite_flag_change
|
||||
|
||||
tya
|
||||
@ -790,6 +793,18 @@ _UpdateSprite
|
||||
:sprite_flag_change
|
||||
eor _Sprites+SPRITE_ID,x ; put the new bits into the value. ---HV--- ^ SPRITE_ID & 00011000 ^ SPRITE_ID = SSSHVSSS
|
||||
sta _Sprites+SPRITE_ID,x ; Keep a copy of the full descriptor
|
||||
|
||||
bit #SPRITE_HIDE ; Sync the SPRITE_HIDE bit into the SPRITE_STATUS_HIDDEN flag
|
||||
beq :not_hidden
|
||||
lda #SPRITE_STATUS_HIDDEN
|
||||
ora _Sprites+SPRITE_STATUS,x
|
||||
sta _Sprites+SPRITE_STATUS,x
|
||||
bra :sync_complete
|
||||
:not_hidden lda #$FFFF!SPRITE_STATUS_HIDDEN
|
||||
and _Sprites+SPRITE_STATUS,x
|
||||
sta _Sprites+SPRITE_STATUS,x
|
||||
:sync_complete
|
||||
|
||||
tya
|
||||
:sprite_stamp_change
|
||||
sta _Sprites+VBUFF_ADDR,x ; Just save this to stay in sync
|
||||
|
Loading…
x
Reference in New Issue
Block a user