From 917db30e98199267d104f04b32ee4b2a0ae1e0bc Mon Sep 17 00:00:00 2001 From: xCrystal Date: Sat, 7 Oct 2023 19:08:54 +0200 Subject: [PATCH] Save game and clear board menu cursor position during game menu (#17) --- constants/engine_flags.asm | 2 +- constants/wram_constants.asm | 2 +- data/events/engine_flags.asm | 2 +- engine/gfx/color.asm | 4 ++-- engine/menus/game_menu.asm | 4 +++- engine/menus/main_menu.asm | 2 -- engine/overworld/events.asm | 2 +- engine/overworld/scripting.asm | 4 ++-- home/game_time.asm | 2 +- ram/wram.asm | 2 +- 10 files changed, 13 insertions(+), 13 deletions(-) diff --git a/constants/engine_flags.asm b/constants/engine_flags.asm index a2a4f4fd5..e1701946e 100644 --- a/constants/engine_flags.asm +++ b/constants/engine_flags.asm @@ -95,7 +95,7 @@ endc ; wSwarmFlags const ENGINE_BUENAS_PASSWORD_2 const ENGINE_GOLDENROD_DEPT_STORE_SALE_IS_ON -; wGameTimerPaused +; wGameTimer const ENGINE_62 ; wPlayerGender const ENGINE_PLAYER_IS_FEMALE diff --git a/constants/wram_constants.asm b/constants/wram_constants.asm index 7037202f7..ea60b641e 100644 --- a/constants/wram_constants.asm +++ b/constants/wram_constants.asm @@ -27,7 +27,7 @@ DEF AUTO_INPUT EQU $ff const TEMPMON ; 3 const WILDMON ; 4 -; wGameTimerPaused:: +; wGameTimer:: DEF GAME_TIMER_COUNTING_F EQU 0 ; wJoypadDisable:: diff --git a/data/events/engine_flags.asm b/data/events/engine_flags.asm index 61dc0d8cf..f99fa5144 100644 --- a/data/events/engine_flags.asm +++ b/data/events/engine_flags.asm @@ -106,7 +106,7 @@ endc engine_flag wSwarmFlags, SWARMFLAGS_BUENAS_PASSWORD_F engine_flag wSwarmFlags, SWARMFLAGS_GOLDENROD_DEPT_STORE_SALE_F - engine_flag wGameTimerPaused, 7 ; unused + engine_flag wGameTimer, 7 ; unused engine_flag wPlayerGender, PLAYERGENDER_FEMALE_F diff --git a/engine/gfx/color.asm b/engine/gfx/color.asm index 955ad4e0a..2e7481696 100644 --- a/engine/gfx/color.asm +++ b/engine/gfx/color.asm @@ -698,7 +698,7 @@ LoadMapPals: ld a, BANK(wOBPals1) ld de, wOBPals1 ld hl, MapObjectDarknessPals - ld bc, 7 palettes + ld bc, 7 palettes ; all but PAL_OW_MISC jp FarCopyWRAM .not_darkness @@ -708,7 +708,7 @@ LoadMapPals: ld hl, MapObjectPals call AddNTimes ld de, wOBPals1 - ld bc, 7 palettes + ld bc, 7 palettes ; all but PAL_OW_MISC ld a, BANK(wOBPals1) call FarCopyWRAM diff --git a/engine/menus/game_menu.asm b/engine/menus/game_menu.asm index 1f42dcb98..e045be73e 100755 --- a/engine/menus/game_menu.asm +++ b/engine/menus/game_menu.asm @@ -122,13 +122,15 @@ GameMenu_WorldMap: xor a ld [wDontPlayMapMusicOnReload], a ; play map music ld [wLinkMode], a - ld hl, wGameTimerPaused + ld [wBoardMenuLastCursorPosition], a + ld hl, wGameTimer set GAME_TIMER_COUNTING_F, [hl] ; start game timer counter farcall OverworldLoop ; return from overworld loop call ClearBGPalettes call ClearSprites + farcall AutoSaveGameOutsideOverworld ret GameMenu_Shop: diff --git a/engine/menus/main_menu.asm b/engine/menus/main_menu.asm index 185ca625c..61f23137a 100644 --- a/engine/menus/main_menu.asm +++ b/engine/menus/main_menu.asm @@ -21,8 +21,6 @@ MainMenu: ld b, CGB_DIPLOMA call GetCGBLayout call SetPalettes - ld hl, wGameTimerPaused - res GAME_TIMER_COUNTING_F, [hl] call MainMenu_GetWhichMenu ld [wWhichIndexSet], a call MainMenu_PrintCurrentTimeAndDay diff --git a/engine/overworld/events.asm b/engine/overworld/events.asm index c221f9e35..b492f3f2f 100644 --- a/engine/overworld/events.asm +++ b/engine/overworld/events.asm @@ -12,7 +12,7 @@ OverworldLoop:: jr nz, .loop .done call DisableOverworldHUD - ld hl, wGameTimerPaused + ld hl, wGameTimer res GAME_TIMER_COUNTING_F, [hl] ; stop game timer counter ld a, FALSE ld [wText2bpp], a diff --git a/engine/overworld/scripting.asm b/engine/overworld/scripting.asm index 05c133a2d..f950ae7ad 100644 --- a/engine/overworld/scripting.asm +++ b/engine/overworld/scripting.asm @@ -2314,10 +2314,10 @@ Script_endall: ret Script_halloffame: - ld hl, wGameTimerPaused + ld hl, wGameTimer res GAME_TIMER_COUNTING_F, [hl] farcall HallOfFame - ld hl, wGameTimerPaused + ld hl, wGameTimer set GAME_TIMER_COUNTING_F, [hl] jr ReturnFromCredits diff --git a/home/game_time.asm b/home/game_time.asm index 749c0c6a5..605fc93bd 100644 --- a/home/game_time.asm +++ b/home/game_time.asm @@ -32,7 +32,7 @@ GameTimer:: ret nz ; Is the timer paused? - ld hl, wGameTimerPaused + ld hl, wGameTimer bit GAME_TIMER_COUNTING_F, [hl] ret z diff --git a/ram/wram.asm b/ram/wram.asm index 901584914..c56023233 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -1200,7 +1200,7 @@ wPredefHL:: dw wPredefAddress:: dw wFarCallBC:: dw -wGameTimerPaused:: +wGameTimer:: ; bit 0: game timer paused ; bit 7: something mobile db