Merged compile/span rendering working

This commit is contained in:
blondie7575 2018-01-18 18:15:42 -08:00
parent 4a8abaa1b4
commit f0631386b1
5 changed files with 22 additions and 15 deletions

View File

@ -32,6 +32,8 @@ leftScreenEdge = $6E ; Reserved for leftScreenEdge (This is almost certainly m
STACKPTR = $70 ; Cache for stack pointer in fast graphics
SHADOWREGISTER = $72 ; Cache for shadow register in fast graphics
STACKREGISTER = $73 ; Cache for stack register in fast graphics
lastCompiledTerrainY = $75 ; The highest Y value that the compiled renderer must handle
; Terrain constants

View File

@ -30,12 +30,8 @@ beginGameplay:
stz leftScreenEdge
jsr generateTerrain
jsr compileTerrain
; jsr clipTerrain
jsl renderTerrainSpans
; Create players
lda #56
lda #106;#56
ldy #0
jsr playerCreate
@ -50,18 +46,20 @@ beginGameplay:
jsr protectProjectiles
jsr prepareRowRendering
jsr compileTerrain
jsr clipTerrain
gameplayLoop:
jsr syncVBL
BORDER_COLOR #$0
; Render the terrain if needed
; lda terrainDirty
; beq gameplayLoopKbd
lda terrainDirty
beq gameplayLoopKbd
BORDER_COLOR #$3
jsl unrenderTerrainSpans
jsl renderTerrainSpans
; jsr renderTerrain
jsr renderTerrain
stz terrainDirty
BORDER_COLOR #$1
@ -229,8 +227,8 @@ endGame:
; A = New map scroll position
;
scrollMap:
; jsr unclipTerrain
; jsl unrenderTerrainSpans
jsr unclipTerrain
jsl unrenderTerrainSpans
jsr unrenderPlayers
jsr unrenderProjectiles
@ -241,7 +239,7 @@ scrollMap:
adc #160-GAMEOBJECTWIDTH/4-1
sta rightScreenEdge
; jsr clipTerrain
jsr clipTerrain
lda #$ffff
sta mapScrollRequested

Binary file not shown.

View File

@ -16,7 +16,7 @@ renderTerrain:
FASTGRAPHICS
lda #0
sta SCRATCHL2 ; Row counter
lda #$5f1f ; 4 Point stack to end of VRAM
lda #$5f1f ; 4 Point stack to end of affected VRAM
tcs ; 2
sec
@ -44,8 +44,11 @@ renderRowComplete:
lda SCRATCHL2
inc
cmp #MAXTERRAINHEIGHT
beq renderTerrainDone
cmp lastCompiledTerrainY
beq renderRowCont
bcs renderTerrainDone
renderRowCont:
sta SCRATCHL2
bra renderTerrainLoop
@ -387,6 +390,7 @@ prepareRowRendering:
ldx #199
stz SCRATCHL2
stz lastCompiledTerrainY
prepareRowRenderingLoop:
lda #0
@ -404,6 +408,7 @@ prepareRowRenderingLoop:
prepareRowRenderingCompileMode:
jsr disableFillMode
inc lastCompiledTerrainY
prepareRowRenderingLoopNext:
inc SCRATCHL2

View File

@ -29,6 +29,8 @@ renderTerrainSpans:
tcs
lda #MAXTERRAINHEIGHT-1
sec
sbc lastCompiledTerrainY
renderTerrainSpansLoop:
sta PARAML1