mirror of
https://github.com/lscharen/iigs-game-engine.git
synced 2024-06-13 04:29:30 +00:00
Add a SPRITE_HIDE flag to toggle whether a sprite is drawn or not
This commit is contained in:
parent
2683a91e93
commit
5bc9cc7ff2
|
@ -138,6 +138,7 @@ TILE_VFLIP_BIT equ $0400
|
||||||
TILE_HFLIP_BIT equ $0200
|
TILE_HFLIP_BIT equ $0200
|
||||||
|
|
||||||
; Sprite constants
|
; Sprite constants
|
||||||
|
SPRITE_HIDE equ $8000
|
||||||
SPRITE_16X16 equ $1800
|
SPRITE_16X16 equ $1800
|
||||||
SPRITE_16X8 equ $1000
|
SPRITE_16X8 equ $1000
|
||||||
SPRITE_8X16 equ $0800
|
SPRITE_8X16 equ $0800
|
||||||
|
|
11
src/Sprite.s
11
src/Sprite.s
|
@ -190,7 +190,11 @@ _RenderSprites
|
||||||
|
|
||||||
; Draw the sprite into the sprint plane buffer(s)
|
; 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
|
; 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
|
; 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
|
ldx tmp0 ; Restore the index into the sprite array
|
||||||
jsr _MarkDirtySprite ; Mark the tiles that this sprite overlaps as dirty
|
jsr _MarkDirtySprite ; Mark the tiles that this sprite overlaps as dirty
|
||||||
|
|
||||||
ldx tmp0 ; Restore the index again
|
ldy tmp0 ; Restore the index again
|
||||||
brl :next
|
bra :next
|
||||||
|
|
||||||
; _GetTileAt
|
; _GetTileAt
|
||||||
;
|
;
|
||||||
|
@ -330,6 +334,7 @@ _DrawSprite
|
||||||
txy
|
txy
|
||||||
_DrawSpriteY
|
_DrawSpriteY
|
||||||
lda _Sprites+SPRITE_ID,y
|
lda _Sprites+SPRITE_ID,y
|
||||||
|
_DrawSpriteYA
|
||||||
and #$1E00 ; use bits 9, 10, 11 and 12 to dispatch
|
and #$1E00 ; use bits 9, 10, 11 and 12 to dispatch
|
||||||
xba
|
xba
|
||||||
tax
|
tax
|
||||||
|
|
Loading…
Reference in New Issue
Block a user