Functional stub of title menus: clean up return from overworld loop [Commit 2] (#17)

This commit is contained in:
xCrystal 2023-10-01 00:39:18 +02:00
parent a16322350f
commit 0795c02a9c
4 changed files with 28 additions and 37 deletions

View File

@ -41,6 +41,7 @@ BoardMenuScript::
sjump .display_menu
.exit:
wait 300
exitoverworld $00
.ConfirmExitText:

View File

@ -92,6 +92,22 @@ GameMenu_WorldMap:
and a
jr z, .not_in_overworld
ld a, MAPSETUP_CONTINUE
jr .SpawnToMap
.not_in_overworld
farcall LevelSelectionMenu
ret nc ; if pressed B, go back to Game Menu
farcall ClearSpriteAnims
call ClearSprites
ld a, PLAYER_NORMAL
ld [wPlayerState], a ; this may need to be set on a per-level basis (e.g. if specific level starts with player in surf state)
ld a, MAPSETUP_ENTERLEVEL
; jr .SpawnToMap
.SpawnToMap:
ldh [hMapEntryMethod], a
ld a, $8
ld [wMusicFade], a
ld a, LOW(MUSIC_NONE)
@ -103,18 +119,16 @@ GameMenu_WorldMap:
ld c, 20
call DelayFrames
farcall JumpRoamMons
ld a, MAPSETUP_CONTINUE
ldh [hMapEntryMethod], a
xor a
ld [wDontPlayMapMusicOnReload], a
ld [wDontPlayMapMusicOnReload], a ; play map music
ld [wLinkMode], a
ld hl, wGameTimerPaused
set GAME_TIMER_COUNTING_F, [hl]
set GAME_TIMER_COUNTING_F, [hl] ; start game timer counter
farcall OverworldLoop
jp GameMenu
.not_in_overworld
farcall LevelSelectionMenu
; return from overworld loop
call ClearBGPalettes
call ClearSprites
ret
GameMenu_Shop:

View File

@ -119,39 +119,15 @@ LevelSelectionMenu::
jr .main_loop
.enter_level
ld a, [wLevelSelectionMenuCurrentLandmark]
call LevelSelectionMenu_GetLandmarkSpawnPoint
ld [wDefaultSpawnpoint], a
call LevelSelectionMenu_Delay10Frames
ld de, SFX_WARP_TO
call PlaySFX
call LevelSelectionMenu_Delay10Frames
call .EnterLevelFadeOut
ld a, $8
ld [wMusicFade], a
ld a, LOW(MUSIC_NONE)
ld [wMusicFadeID], a
ld a, HIGH(MUSIC_NONE)
ld [wMusicFadeID + 1], a
call ClearBGPalettes
call ClearTilemap
farcall ClearSpriteAnims
call ClearSprites
xor a
ld [wVramState], a
ld c, 20
call DelayFrames
ld a, [wLevelSelectionMenuCurrentLandmark]
call LevelSelectionMenu_GetLandmarkSpawnPoint
ld [wDefaultSpawnpoint], a
ld a, MAPSETUP_ENTERLEVEL
ld [hMapEntryMethod], a
xor a
ld [wDontPlayMapMusicOnReload], a ; play map music
ld [wLinkMode], a
ld a, PLAYER_NORMAL
ld [wPlayerState], a ; this may need to be set on a per-level basis (e.g. if specific level starts with player in surf state)
ld hl, wGameTimerPaused
set GAME_TIMER_COUNTING_F, [hl] ; start game timer counter
farcall OverworldLoop
scf
ret
.EnterLevelFadeOut:
@ -166,7 +142,7 @@ LevelSelectionMenu::
call ClearSprites
xor a
ld [wVramState], a
ret
ret ; nc
LevelSelectionMenu_LoadGFX:
; load gfx for the background tiles, and for the player and directional arrow sprites

View File

@ -1057,7 +1057,7 @@ ENDM
const wait_command ; $a8
MACRO wait
db wait_command
db \1 ; duration
db \1 / 100 ; duration (ms)
ENDM
const checksave_command ; $a9