diff --git a/engine/menus/cleared_level_screen.asm b/engine/menus/cleared_level_screen.asm index 18fcb1b1f..3fb72871c 100755 --- a/engine/menus/cleared_level_screen.asm +++ b/engine/menus/cleared_level_screen.asm @@ -76,6 +76,10 @@ ClearLevel: ret UnlockLevels: + call ComputeLevelsToUnlock + jp SaveUnlockedLevels + +ComputeLevelsToUnlock: ld hl, LevelUnlockRequirements ld de, wUnlockedLevels - 1 ld b, 0 @@ -203,4 +207,17 @@ GetClearedLevelsStageAddress: ld hl, wClearedLevelsStage4 ret +SaveUnlockedLevels: + ld hl, wTempUnlockedLevels +.loop + ld a, [hli] + ld e, a + inc a ; cp $ff + ret z + push hl + ld b, SET_FLAG + call UnlockedLevelsFlagAction + pop hl + jr .loop + INCLUDE "data/levels/levels.asm"