mirror of
https://github.com/blondie7575/GSCats.git
synced 2025-02-20 06:28:58 +00:00
Terrain chunk compiler now rectangular!
This greatly speeds it up and allows vertical slice compiling to eliminate most false terrain overhangs
This commit is contained in:
parent
826660643c
commit
fad2daa4d7
2
gscats.s
2
gscats.s
@ -25,8 +25,6 @@ mainBank2:
|
|||||||
jmp titleScreen
|
jmp titleScreen
|
||||||
|
|
||||||
quitGame:
|
quitGame:
|
||||||
jsr unsetVBLInterruptVector
|
|
||||||
jsr unsetScanLineInterruptVector
|
|
||||||
NORMALMEMORY
|
NORMALMEMORY
|
||||||
CLASSICVIDEO
|
CLASSICVIDEO
|
||||||
jml (PRODOSRETURN)
|
jml (PRODOSRETURN)
|
||||||
|
@ -913,6 +913,10 @@ processTerrainImpactNegative:
|
|||||||
processTerrainImpactStoreContinue:
|
processTerrainImpactStoreContinue:
|
||||||
sta PARAML0
|
sta PARAML0
|
||||||
pha ; Dirt explosion will need this
|
pha ; Dirt explosion will need this
|
||||||
|
sta compileTerrainRowStart ; Terrain chunk compiler will need this
|
||||||
|
lda #TERRAINWIDTH
|
||||||
|
sta compileTerrainRowEnd
|
||||||
|
|
||||||
lda projectileData+GO_POSY,y
|
lda projectileData+GO_POSY,y
|
||||||
sec
|
sec
|
||||||
sbc #GAMEOBJECTHEIGHT ; This fudge makes tunneling work better
|
sbc #GAMEOBJECTHEIGHT ; This fudge makes tunneling work better
|
||||||
@ -943,9 +947,9 @@ processTerrainImpactStoreContinue:
|
|||||||
sta SCRATCHL ; Need radius in a memory location for this math
|
sta SCRATCHL ; Need radius in a memory location for this math
|
||||||
txa
|
txa
|
||||||
sec
|
sec
|
||||||
|
sbc SCRATCHL ; Need to subtract diameter to ensure enough terrain is recompiled. Not 100% sure why?
|
||||||
sbc SCRATCHL
|
sbc SCRATCHL
|
||||||
tay
|
tay
|
||||||
lda SCRATCHL
|
|
||||||
jsr compileTerrainChunk
|
jsr compileTerrainChunk
|
||||||
|
|
||||||
jsr clipTerrain
|
jsr clipTerrain
|
||||||
|
41
terrain.s
41
terrain.s
@ -263,6 +263,9 @@ compileTerrain:
|
|||||||
ldy #0
|
ldy #0
|
||||||
lda #compiledTerrain
|
lda #compiledTerrain
|
||||||
sta PARAML0
|
sta PARAML0
|
||||||
|
stz compileTerrainRowStart
|
||||||
|
lda #TERRAINWIDTH
|
||||||
|
sta compileTerrainRowEnd
|
||||||
|
|
||||||
compileTerrainLoop:
|
compileTerrainLoop:
|
||||||
sty PARAML1
|
sty PARAML1
|
||||||
@ -288,15 +291,15 @@ 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)
|
||||||
|
; compileTerrainRowStart = Start column to compile (logical terrainData index)
|
||||||
|
; compileTerrainRowEnd = Ending column to compile (logical terrainData index)
|
||||||
;
|
;
|
||||||
; Trashes A,Y, SCRATCHL, PARAML0, PARAML1
|
; Trashes A,Y, SCRATCHL, PARAML0, PARAML1
|
||||||
;
|
;
|
||||||
compileTerrainChunk:
|
compileTerrainChunk:
|
||||||
tya ; Be extra safe and make sure Y is never negative or we'll spray RAM with terrain data
|
tya ; Be extra safe and make sure Y is never negative or we'll spray RAM with terrain data
|
||||||
bmi compileTerrainChunkClampZero
|
bmi compileTerrainChunkClampZero
|
||||||
cpx #MAXTERRAINHEIGHT ; Same caution for top of terrain
|
ldx #MAXTERRAINHEIGHT-1
|
||||||
beq compileTerrainChunkResume
|
|
||||||
bcs compileTerrainChunkClampTop
|
|
||||||
|
|
||||||
compileTerrainChunkResume:
|
compileTerrainChunkResume:
|
||||||
stx SCRATCHL
|
stx SCRATCHL
|
||||||
@ -330,15 +333,14 @@ compileTerrainChunkClampZero:
|
|||||||
ldy #0
|
ldy #0
|
||||||
bra compileTerrainChunkResume
|
bra compileTerrainChunkResume
|
||||||
|
|
||||||
compileTerrainChunkClampTop:
|
|
||||||
ldx #MAXTERRAINHEIGHT
|
|
||||||
bra compileTerrainChunkResume
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
; compileTerrainRow
|
; compileTerrainRow
|
||||||
;
|
;
|
||||||
; PARAML0 = Start of compiled row data
|
; PARAML0 = Start of compiled row data
|
||||||
; PARAML1 = Row index
|
; PARAML1 = Row index
|
||||||
|
; compileTerrainRowStart = Start column to compile (logical terrainData index)
|
||||||
|
; compileTerrainRowEnd = Ending column to compile (logical terrainData index)
|
||||||
;
|
;
|
||||||
; Note: DA = PHX = FG/FG
|
; Note: DA = PHX = FG/FG
|
||||||
; 48 = PHA = FG/BG
|
; 48 = PHA = FG/BG
|
||||||
@ -347,8 +349,20 @@ compileTerrainChunkClampTop:
|
|||||||
|
|
||||||
compileTerrainRow:
|
compileTerrainRow:
|
||||||
SAVE_AXY
|
SAVE_AXY
|
||||||
ldy #0
|
lda compileTerrainRowStart ; Initialize horizontal counters
|
||||||
ldx #0
|
lsr
|
||||||
|
lsr
|
||||||
|
and #%11111100 ; Word-align it
|
||||||
|
tay
|
||||||
|
asl ; Logical counter is 4x compiled counter
|
||||||
|
asl
|
||||||
|
tax
|
||||||
|
|
||||||
|
lda compileTerrainRowEnd ; Convert end counter to compiled version
|
||||||
|
lsr
|
||||||
|
lsr
|
||||||
|
and #%11111100
|
||||||
|
sta compileTerrainRowEndCompiled
|
||||||
|
|
||||||
compileTerrainColumnLoop:
|
compileTerrainColumnLoop:
|
||||||
stz compileTerrainOpcode
|
stz compileTerrainOpcode
|
||||||
@ -399,7 +413,7 @@ compileTerrainColumnStore:
|
|||||||
inx
|
inx
|
||||||
iny
|
iny
|
||||||
iny
|
iny
|
||||||
cpy #VISIBLETERRAINWIDTH
|
cpy compileTerrainRowEndCompiled
|
||||||
bne compileTerrainColumnLoop
|
bne compileTerrainColumnLoop
|
||||||
|
|
||||||
RESTORE_AXY
|
RESTORE_AXY
|
||||||
@ -462,8 +476,12 @@ compileTerrainColumn3BG:
|
|||||||
|
|
||||||
compileTerrainOpcode:
|
compileTerrainOpcode:
|
||||||
.word 0
|
.word 0
|
||||||
|
compileTerrainRowStart:
|
||||||
|
.word 0
|
||||||
|
compileTerrainRowEnd:
|
||||||
|
.word 640
|
||||||
|
compileTerrainRowEndCompiled:
|
||||||
|
.word 0
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
; prepareRowRendering:
|
; prepareRowRendering:
|
||||||
@ -504,7 +522,6 @@ prepareRowRenderingLoopNext:
|
|||||||
bne prepareRowRenderingLoop
|
bne prepareRowRenderingLoop
|
||||||
|
|
||||||
prepareRowRenderingDone:
|
prepareRowRenderingDone:
|
||||||
;HARDBRK
|
|
||||||
RESTORE_AXY
|
RESTORE_AXY
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
@ -187,6 +187,8 @@ titleScreenMainLoopEndFrame:
|
|||||||
|
|
||||||
titleScreenBeginGame:
|
titleScreenBeginGame:
|
||||||
; Transition to gameplay
|
; Transition to gameplay
|
||||||
|
jsr unsetVBLInterruptVector
|
||||||
|
jsr unsetScanLineInterruptVector
|
||||||
stz menuActionRequested
|
stz menuActionRequested
|
||||||
lda #skyPalette
|
lda #skyPalette
|
||||||
sta PARAML2
|
sta PARAML2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user