more robust pathway rendering/clearing

This commit is contained in:
alpine9000
2016-05-12 13:56:21 +10:00
parent 6a2ffb1b4f
commit 08145cfb48
2 changed files with 30 additions and 10 deletions
+28 -9
View File
@@ -6,7 +6,7 @@
xdef RenderCounter
xdef pathwayRenderPending
xdef pathwayXIndex
xdef pathwayPlayerTileAddress
xdef pathwayFadeCount
xdef pathwayClearPending
xdef InstallTilePalette
@@ -25,7 +25,8 @@
xdef foregroundOffscreen
xdef foregroundScrollX
xdef foregroundBitplanes1
xdef foregroundPlayerTileAddress
xdef foregroundMapPtr
xdef pathwayMapPtr
xdef startForegroundMapPtr
@@ -459,15 +460,25 @@ RenderNextForegroundFrame:
rts
RenderPathway:
move.w pathwayXIndex,d5 ; x index
move.l pathwayPlayerTileAddress,d5
andi.w #$fff0,d5 ; point the address to the last tile of the previous column
addq #2,d5 ;
move.l d5,a4
move.w #1,d5
.loopX:
move.w #6,d6 ; y index
move.w #0,d7 ; number of rows without a pathway
.loopY:
move.l pathwayMapPtr,a2
bsr GetMapTile
cmp.l a4,a2 ; search for the start column
ble .next
cmp.l pathwayPlayerTileAddress,a2
beq .next
move.l d0,a2
move.w (a2),d0
cmp.w #0,d0
beq .dontBlit
@@ -491,8 +502,6 @@ RenderPathway:
jsr BlitTile
bra .next
.dontBlit:
cmp.w pathwayXIndex,d5 ; skip the start column
beq .next
add.w #1,d7
cmp.w #7,d7
beq .skip
@@ -511,12 +520,16 @@ RenderPathway:
ClearPathway:
sub.w #1,pathwayClearPending
move.w pathwayXIndex,d5 ; x index
move.l foregroundPlayerTileAddress,d7
andi.w #$fff0,d7 ; address of the last tile in the previous column
move.w #0,d5 ; x index
.loopX:
move.w #6,d6 ; y index
.loopY:
move.l foregroundMapPtr,a2 ;; todo: this will be too slow, it will render too many tiles
bsr GetMapTile
cmp.l d7,a2 ; finished clearing...
bgt .done
move.l d0,a2
move.w (a2),d0
@@ -550,7 +563,10 @@ ClearPathway:
.dontBlit:
.next:
dbra d6,.loopY
dbra d5,.loopX
add.w #1,d5
bra .loopX
;; dbra d5,.loopX
.done
rts
@@ -1458,10 +1474,13 @@ movingCounter:
dc.w 0
moving:
dc.w 0
foregroundPlayerTileAddress:
dc.l 0
pathwayRenderPending:
dc.w 0
pathwayXIndex
dc.w 0
pathwayPlayerTileAddress:
dc.l 0
pathwayClearPending:
dc.w 0
pathwayFadeCount:
+2 -1
View File
@@ -306,7 +306,6 @@ CheckPlayerMiss:
blt .doBigBang
sub.w #PLAYER_LEFT_X,d0
lsr.w #4,d0 ; x columns
move.w d0,pathwayXIndex
move.l #(FOREGROUND_PLAYAREA_WIDTH_WORDS/2)-1,d1
sub.w d0,d1
@@ -327,6 +326,7 @@ CheckPlayerMiss:
add.l d1,a3
;; a2 now points at the pathway tile under the sprite
move.l a2,pathwayPlayerTileAddress
move.w (a2),d0
move.w d0,spriteCurrentPathwayTile
bsr CheckDirection
@@ -335,6 +335,7 @@ CheckPlayerMiss:
bge .noBigBang
;; a3 now points at the tile under the sprite
move.l a3,foregroundPlayerTileAddress
move.w (a3),d0
cmp.w #FOREGROUND_TILE_EMPTY,d0 ; empty tile