Dirt explosions now happen at point of projectile hit

This commit is contained in:
blondie7575 2020-01-05 15:48:59 -08:00
parent 48f2e17491
commit 5490294c5f
5 changed files with 22 additions and 11 deletions

14
dirt.s
View File

@ -33,11 +33,7 @@ createDirtExplosion:
lda #1
sta dirtExplosionActive
lda #120
sta PARAML0
lda #100
sta PARAML1
lda #3
lda #3 ; Radius hard-coded for now
sta PARAML2
asl
sta CACHEDATA ; Cache diameter
@ -168,10 +164,13 @@ createDirtExplosionColumnLoopNowY:
;
renderDirtExplosion:
SAVE_AXY
lda dirtExplosionActive
beq renderDirtExplosionDone
ldx #0
stz dirtExplosionActive ; Assume we're done unless a particle says otherwise
renderDirtExplosionLoop:
PARTICLEPTR_XY
jsr updateDirtParticle
@ -266,8 +265,13 @@ updateDirtParticle:
lda #$11
sta SHADOWVRAMBANK,x
; Let everyone know we did work
lda #1
sta dirtExplosionActive
updateDirtParticleDone:
RESTORE_AXY
updateDirtParticleDoneRTS:
rts
updateDirtParticleKill:

View File

@ -177,6 +177,8 @@ gameplayLoopVictoryCondition:
gameplayEndTurnCondition:
lda turnRequested
beq gameplayLoopEndFrame
lda dirtExplosionActive
bne gameplayLoopEndFrame
jsr endTurn
gameplayLoopEndFrame:

Binary file not shown.

View File

@ -222,9 +222,6 @@ allocProjectileDone:
;
;
fireProjectile:
jsr createDirtExplosion
rts
SAVE_AXY
; Allocate a projectile
@ -880,7 +877,7 @@ processPlayerImpactDeath:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; processTerrainImpact
;
; Trashes A,Y, SCRATCHL
; Trashes A,Y, SCRATCHL, PARAML0, PARAML1
;
processTerrainImpact:
ldy projectileActive
@ -901,10 +898,12 @@ processTerrainImpactNegative:
processTerrainStoreContinue:
sta PARAML0
pha ; Dirt explosion will need this
lda projectileData+GO_POSY,y
sec
sbc #GAMEOBJECTHEIGHT ; This fudge makes tunneling work better
sta PARAML1
pha ; Dirt explosion will need this
lda projectileData+JD_TYPE,y
tay
@ -915,7 +914,7 @@ processTerrainStoreContinue:
phy ; We'll need the radius in a moment
jsr craterTerrain
jsr unclipTerrain
; Recompile the rows affected by the crater
@ -937,4 +936,10 @@ processTerrainStoreContinue:
jsr clipTerrain
pla
sta PARAML1
pla
sta PARAML0
jsr createDirtExplosion
rts

View File

@ -282,7 +282,7 @@ compileTerrainDone:
; X = Last row to compile (bottom-relative)
; A = |X-Y|
;
; Trashes A,Y, SCRATCHL
; Trashes A,Y, SCRATCHL, PARAML0, PARAML1
;
compileTerrainChunk:
;HARDBRK