diff --git a/dirt.s b/dirt.s index 46a1897..c91ce8b 100644 --- a/dirt.s +++ b/dirt.s @@ -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: diff --git a/gamemanager.s b/gamemanager.s index ead409e..f9bcc04 100644 --- a/gamemanager.s +++ b/gamemanager.s @@ -177,6 +177,8 @@ gameplayLoopVictoryCondition: gameplayEndTurnCondition: lda turnRequested beq gameplayLoopEndFrame + lda dirtExplosionActive + bne gameplayLoopEndFrame jsr endTurn gameplayLoopEndFrame: diff --git a/gscats.2mg b/gscats.2mg index 9b21d7b..7f1ca30 100644 Binary files a/gscats.2mg and b/gscats.2mg differ diff --git a/projectile.s b/projectile.s index ae0ce53..9b1e65e 100644 --- a/projectile.s +++ b/projectile.s @@ -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 diff --git a/terrain.s b/terrain.s index 5287aa0..94874ec 100644 --- a/terrain.s +++ b/terrain.s @@ -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