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:
blondie7575 2018-07-24 18:43:41 -07:00
parent d4077a7edc
commit f599267718
5 changed files with 43 additions and 17 deletions

View File

@ -122,7 +122,6 @@ gameplayLoopRender:
BORDER_COLOR #$3
jsl renderTerrainSpans
jsr renderTerrain
stz terrainDirty
BORDER_COLOR #$1
@ -337,7 +336,7 @@ fire:
basePalette:
; 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
.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:
.word $0888,$0aef,$0F00,$0861,$0c93,$0eb4,$0d66,$0f9a,$00f0,$0fff,$0bbb,$ddd,$007b,$0000,$0ff0,$0fff

Binary file not shown.

View File

@ -206,6 +206,24 @@ nobrk:
.endmacro
.macro DEADLOCK
deadlock: jmp deadlock
.endmacro
.macro BREAKLOCK
pha
lda breakpoint
beq nobrk
pla
deadlock: jmp deadlock
nobrk:
pla
.endmacro
;;;;;;;;;;
; Stack Macros

View File

@ -199,7 +199,7 @@ unclipTerrain:
SAVE_AXY
phd
lda #(CLIPPEDTERRAINSTACK & $ff00)
lda #(CLIPPEDTERRAINSTACK & $f000)
pha
pld ; Point direct page at our clip data
@ -208,10 +208,14 @@ unclipTerrain:
sbc mapScrollPos
tay
sec ; Find stopping point for stack-relative addressing
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
inx
unclipTerrainLoop:
lda 2,x
@ -227,11 +231,11 @@ unclipTerrainLoop:
sbc #COMPILEDTERRAINROW+2
tay
inx
inx
inx
inx
cpx #$100 ; When x hits the top of the stack, we're done
dex ; Walk up the stack to reverse the data
dex
dex
dex
cpx STACKPT ; When x hits the top of the stack, we're done
bne unclipTerrainLoop
pld
@ -424,12 +428,12 @@ prepareRowRenderingLoop:
lda playerData+GO_POSY,y
sbc #GAMEOBJECTHEIGHT
cmp SCRATCHL2
bcc prepareRowRenderingCompileMode
beq prepareRowRenderingCompileMode
; cmp SCRATCHL2
; bcc prepareRowRenderingCompileMode
; beq prepareRowRenderingCompileMode
jsr enableFillMode
bra prepareRowRenderingLoopNext
; jsr enableFillMode
; bra prepareRowRenderingLoopNext
prepareRowRenderingCompileMode:
jsr disableFillMode
@ -441,6 +445,8 @@ prepareRowRenderingLoopNext:
cpx #200-MAXTERRAINHEIGHT
bne prepareRowRenderingLoop
prepareRowRenderingDone:
;HARDBRK
RESTORE_AXY
rts
@ -491,7 +497,7 @@ generateTerrainLoop:
compiledTerrain:
.repeat COMPILEDTERRAINROW * MAXTERRAINHEIGHT
.byte $00
.byte $42
.endrepeat
compiledTerrainEnd:

View File

@ -31,6 +31,7 @@ renderTerrainSpans:
lda #MAXTERRAINHEIGHT-1
sec
sbc lastCompiledTerrainY
beq renderTerrainRowSpansSkip ; All terrain needs compiled rendering
renderTerrainSpansLoop:
sta PARAML1
@ -112,6 +113,8 @@ renderTerrainRowSpansDone:
bne renderTerrainSpansLoop
pea 0 ; Null-terminate the unrender cache
renderTerrainRowSpansSkip:
SLOWGRAPHICS
RESTORE_DBR
RESTORE_AXY