mirror of
https://github.com/blondie7575/GSCats.git
synced 2025-02-21 12:29:09 +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
|
; processTerrainImpact
|
||||||
;
|
;
|
||||||
; Trashes A,Y
|
; Trashes A,Y, SCRATCHL
|
||||||
;
|
;
|
||||||
processTerrainImpact:
|
processTerrainImpact:
|
||||||
ldy projectileActive
|
ldy projectileActive
|
||||||
@ -888,17 +888,19 @@ processTerrainImpact:
|
|||||||
|
|
||||||
lda projectileData+GO_POSX,y
|
lda projectileData+GO_POSX,y
|
||||||
clc
|
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
|
bra processTerrainStoreContinue
|
||||||
|
|
||||||
processTerrainImpactNegative:
|
processTerrainImpactNegative:
|
||||||
lda projectileData+GO_POSX,y
|
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:
|
processTerrainStoreContinue:
|
||||||
sta PARAML0
|
sta PARAML0
|
||||||
lda projectileData+GO_POSY,y
|
lda projectileData+GO_POSY,y
|
||||||
sec
|
sec
|
||||||
sbc #GAMEOBJECTHEIGHT
|
sbc #GAMEOBJECTHEIGHT ; This fudge makes tunneling work better
|
||||||
sta PARAML1
|
sta PARAML1
|
||||||
|
|
||||||
lda projectileData+JD_TYPE,y
|
lda projectileData+JD_TYPE,y
|
||||||
@ -907,9 +909,29 @@ processTerrainStoreContinue:
|
|||||||
|
|
||||||
lda projectileTypes+PT_RADIUS,y
|
lda projectileTypes+PT_RADIUS,y
|
||||||
tay
|
tay
|
||||||
|
phy ; We'll need the radius in a moment
|
||||||
|
|
||||||
jsr craterTerrain
|
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
|
jsr clipTerrain
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
41
terrain.s
41
terrain.s
@ -271,11 +271,50 @@ compileTerrainLoop:
|
|||||||
bra compileTerrainLoop
|
bra compileTerrainLoop
|
||||||
|
|
||||||
compileTerrainDone:
|
compileTerrainDone:
|
||||||
;jsl compileTerrainSpans ; Part of the now disabled fill-mode renderer
|
|
||||||
RESTORE_AY
|
RESTORE_AY
|
||||||
rts
|
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
|
; compileTerrainRow
|
||||||
;
|
;
|
||||||
|
@ -106,7 +106,8 @@ intToStringResult: .byte 0,0,0,0,0,0
|
|||||||
; PARAML1 = Operand 2 (16 bits)
|
; PARAML1 = Operand 2 (16 bits)
|
||||||
; A => Op1 * Op2 (16 bits)
|
; A => Op1 * Op2 (16 bits)
|
||||||
; Algorithm from https://apple2.gs/downloads/Programmanual.pdf
|
; Algorithm from https://apple2.gs/downloads/Programmanual.pdf
|
||||||
; Trashes X
|
;
|
||||||
|
; Trashes X,PARAML0,PARAML1
|
||||||
;
|
;
|
||||||
mult16:
|
mult16:
|
||||||
lda #0 ; Initialize result
|
lda #0 ; Initialize result
|
||||||
|
Loading…
x
Reference in New Issue
Block a user