mirror of
https://github.com/lscharen/iigs-game-engine.git
synced 2025-02-17 01:30:52 +00:00
Reference sprite updates that do not leave trails
This commit is contained in:
parent
9ecc262c58
commit
11bbe7be3d
@ -59,6 +59,12 @@ DOWN_ARROW equ $0A
|
|||||||
; leave it alone. We are just testing the ability to merge sprite plane data into
|
; leave it alone. We are just testing the ability to merge sprite plane data into
|
||||||
; the play field tiles.
|
; the play field tiles.
|
||||||
EvtLoop
|
EvtLoop
|
||||||
|
lda PlayerX ; Move the player sprite a bit
|
||||||
|
sta PlayerXOld
|
||||||
|
inc
|
||||||
|
and #$001F
|
||||||
|
sta PlayerX
|
||||||
|
|
||||||
ldx PlayerX
|
ldx PlayerX
|
||||||
ldy PlayerY
|
ldy PlayerY
|
||||||
jsl GetSpriteVBuffAddr
|
jsl GetSpriteVBuffAddr
|
||||||
@ -67,9 +73,8 @@ EvtLoop
|
|||||||
stx PlayerLastPos ; save for erasure
|
stx PlayerLastPos ; save for erasure
|
||||||
jsl DrawTileSprite
|
jsl DrawTileSprite
|
||||||
|
|
||||||
; Now the sprite has been drawn. Manually update the 4 top-left tiles. Since we have not scrolled
|
; Now the sprite has been drawn. Enqueue the dirty tiles. We blindly add the potential
|
||||||
; the screen, these are the tiles in rows 0 and 1 and columns 0 and 1. The next step is to mark
|
; dirty tiles and rely on PushDirtyTile to elimate duplicates quickly
|
||||||
; those tiles as intersecting a sprite
|
|
||||||
|
|
||||||
lda PlayerX
|
lda PlayerX
|
||||||
lsr
|
lsr
|
||||||
@ -80,21 +85,19 @@ EvtLoop
|
|||||||
ldy #1
|
ldy #1
|
||||||
jsr MakeDirtyTile
|
jsr MakeDirtyTile
|
||||||
|
|
||||||
; If we are not aligned in the x-direction, dirty the tile in front
|
|
||||||
lda PlayerX
|
lda PlayerX
|
||||||
bit #$0003
|
clc
|
||||||
beq :skip1
|
adc #3
|
||||||
inx
|
lsr
|
||||||
ldy #0
|
lsr
|
||||||
|
tax
|
||||||
|
ldy #0 ; Y is fixed
|
||||||
jsr MakeDirtyTile
|
jsr MakeDirtyTile
|
||||||
ldy #1
|
ldy #1
|
||||||
jsr MakeDirtyTile
|
jsr MakeDirtyTile
|
||||||
:skip1
|
|
||||||
|
|
||||||
; If we transitioned to an aligned status, then mark the prior tile as dirty
|
; Add the tiles that the sprite was previously at as well.
|
||||||
lda PlayerX
|
|
||||||
bit #$0003
|
|
||||||
bne :skip2
|
|
||||||
lda PlayerXOld
|
lda PlayerXOld
|
||||||
lsr
|
lsr
|
||||||
lsr
|
lsr
|
||||||
@ -103,18 +106,22 @@ EvtLoop
|
|||||||
jsr MakeDirtyTile
|
jsr MakeDirtyTile
|
||||||
ldy #1
|
ldy #1
|
||||||
jsr MakeDirtyTile
|
jsr MakeDirtyTile
|
||||||
:skip2
|
|
||||||
|
lda PlayerXOld
|
||||||
|
clc
|
||||||
|
adc #3
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
tax
|
||||||
|
ldy #0
|
||||||
|
jsr MakeDirtyTile
|
||||||
|
ldy #1
|
||||||
|
jsr MakeDirtyTile
|
||||||
|
|
||||||
; Let's see what it looks like!
|
; Let's see what it looks like!
|
||||||
|
|
||||||
jsl Render
|
jsl Render
|
||||||
|
|
||||||
lda PlayerX ; Move the player sprite a bit
|
|
||||||
sta PlayerXOld
|
|
||||||
inc
|
|
||||||
and #$001F
|
|
||||||
sta PlayerX
|
|
||||||
|
|
||||||
ldx PlayerLastPos ; Delete the sprite because it moved
|
ldx PlayerLastPos ; Delete the sprite because it moved
|
||||||
jsl EraseTileSprite
|
jsl EraseTileSprite
|
||||||
; tax
|
; tax
|
||||||
|
Loading…
x
Reference in New Issue
Block a user