mirror of
https://github.com/blondie7575/GSCats.git
synced 2024-11-28 00:51:14 +00:00
Fixed compiled terrain rendering
I thought it was working after the merging with fill mode, but it actually wasn’t. Should be now. Using only compiled rendering as of this commit.
This commit is contained in:
parent
d4077a7edc
commit
f599267718
@ -122,7 +122,6 @@ gameplayLoopRender:
|
|||||||
BORDER_COLOR #$3
|
BORDER_COLOR #$3
|
||||||
jsl renderTerrainSpans
|
jsl renderTerrainSpans
|
||||||
jsr renderTerrain
|
jsr renderTerrain
|
||||||
|
|
||||||
stz terrainDirty
|
stz terrainDirty
|
||||||
BORDER_COLOR #$1
|
BORDER_COLOR #$1
|
||||||
|
|
||||||
@ -337,7 +336,7 @@ fire:
|
|||||||
basePalette:
|
basePalette:
|
||||||
; Color 0 and 1 must both be sky blue. Compiled rendering uses PHD (which must contain $0000),
|
; Color 0 and 1 must both be sky blue. Compiled rendering uses PHD (which must contain $0000),
|
||||||
; and span rendering uses fill mode, so 0 can't be used there
|
; and span rendering uses fill mode, so 0 can't be used there
|
||||||
.word $0aef,$0aef,$0080,$0861,$0c93,$0eb4,$0d66,$0f9a,$0777,$0f00,$0bbb,$ddd,$007b,$0ff0,$0000,$0fff
|
.word $0aef,$0080,$0080,$0861,$0c93,$0eb4,$0d66,$0f9a,$0777,$0f00,$0bbb,$ddd,$007b,$0ff0,$0000,$0fff
|
||||||
statusBarPalette:
|
statusBarPalette:
|
||||||
.word $0888,$0aef,$0F00,$0861,$0c93,$0eb4,$0d66,$0f9a,$00f0,$0fff,$0bbb,$ddd,$007b,$0000,$0ff0,$0fff
|
.word $0888,$0aef,$0F00,$0861,$0c93,$0eb4,$0d66,$0f9a,$00f0,$0fff,$0bbb,$ddd,$007b,$0000,$0ff0,$0fff
|
||||||
|
|
||||||
|
BIN
gscats.2mg
BIN
gscats.2mg
Binary file not shown.
18
macros.s
18
macros.s
@ -206,6 +206,24 @@ nobrk:
|
|||||||
.endmacro
|
.endmacro
|
||||||
|
|
||||||
|
|
||||||
|
.macro DEADLOCK
|
||||||
|
deadlock: jmp deadlock
|
||||||
|
.endmacro
|
||||||
|
|
||||||
|
|
||||||
|
.macro BREAKLOCK
|
||||||
|
pha
|
||||||
|
lda breakpoint
|
||||||
|
beq nobrk
|
||||||
|
pla
|
||||||
|
deadlock: jmp deadlock
|
||||||
|
|
||||||
|
nobrk:
|
||||||
|
pla
|
||||||
|
.endmacro
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;
|
;;;;;;;;;;
|
||||||
; Stack Macros
|
; Stack Macros
|
||||||
|
|
||||||
|
34
terrain.s
34
terrain.s
@ -199,7 +199,7 @@ unclipTerrain:
|
|||||||
SAVE_AXY
|
SAVE_AXY
|
||||||
|
|
||||||
phd
|
phd
|
||||||
lda #(CLIPPEDTERRAINSTACK & $ff00)
|
lda #(CLIPPEDTERRAINSTACK & $f000)
|
||||||
pha
|
pha
|
||||||
pld ; Point direct page at our clip data
|
pld ; Point direct page at our clip data
|
||||||
|
|
||||||
@ -208,10 +208,14 @@ unclipTerrain:
|
|||||||
sbc mapScrollPos
|
sbc mapScrollPos
|
||||||
tay
|
tay
|
||||||
|
|
||||||
|
sec ; Find stopping point for stack-relative addressing
|
||||||
lda clippedTerrainStackPtr
|
lda clippedTerrainStackPtr
|
||||||
and #$00ff
|
and #$0fff
|
||||||
|
sbc #7 ; 4 bytes past top of stack, +3 for starting offset
|
||||||
|
sta STACKPTR
|
||||||
|
|
||||||
|
lda #$0fff-3 ; Start at the bottom of the stack
|
||||||
tax
|
tax
|
||||||
inx
|
|
||||||
|
|
||||||
unclipTerrainLoop:
|
unclipTerrainLoop:
|
||||||
lda 2,x
|
lda 2,x
|
||||||
@ -227,11 +231,11 @@ unclipTerrainLoop:
|
|||||||
sbc #COMPILEDTERRAINROW+2
|
sbc #COMPILEDTERRAINROW+2
|
||||||
tay
|
tay
|
||||||
|
|
||||||
inx
|
dex ; Walk up the stack to reverse the data
|
||||||
inx
|
dex
|
||||||
inx
|
dex
|
||||||
inx
|
dex
|
||||||
cpx #$100 ; When x hits the top of the stack, we're done
|
cpx STACKPT ; When x hits the top of the stack, we're done
|
||||||
bne unclipTerrainLoop
|
bne unclipTerrainLoop
|
||||||
|
|
||||||
pld
|
pld
|
||||||
@ -424,12 +428,12 @@ prepareRowRenderingLoop:
|
|||||||
lda playerData+GO_POSY,y
|
lda playerData+GO_POSY,y
|
||||||
sbc #GAMEOBJECTHEIGHT
|
sbc #GAMEOBJECTHEIGHT
|
||||||
|
|
||||||
cmp SCRATCHL2
|
; cmp SCRATCHL2
|
||||||
bcc prepareRowRenderingCompileMode
|
; bcc prepareRowRenderingCompileMode
|
||||||
beq prepareRowRenderingCompileMode
|
; beq prepareRowRenderingCompileMode
|
||||||
|
|
||||||
jsr enableFillMode
|
; jsr enableFillMode
|
||||||
bra prepareRowRenderingLoopNext
|
; bra prepareRowRenderingLoopNext
|
||||||
|
|
||||||
prepareRowRenderingCompileMode:
|
prepareRowRenderingCompileMode:
|
||||||
jsr disableFillMode
|
jsr disableFillMode
|
||||||
@ -441,6 +445,8 @@ prepareRowRenderingLoopNext:
|
|||||||
cpx #200-MAXTERRAINHEIGHT
|
cpx #200-MAXTERRAINHEIGHT
|
||||||
bne prepareRowRenderingLoop
|
bne prepareRowRenderingLoop
|
||||||
|
|
||||||
|
prepareRowRenderingDone:
|
||||||
|
;HARDBRK
|
||||||
RESTORE_AXY
|
RESTORE_AXY
|
||||||
rts
|
rts
|
||||||
|
|
||||||
@ -491,7 +497,7 @@ generateTerrainLoop:
|
|||||||
|
|
||||||
compiledTerrain:
|
compiledTerrain:
|
||||||
.repeat COMPILEDTERRAINROW * MAXTERRAINHEIGHT
|
.repeat COMPILEDTERRAINROW * MAXTERRAINHEIGHT
|
||||||
.byte $00
|
.byte $42
|
||||||
.endrepeat
|
.endrepeat
|
||||||
compiledTerrainEnd:
|
compiledTerrainEnd:
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ renderTerrainSpans:
|
|||||||
lda #MAXTERRAINHEIGHT-1
|
lda #MAXTERRAINHEIGHT-1
|
||||||
sec
|
sec
|
||||||
sbc lastCompiledTerrainY
|
sbc lastCompiledTerrainY
|
||||||
|
beq renderTerrainRowSpansSkip ; All terrain needs compiled rendering
|
||||||
|
|
||||||
renderTerrainSpansLoop:
|
renderTerrainSpansLoop:
|
||||||
sta PARAML1
|
sta PARAML1
|
||||||
@ -112,6 +113,8 @@ renderTerrainRowSpansDone:
|
|||||||
bne renderTerrainSpansLoop
|
bne renderTerrainSpansLoop
|
||||||
|
|
||||||
pea 0 ; Null-terminate the unrender cache
|
pea 0 ; Null-terminate the unrender cache
|
||||||
|
|
||||||
|
renderTerrainRowSpansSkip:
|
||||||
SLOWGRAPHICS
|
SLOWGRAPHICS
|
||||||
RESTORE_DBR
|
RESTORE_DBR
|
||||||
RESTORE_AXY
|
RESTORE_AXY
|
||||||
|
Loading…
Reference in New Issue
Block a user