mirror of
https://github.com/blondie7575/GSCats.git
synced 2024-11-22 06:31:48 +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
|
sta craterTerrainAccumulator
|
||||||
|
|
||||||
lda SCRATCHL2 ; Replace terrain height with cratered value
|
lda SCRATCHL2 ; Replace terrain height with cratered value
|
||||||
|
bmi craterTerrainZero ; Don't let it be negative
|
||||||
sta (PARAML0),y
|
sta (PARAML0),y
|
||||||
bra craterTerrainLoop
|
bra craterTerrainLoop
|
||||||
|
|
||||||
@ -131,7 +132,6 @@ craterTerrainZero: ; Circle went negative so clip to 0
|
|||||||
craterTerrainDone:
|
craterTerrainDone:
|
||||||
lda #1
|
lda #1
|
||||||
sta terrainDirty
|
sta terrainDirty
|
||||||
|
|
||||||
RESTORE_AX
|
RESTORE_AX
|
||||||
rts
|
rts
|
||||||
|
|
||||||
@ -288,12 +288,14 @@ compileTerrainDone:
|
|||||||
;
|
;
|
||||||
; Y = First row to compile (bottom-relative)
|
; Y = First row to compile (bottom-relative)
|
||||||
; X = Last row to compile (bottom-relative)
|
; X = Last row to compile (bottom-relative)
|
||||||
; A = |X-Y|
|
|
||||||
;
|
;
|
||||||
; Trashes A,Y, SCRATCHL, PARAML0, PARAML1
|
; Trashes A,Y, SCRATCHL, PARAML0, PARAML1
|
||||||
;
|
;
|
||||||
compileTerrainChunk:
|
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
|
stx SCRATCHL
|
||||||
sty PARAML0
|
sty PARAML0
|
||||||
|
|
||||||
@ -322,6 +324,10 @@ compileTerrainChunkLoop:
|
|||||||
compileTerrainChunkDone:
|
compileTerrainChunkDone:
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
compileTerrainChunkClampZero:
|
||||||
|
ldy #0
|
||||||
|
bra compileTerrainChunkResume
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
; compileTerrainRow
|
; compileTerrainRow
|
||||||
|
Loading…
Reference in New Issue
Block a user