Skip to content

Commit c4537c7

Browse files
committed
fix: don't let a despawned final-battle guardian consume its wave
CellWatch counts a final-battle wave as spent when the guardian spawns, and stops spawning entirely once wFinal reaches 3. If that guardian despawns without sinking — wrecking teleports the player beyond the 120 px despawn range — no wave ever spawns again and the game becomes unwinnable. Give the wave back on despawn. Found by a full end-to-end campaign playthrough: wrecked during the finale, and the victory state could no longer be reached.
1 parent a9f774d commit c4537c7

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/combat.asm

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,19 @@ UpdateEnemy:
695695
ld [wEnemyActive], a
696696
ld [wBallEActive], a
697697
ld [wShadowOAM + 4], a
698+
; a despawned final-battle guardian must not consume its wave (e.g.
699+
; the player wrecked and respawned far away): hand it back so
700+
; CellWatch spawns it again — otherwise the finale can never be won.
701+
ld a, [wIsGuardian]
702+
and a
703+
ret z
704+
ld a, [wFinal]
705+
and a
706+
ret z
707+
cp 4
708+
ret z
709+
dec a
710+
ld [wFinal], a
698711
ret
699712

700713
; helper: hl += sign-extend(a). clobbers a, h, l

0 commit comments

Comments
 (0)