mirror of
https://github.com/blondie7575/GSCats.git
synced 2025-02-19 14:30:58 +00:00
Only recompile affected terrain rows for cratering
This commit is contained in:
parent
2d58dc0862
commit
9baa167896
BIN
gscats.2mg
BIN
gscats.2mg
Binary file not shown.
30
projectile.s
30
projectile.s
@ -877,7 +877,7 @@ processPlayerImpactDeath:
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; processTerrainImpact
|
||||
;
|
||||
; Trashes A,Y
|
||||
; Trashes A,Y, SCRATCHL
|
||||
;
|
||||
processTerrainImpact:
|
||||
ldy projectileActive
|
||||
@ -888,17 +888,19 @@ processTerrainImpact:
|
||||
|
||||
lda projectileData+GO_POSX,y
|
||||
clc
|
||||
adc #GAMEOBJECTWIDTH/2 ; /2 is a fudge that makes crater location look better in this direction
|
||||
adc #GAMEOBJECTWIDTH/2+1 ; A fudge that makes crater location look better in this direction, and tunneling work better
|
||||
bra processTerrainStoreContinue
|
||||
|
||||
processTerrainImpactNegative:
|
||||
lda projectileData+GO_POSX,y
|
||||
clc
|
||||
adc #GAMEOBJECTWIDTH/4-1 ; A fudge that makes crater location look better in this direction, and tunneling work better
|
||||
|
||||
processTerrainStoreContinue:
|
||||
sta PARAML0
|
||||
lda projectileData+GO_POSY,y
|
||||
sec
|
||||
sbc #GAMEOBJECTHEIGHT
|
||||
sbc #GAMEOBJECTHEIGHT ; This fudge makes tunneling work better
|
||||
sta PARAML1
|
||||
|
||||
lda projectileData+JD_TYPE,y
|
||||
@ -907,9 +909,29 @@ processTerrainStoreContinue:
|
||||
|
||||
lda projectileTypes+PT_RADIUS,y
|
||||
tay
|
||||
phy ; We'll need the radius in a moment
|
||||
|
||||
jsr craterTerrain
|
||||
jsr compileTerrain
|
||||
|
||||
jsr unclipTerrain
|
||||
|
||||
; Recompile the rows affected by the crater
|
||||
clc
|
||||
lda PARAML1 ; Impact point is top row to recompile
|
||||
adc #GAMEOBJECTHEIGHT ; Expand recompile area upwards because of tunneling fudge
|
||||
tax
|
||||
|
||||
clc
|
||||
pla
|
||||
adc #GAMEOBJECTHEIGHT ; Expand "vertical" radius area because of tunneling fudge
|
||||
sta SCRATCHL ; Need radius in a memory location for this math
|
||||
txa
|
||||
sec
|
||||
sbc SCRATCHL
|
||||
tay
|
||||
lda SCRATCHL
|
||||
jsr compileTerrainChunk
|
||||
|
||||
jsr clipTerrain
|
||||
|
||||
rts
|
||||
|
41
terrain.s
41
terrain.s
@ -271,11 +271,50 @@ compileTerrainLoop:
|
||||
bra compileTerrainLoop
|
||||
|
||||
compileTerrainDone:
|
||||
;jsl compileTerrainSpans ; Part of the now disabled fill-mode renderer
|
||||
RESTORE_AY
|
||||
rts
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; compileTerrainChunk
|
||||
;
|
||||
; Y = First row to compile (bottom-relative)
|
||||
; X = Last row to compile (bottom-relative)
|
||||
; A = |X-Y|
|
||||
;
|
||||
; Trashes A,Y, SCRATCHL
|
||||
;
|
||||
compileTerrainChunk:
|
||||
;HARDBRK
|
||||
stx SCRATCHL
|
||||
sty PARAML0
|
||||
|
||||
; Compute the start of memory affected
|
||||
lda #COMPILEDTERRAINROW
|
||||
sta PARAML1
|
||||
jsr mult16
|
||||
clc
|
||||
adc #compiledTerrain
|
||||
sta PARAML0
|
||||
|
||||
compileTerrainChunkLoop:
|
||||
sty PARAML1
|
||||
;HARDBRK
|
||||
jsr compileTerrainRow
|
||||
iny
|
||||
cpy SCRATCHL
|
||||
beq compileTerrainChunkDone
|
||||
|
||||
clc
|
||||
lda #COMPILEDTERRAINROW
|
||||
adc PARAML0
|
||||
sta PARAML0
|
||||
bra compileTerrainChunkLoop
|
||||
|
||||
compileTerrainChunkDone:
|
||||
rts
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; compileTerrainRow
|
||||
;
|
||||
|
Loading…
x
Reference in New Issue
Block a user