Persist level selection menu landmark when coming back (#12)

This commit is contained in:
xCrystal 2024-01-25 17:17:24 +01:00
parent 2e9e298d64
commit 533f7c259e
4 changed files with 8 additions and 3 deletions

View File

@ -83,7 +83,6 @@
- **wSpacesLeft**
- Addresses within *wCurMapData* ~ *wCurMapDataEnd*: preserved on save. Initialized when entering a level (in StartMap), and updated accordingly throughout the level. Includes:
- **wCurLevel**: this one is not initialized in StartMap, but in LevelSelectionMenu (where it is also used), and stays static during the level.
- **wCurTurn**
- **wCurSpace**
- **wCurLevelCoins**
@ -98,6 +97,8 @@
- **wUnlockedLevels**: flag array that tracks progression regarding which levels have been unlocked.
- **wClearedLevelsStage<N>**: flag array that tracks progression regarding which levels have been cleared. Each level can have up to four clearable endings (N).
- **wUnlockedTechniques**: flag array that tracks progression regarding which techniques have been unlocked.
- **wCurLevel**: initialized in LevelSelectionMenu (where it is also used), and stays static during the level.
- **wDefaultLevelSelectionMenuLandmark**: used to know in which landmark to place the player when entering level selection menu.
- **wCurOverworldMiscPal**
- These addresses share memory region with string buffers from *wStringBuffer3* onwards. They are placed in memory in the following order.

View File

@ -26,6 +26,8 @@ if DEF(_DEBUG)
ld a, -1
ld [wUnlockedLevels], a ; debug
endc
xor a ; LANDMARK_LEVEL_1
ld [wDefaultLevelSelectionMenuLandmark], a
farcall AutoSaveGameOutsideOverworld
jp GameMenu

View File

@ -17,7 +17,7 @@ LevelSelectionMenu::
ld a, LCDC_DEFAULT
ldh [rLCDC], a
xor a
ld a, [wDefaultLevelSelectionMenuLandmark]
ld [wLevelSelectionMenuCurrentLandmark], a
call LevelSelectionMenu_GetLandmarkPage
ld [wLevelSelectionMenuCurrentPage], a
@ -1002,6 +1002,7 @@ _LevelSelectionMenuHandleTransition:
; set new landmark
ld a, [de]
ld [wLevelSelectionMenuCurrentLandmark], a
ld [wDefaultLevelSelectionMenuLandmark], a
; make the player sprite face down as the default state
ld hl, SPRITEANIMSTRUCT_ANIM_SEQ_ID
add hl, bc

View File

@ -2543,6 +2543,8 @@ wRepelEffect:: db ; If a Repel is in use, it contains the nr of steps it's still
wBikeStep:: dw
wKurtApricornQuantity:: db
wCurLevel:: db
wDefaultLevelSelectionMenuLandmark:: db
wCurOverworldMiscPal:: db
wPlayerDataEnd::
@ -2571,7 +2573,6 @@ wYCoord:: db
wXCoord:: db
wScreenSave:: ds SCREEN_META_WIDTH * SCREEN_META_HEIGHT
wCurLevel:: db
wCurTurn:: dw
wCurSpace:: db
wCurLevelCoins:: ds 3