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 sjump .display_menu
.exit: .exit:
wait 300
exitoverworld $00 exitoverworld $00
.ConfirmExitText: .ConfirmExitText:

View File

@ -92,6 +92,22 @@ GameMenu_WorldMap:
and a and a
jr z, .not_in_overworld 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 a, $8
ld [wMusicFade], a ld [wMusicFade], a
ld a, LOW(MUSIC_NONE) ld a, LOW(MUSIC_NONE)
@ -103,18 +119,16 @@ GameMenu_WorldMap:
ld c, 20 ld c, 20
call DelayFrames call DelayFrames
farcall JumpRoamMons farcall JumpRoamMons
ld a, MAPSETUP_CONTINUE
ldh [hMapEntryMethod], a
xor a xor a
ld [wDontPlayMapMusicOnReload], a ld [wDontPlayMapMusicOnReload], a ; play map music
ld [wLinkMode], a ld [wLinkMode], a
ld hl, wGameTimerPaused ld hl, wGameTimerPaused
set GAME_TIMER_COUNTING_F, [hl] set GAME_TIMER_COUNTING_F, [hl] ; start game timer counter
farcall OverworldLoop farcall OverworldLoop
jp GameMenu
.not_in_overworld ; return from overworld loop
farcall LevelSelectionMenu call ClearBGPalettes
call ClearSprites
ret ret
GameMenu_Shop: GameMenu_Shop:

View File

@ -119,39 +119,15 @@ LevelSelectionMenu::
jr .main_loop jr .main_loop
.enter_level .enter_level
ld a, [wLevelSelectionMenuCurrentLandmark]
call LevelSelectionMenu_GetLandmarkSpawnPoint
ld [wDefaultSpawnpoint], a
call LevelSelectionMenu_Delay10Frames call LevelSelectionMenu_Delay10Frames
ld de, SFX_WARP_TO ld de, SFX_WARP_TO
call PlaySFX call PlaySFX
call LevelSelectionMenu_Delay10Frames call LevelSelectionMenu_Delay10Frames
call .EnterLevelFadeOut call .EnterLevelFadeOut
ld a, $8 scf
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
ret ret
.EnterLevelFadeOut: .EnterLevelFadeOut:
@ -166,7 +142,7 @@ LevelSelectionMenu::
call ClearSprites call ClearSprites
xor a xor a
ld [wVramState], a ld [wVramState], a
ret ret ; nc
LevelSelectionMenu_LoadGFX: LevelSelectionMenu_LoadGFX:
; load gfx for the background tiles, and for the player and directional arrow sprites ; 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 const wait_command ; $a8
MACRO wait MACRO wait
db wait_command db wait_command
db \1 ; duration db \1 / 100 ; duration (ms)
ENDM ENDM
const checksave_command ; $a9 const checksave_command ; $a9