mirror of
https://github.com/blondie7575/GSCats.git
synced 2024-11-21 15:33:11 +00:00
Fixed a nasty memory overwrite in terrain compiler
If a bomb landed just right near screen bottom, terrain chunk compiler would spray RAM with terrain data
This commit is contained in:
parent
c14a6fbc28
commit
f613e7460c
12
terrain.s
12
terrain.s
@ -120,6 +120,7 @@ craterTerrainLoop:
|
||||
sta craterTerrainAccumulator
|
||||
|
||||
lda SCRATCHL2 ; Replace terrain height with cratered value
|
||||
bmi craterTerrainZero ; Don't let it be negative
|
||||
sta (PARAML0),y
|
||||
bra craterTerrainLoop
|
||||
|
||||
@ -131,7 +132,6 @@ craterTerrainZero: ; Circle went negative so clip to 0
|
||||
craterTerrainDone:
|
||||
lda #1
|
||||
sta terrainDirty
|
||||
|
||||
RESTORE_AX
|
||||
rts
|
||||
|
||||
@ -288,12 +288,14 @@ compileTerrainDone:
|
||||
;
|
||||
; Y = First row to compile (bottom-relative)
|
||||
; X = Last row to compile (bottom-relative)
|
||||
; A = |X-Y|
|
||||
;
|
||||
; Trashes A,Y, SCRATCHL, PARAML0, PARAML1
|
||||
;
|
||||
compileTerrainChunk:
|
||||
;HARDBRK
|
||||
tya ; Be extra safe and make sure Y is never negative or we'll spray RAM with terrain data
|
||||
bmi compileTerrainChunkClampZero
|
||||
|
||||
compileTerrainChunkResume:
|
||||
stx SCRATCHL
|
||||
sty PARAML0
|
||||
|
||||
@ -322,6 +324,10 @@ compileTerrainChunkLoop:
|
||||
compileTerrainChunkDone:
|
||||
rts
|
||||
|
||||
compileTerrainChunkClampZero:
|
||||
ldy #0
|
||||
bra compileTerrainChunkResume
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; compileTerrainRow
|
||||
|
Loading…
Reference in New Issue
Block a user