Add a SPRITE_HIDE flag to toggle whether a sprite is drawn or not

This commit is contained in:
Lucas Scharenbroich 2021-11-22 13:26:25 -06:00
parent 2683a91e93
commit 5bc9cc7ff2
2 changed files with 9 additions and 3 deletions

View File

@ -138,6 +138,7 @@ TILE_VFLIP_BIT equ $0400
TILE_HFLIP_BIT equ $0200
; Sprite constants
SPRITE_HIDE equ $8000
SPRITE_16X16 equ $1800
SPRITE_16X8 equ $1000
SPRITE_8X16 equ $0800

View File

@ -190,7 +190,11 @@ _RenderSprites
; Draw the sprite into the sprint plane buffer(s)
jsr _DrawSpriteY ; Use variant that takes the Y-register arg
lda _Sprites+SPRITE_ID,y
bit #SPRITE_HIDE
bne :next
jsr _DrawSpriteYA ; Use variant that takes the Y-register arg
; Mark the appropriate tiles as dirty and as occupied by a sprite so that the ApplyTiles
; subroutine will get the drawn data from the sprite plane into the code field where it
@ -199,8 +203,8 @@ _RenderSprites
ldx tmp0 ; Restore the index into the sprite array
jsr _MarkDirtySprite ; Mark the tiles that this sprite overlaps as dirty
ldx tmp0 ; Restore the index again
brl :next
ldy tmp0 ; Restore the index again
bra :next
; _GetTileAt
;
@ -330,6 +334,7 @@ _DrawSprite
txy
_DrawSpriteY
lda _Sprites+SPRITE_ID,y
_DrawSpriteYA
and #$1E00 ; use bits 9, 10, 11 and 12 to dispatch
xba
tax