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