From 4bd719b6ec8ffeb2f4acebfac115482055f9b22d Mon Sep 17 00:00:00 2001 From: Marc Bradshaw Date: Tue, 30 Jan 2024 21:24:38 +1100 Subject: [PATCH] Reset the level counter when player wins There was a bug where if the player ran the game after winning the level counter was pointing past the level data into game code resulting in weird blank levels and eventually trying to play the title screen and crashing. --- src/levels.inc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/levels.inc b/src/levels.inc index 2ad4de7..635d6c0 100755 --- a/src/levels.inc +++ b/src/levels.inc @@ -29,7 +29,7 @@ check_next: ;; Check maximum level ld (current_level), a cp MAX_LEVEL - jp z, final + jp z, final_level call win_snd call slide_off @@ -53,8 +53,11 @@ load_level: call draw_buffer call draw_ui ret - +final_level: + ld a, 0 + ld (current_level), a + jp final level1: incbin "levels/level1"