Implemented projectile sprite flipping

This commit is contained in:
blondie7575 2018-12-29 18:10:21 -07:00
parent c72e8c125b
commit 1179aa7678
2 changed files with 21 additions and 20 deletions

Binary file not shown.

View File

@ -102,8 +102,9 @@ projectileTypes:
.addr 0 ; Update .addr 0 ; Update
.addr 0 ; Render .addr 0 ; Render
.addr 0 ; Cleanup .addr 0 ; Cleanup
.word 1 ; Directional
.repeat 14 .repeat 12
.byte 0 ; Padding to 32-byte boundary .byte 0 ; Padding to 32-byte boundary
.endrepeat .endrepeat
@ -117,8 +118,9 @@ projectileTypes:
.addr 0 ; Update .addr 0 ; Update
.addr 0 ; Render .addr 0 ; Render
.addr 0 ; Cleanup .addr 0 ; Cleanup
.word 0 ; Directional
.repeat 14 .repeat 12
.byte 0 ; Padding to 32-byte boundary .byte 0 ; Padding to 32-byte boundary
.endrepeat .endrepeat
@ -132,8 +134,9 @@ projectileTypes:
.addr updateFan ; Update .addr updateFan ; Update
.addr renderFan ; Render .addr renderFan ; Render
.addr deleteFan ; Cleanup .addr deleteFan ; Cleanup
.word 1 ; Directional
.repeat 14 .repeat 12
.byte 0 ; Padding to 32-byte boundary .byte 0 ; Padding to 32-byte boundary
.endrepeat .endrepeat
@ -147,6 +150,7 @@ PT_DEPLOY = 10
PT_UPDATE = 12 PT_UPDATE = 12
PT_RENDER = 14 PT_RENDER = 14
PT_CLEANUP = 16 PT_CLEANUP = 16
PT_DIRECTIONAL = 18
.macro PROJECTILEPTR_Y .macro PROJECTILEPTR_Y
tya ; Pointer to projectile structure from index tya ; Pointer to projectile structure from index
@ -717,6 +721,7 @@ renderProjectilesSkip:
; renderProjectile ; renderProjectile
; ;
; Y = Offset to projectile structure ; Y = Offset to projectile structure
; Trashes SCRATCHL
; ;
renderProjectile: renderProjectile:
SAVE_AXY SAVE_AXY
@ -738,9 +743,6 @@ renderProjectileDoIt:
sta PARAML0 sta PARAML0
; Determine which sprite to use ; Determine which sprite to use
lda projectileData+JD_VX,y
bmi renderProjectileNegX
lda projectileData+JD_VY,y lda projectileData+JD_VY,y
bmi renderProjectileNegYPosX bmi renderProjectileNegYPosX
@ -759,24 +761,23 @@ renderProjectileDownAngle:
lda projectileTypes+PT_FRAME2,x ; Down angle lda projectileTypes+PT_FRAME2,x ; Down angle
bra renderProjectileGoSprite bra renderProjectileGoSprite
renderProjectileNegX:
lda projectileData+JD_VY,y
bmi renderProjectileNegYNegX
cmp #UPANGLE
bmi renderProjectileFlat
bra renderProjectileDownAngle
renderProjectileNegYNegX:
cmp #DNANGLE
bpl renderProjectileFlat
bra renderProjectileUpAngle
renderProjectileFlat: renderProjectileFlat:
lda projectileTypes+PT_FRAME1,x ; Flat lda projectileTypes+PT_FRAME1,x ; Flat
renderProjectileGoSprite: renderProjectileGoSprite:
sta SCRATCHL
lda projectileTypes+PT_DIRECTIONAL,x
beq renderProjectileGoSpriteNormal
lda projectileData+JD_FACING,y ; Projectile is directional, so flip sprite if needed
beq renderProjectileGoSpriteNormal
lda SCRATCHL
inc ; Flip it!
bra renderProjectileGoSpriteFlipped
renderProjectileGoSpriteNormal:
lda SCRATCHL
renderProjectileGoSpriteFlipped:
jsr renderGameObject jsr renderGameObject
; Check for special deployment code ; Check for special deployment code