You've already forked pokecrystal-board
mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-04-09 05:44:44 -07:00
@@ -31,10 +31,6 @@ ClearedLevelScreen:
|
||||
.exit
|
||||
call AddLevelCoinsToBalance
|
||||
call ClearLevel
|
||||
xor a
|
||||
ld [wNumTempUnlockedLevels], a
|
||||
ld a, $ff
|
||||
ld [wTempUnlockedLevels], a
|
||||
jp UnlockLevels
|
||||
|
||||
.LevelCleared1Text:
|
||||
@@ -92,7 +88,10 @@ ComputeLevelsToUnlock:
|
||||
inc b
|
||||
ld a, b
|
||||
cp NUM_LEVELS
|
||||
jr z, .done
|
||||
jr z, .done ; done if went through all existing levels
|
||||
ld a, [wLastUnlockedLevelsCount]
|
||||
cp MAX_UNLOCK_LEVELS_AT_ONCE
|
||||
jr nc, .done ; done if reached the capacity of wLastUnlockedLevels
|
||||
; advance hl to next level in LevelUnlockRequirements
|
||||
.loop
|
||||
ld a, [hli]
|
||||
@@ -169,19 +168,19 @@ ComputeLevelsToUnlock:
|
||||
jr .check_techniques_cleared_loop
|
||||
|
||||
.reqs_met
|
||||
; add level to wTempUnlockedLevels
|
||||
; add level to wLastUnlockedLevels
|
||||
pop bc ; b = which level
|
||||
push hl
|
||||
ld a, [wNumTempUnlockedLevels]
|
||||
ld a, [wLastUnlockedLevelsCount]
|
||||
ld e, a
|
||||
ld d, 0
|
||||
ld hl, wTempUnlockedLevels
|
||||
ld hl, wLastUnlockedLevels
|
||||
add hl, de
|
||||
ld [hl], b
|
||||
inc hl
|
||||
ld [hl], $ff
|
||||
inc a
|
||||
ld [wNumTempUnlockedLevels], a
|
||||
ld [wLastUnlockedLevelsCount], a
|
||||
pop hl
|
||||
pop de
|
||||
ret
|
||||
@@ -192,7 +191,7 @@ ComputeLevelsToUnlock:
|
||||
ret
|
||||
|
||||
SaveUnlockedLevels:
|
||||
ld hl, wTempUnlockedLevels
|
||||
ld hl, wLastUnlockedLevels
|
||||
.loop
|
||||
ld a, [hli]
|
||||
ld e, a
|
||||
|
@@ -145,14 +145,22 @@ GameMenu_WorldMap:
|
||||
call ClearObjectStructs
|
||||
call ClearBGPalettes
|
||||
call ClearSprites
|
||||
; clear unlocked levels
|
||||
xor a
|
||||
ld [wLastUnlockedLevelsCount], a
|
||||
ld a, $ff
|
||||
ld [wLastUnlockedLevels], a
|
||||
; handle overworld exit
|
||||
ld a, [wExitOverworldReason]
|
||||
cp CLEARED_LEVEL
|
||||
jr nz, .save_and_return
|
||||
; if CLEARED_LEVEL:
|
||||
; show post-level screen, clear level, unlock levels, advance ToD, request appropriate LSM events
|
||||
farcall ClearedLevelScreen
|
||||
call AdvanceTimeOfDay
|
||||
ld hl, wLevelSelectionMenuEntryEventQueue
|
||||
set LSMEVENT_ANIMATE_TIME_OF_DAY, [hl]
|
||||
ld a, [wNumTempUnlockedLevels]
|
||||
ld a, [wLastUnlockedLevelsCount]
|
||||
and a
|
||||
jr z, .save_and_return
|
||||
set LSMEVENT_SHOW_UNLOCKED_LEVELS, [hl]
|
||||
|
@@ -23,14 +23,18 @@ LevelSelectionMenu::
|
||||
bit LSMEVENT_SHOW_UNLOCKED_LEVELS, a
|
||||
jr z, .load_default_landmark
|
||||
|
||||
ld hl, wTempUnlockedLevels
|
||||
ld a, [wLastUnlockedLevelsCount]
|
||||
and a
|
||||
jr z, .load_default_landmark
|
||||
|
||||
ld hl, wLastUnlockedLevels
|
||||
.show_unlocked_levels_loop
|
||||
ld a, [hli]
|
||||
cp $ff
|
||||
jr z, .load_default_landmark
|
||||
|
||||
push hl
|
||||
; perform level-to-landmark lookup of wTempUnlockedLevels[i] in $ff-terminated LandmarkToLevelTable.
|
||||
; perform level-to-landmark lookup of wLastUnlockedLevels[i] in $ff-terminated LandmarkToLevelTable.
|
||||
; stop at the first match and load it to wLevelSelectionMenuCurrentLandmark.
|
||||
ld hl, LandmarkToLevelTable
|
||||
ld c, 0
|
||||
|
Reference in New Issue
Block a user