Implement unlocking levels [Commit 3/3] (#35)

This commit is contained in:
xCrystal 2024-01-21 12:26:13 +01:00
parent 4172760b6d
commit 008d796321

View File

@ -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"