Fixed crosshair rendering glitches on turn switch

This commit is contained in:
blondie7575 2023-12-24 12:16:27 -07:00
parent 11b2cc9048
commit c2dde9a4b7
3 changed files with 22 additions and 11 deletions

View File

@ -14,6 +14,9 @@ crosshairGameObject:
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
crosshairBackgroundStale:
.word 0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; updateCrosshair
@ -115,6 +118,8 @@ protectCrosshair:
sta PARAML0
jsr protectGameObject
stz crosshairBackgroundStale
protectCrosshairDone:
pla
rts
@ -128,6 +133,9 @@ protectCrosshairDone:
unrenderCrosshair:
pha
lda crosshairBackgroundStale
bne unrenderCrosshairDone
lda #crosshairGameObject
sta PARAML0
jsr unrenderGameObject

View File

@ -44,6 +44,8 @@ beginGameplay:
jsr renderInventory
jsr protectPlayers
jsr renderPlayers
ldy #0
jsr updateCrosshair
; Fade in from menu
lda #basePalette
@ -95,6 +97,7 @@ gameplayLoopScroll:
bmi gameplayLoopAngleCheck
jsr scrollMap
ldy currentPlayer
jsr updateCrosshair
gameplayLoopAngleCheck:
@ -107,7 +110,7 @@ gameplayLoopRenderJmp:
gameplayLoopAngle:
; Update aim angle if needed
lda angleDeltaRequested
beq gameplayLoopAim
beq gameplayLoopPower
jsr changeAngle
gameplayLoopAim:
@ -155,8 +158,11 @@ gameplayLoopRender:
beq gameplayLoopRenderPlayersAnyway
jsr unrenderPlayers
jsr protectPlayers
jsr unrenderCrosshair
lda dirtExplosionActive ; Crosshair is dirty if map scrolled and dirt is finished
bne gameplayLoopRenderPlayersAnyway
jsr protectCrosshair
jsr renderCrosshair
gameplayLoopRenderPlayersAnyway:
jsr renderPlayers
@ -297,8 +303,6 @@ endTurnHeader:
jsr renderPlayerHeader
jsr renderInventory
stz turnRequested
jsr protectCrosshair
rts
endTurnFocusPlayer0:
@ -338,6 +342,8 @@ scrollMap:
lda projectileActive ; Crosshair is visible if projectile isn't
beq scrollMapApplyScrolling
jsr unrenderCrosshair
lda #1
sta crosshairBackgroundStale
scrollMapApplyScrolling:
pla
@ -358,7 +364,6 @@ scrollMapApplyScrolling:
sta playersDirty
sta projectilesDirty
sta terrainDirty
sta crosshairDirty
rts
@ -486,9 +491,7 @@ playerMoveRequested:
terrainDirty:
.word 1
playersDirty:
.word 0
crosshairDirty:
.word 0
.word 1
projectilesDirty:
.word 1
inventoryDirty:

View File

@ -180,8 +180,8 @@
pha
lda breakpoint
beq nobrk
lda #1
sta $e1c029
; lda #1
; sta $e1c029
pla
brk
nobrk: