Bug fix for terrain chunk recompiling

This commit is contained in:
blondie7575 2023-08-04 19:23:08 -07:00
parent 4ddb742b5f
commit 49c1b08cb0
2 changed files with 15 additions and 3 deletions

View File

@ -914,7 +914,6 @@ processTerrainImpactStoreContinue:
sta PARAML0
pha ; Dirt explosion will need this
sta compileTerrainRowStart ; Terrain chunk compiler will need this
lda #TERRAINWIDTH
sta compileTerrainRowEnd
lda projectileData+GO_POSY,y
@ -927,6 +926,20 @@ processTerrainImpactStoreContinue:
tay
PROJECTILETYPEPTR_Y
sec ; Quick sidebar to calculate crater compiling extents while we have the pointers
lda #TERRAINWIDTH
sbc compileTerrainRowStart
sbc projectileTypes+PT_RADIUS,y
sbc projectileTypes+PT_RADIUS,y
sta compileTerrainRowStart
sec
lda #TERRAINWIDTH
sbc compileTerrainRowEnd
clc
adc projectileTypes+PT_RADIUS,y
adc #GAMEOBJECTWIDTH
sta compileTerrainRowEnd
;don't forget to clamp these to terrain edges'
lda projectileTypes+PT_RADIUS,y
tay
phy ; We'll need the radius in a moment

View File

@ -289,14 +289,13 @@ compileTerrainDone:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; compileTerrainChunk
;
; Y = First row to compile (bottom-relative)
; X = Last row to compile (bottom-relative)
; compileTerrainRowStart = Start column to compile (logical terrainData index)
; compileTerrainRowEnd = Ending column to compile (logical terrainData index)
;
; Trashes A,Y, SCRATCHL, PARAML0, PARAML1
;
compileTerrainChunk:
ldy #0
tya ; Be extra safe and make sure Y is never negative or we'll spray RAM with terrain data
bmi compileTerrainChunkClampZero
ldx #MAXTERRAINHEIGHT-1