mirror of
https://github.com/blondie7575/GSCats.git
synced 2024-05-28 15:41:28 +00:00
Added crater clipping to terrain edges
This commit is contained in:
parent
3a5f8594f2
commit
5d04f335e0
|
@ -22,21 +22,6 @@ beginGameplay:
|
|||
|
||||
; Generate, compile, and clip terrain
|
||||
jsr generateTerrain
|
||||
|
||||
; lda #40
|
||||
; sta PARAML0
|
||||
; lda #30
|
||||
; sta PARAML1
|
||||
; ldy #12
|
||||
; jsr craterTerrain
|
||||
|
||||
; lda #74
|
||||
; sta PARAML0
|
||||
; lda #30
|
||||
; sta PARAML1
|
||||
; ldy #16
|
||||
; jsr craterTerrain
|
||||
|
||||
jsr compileTerrain
|
||||
jsr clipTerrain
|
||||
|
||||
|
|
BIN
gscats.2mg
BIN
gscats.2mg
Binary file not shown.
|
@ -30,7 +30,7 @@ GRAVITY = $ffff ; 8.8 fixed point
|
|||
|
||||
projectileTypes: ; Byte offsets into projectile type data structure
|
||||
.word 50 ; Damage
|
||||
.word 12 ; Crater radius
|
||||
.word 40 ; Crater radius
|
||||
.word 0,0 ; Padding
|
||||
|
||||
PT_DAMAGE = 0
|
||||
|
|
16
terrain.s
16
terrain.s
|
@ -66,7 +66,6 @@ craterTerrain:
|
|||
sbc PARAML0
|
||||
sty SCRATCHL ; Center width in bytes
|
||||
sbc SCRATCHL
|
||||
; sbc SCRATCHL
|
||||
and #$fffe ; Force even
|
||||
clc
|
||||
adc #terrainData
|
||||
|
@ -84,9 +83,18 @@ craterTerrainLoop:
|
|||
dey
|
||||
bmi craterTerrainDone
|
||||
|
||||
tya
|
||||
clc
|
||||
adc PARAML0 ; Clip to terrain edges
|
||||
cmp #terrainData
|
||||
bmi craterTerrainDone
|
||||
cmp #terrainDataEnd
|
||||
bpl craterTerrainLoop
|
||||
|
||||
lda (SCRATCHL),y ; Fetch circle Y value
|
||||
clc
|
||||
adc PARAML1 ; Convert to terrain-space
|
||||
bmi craterTerrainZero
|
||||
sta SCRATCHL2
|
||||
lda (PARAML0),y
|
||||
cmp SCRATCHL2
|
||||
|
@ -96,6 +104,11 @@ craterTerrainLoop:
|
|||
sta (PARAML0),y
|
||||
bra craterTerrainLoop
|
||||
|
||||
craterTerrainZero: ; Circle went negative so clip to 0
|
||||
lda #0
|
||||
sta (PARAML0),y
|
||||
bra craterTerrainLoop
|
||||
|
||||
craterTerrainDone:
|
||||
lda #1
|
||||
sta terrainDirty
|
||||
|
@ -408,6 +421,7 @@ terrainData:
|
|||
.repeat TERRAINWIDTH/2
|
||||
.word 0
|
||||
.endrepeat
|
||||
terrainDataEnd:
|
||||
|
||||
compiledTerrain:
|
||||
.repeat COMPILEDTERRAINROW * MAXTERRAINHEIGHT
|
||||
|
|
Loading…
Reference in New Issue
Block a user