mirror of
https://github.com/blondie7575/GSCats.git
synced 2025-01-02 02:29:50 +00:00
Better clamping for terrain chunk compiling
This commit is contained in:
parent
49c1b08cb0
commit
92a3a9040e
@ -939,7 +939,7 @@ processTerrainImpactStoreContinue:
|
||||
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
|
||||
|
21
terrain.s
21
terrain.s
@ -295,12 +295,19 @@ compileTerrainDone:
|
||||
; 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
|
||||
|
||||
; Clamp chunk to left and right terrain edges
|
||||
lda compileTerrainRowStart
|
||||
bmi compileTerrainChunkClampZero
|
||||
ldx #MAXTERRAINHEIGHT-1
|
||||
|
||||
compileTerrainChunkClampResume:
|
||||
lda compileTerrainRowEnd
|
||||
cmp #TERRAINWIDTH
|
||||
bcs compileTerrainChunkClampHigh
|
||||
|
||||
compileTerrainChunkResume:
|
||||
ldy #0
|
||||
ldx #MAXTERRAINHEIGHT-1
|
||||
stx SCRATCHL
|
||||
sty PARAML0
|
||||
|
||||
@ -329,9 +336,13 @@ compileTerrainChunkDone:
|
||||
rts
|
||||
|
||||
compileTerrainChunkClampZero:
|
||||
ldy #0
|
||||
bra compileTerrainChunkResume
|
||||
stz compileTerrainRowStart
|
||||
bra compileTerrainChunkClampResume
|
||||
|
||||
compileTerrainChunkClampHigh:
|
||||
lda #TERRAINWIDTH-1
|
||||
sta compileTerrainRowEnd
|
||||
bra compileTerrainChunkResume
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; compileTerrainRow
|
||||
|
Loading…
Reference in New Issue
Block a user