From 3b17faf320ff7de90d4dc413a1d00c2cbedef6d8 Mon Sep 17 00:00:00 2001 From: Agent X <44549182+AgentXLP@users.noreply.github.com> Date: Fri, 5 Jul 2024 22:47:36 -0400 Subject: [PATCH] Fix disabling background sound on main menu --- src/game/level_update.c | 4 ++-- src/game/sound_init.c | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/game/level_update.c b/src/game/level_update.c index dd9d3626..f499f44b 100644 --- a/src/game/level_update.c +++ b/src/game/level_update.c @@ -1493,11 +1493,11 @@ void update_menu_level(void) { stop_cap_music(); if (!configMenuSound || configMenuStaffRoll || curLevel == LEVEL_CASTLE_GROUNDS) { reset_volume(); - disable_background_sound(); + sound_banks_disable(SEQ_PLAYER_SFX, SOUND_BANKS_BACKGROUND); set_background_music(0, SEQ_MENU_TITLE_SCREEN, 0); } else { reset_volume(); - disable_background_sound(); + sound_banks_disable(SEQ_PLAYER_SFX, SOUND_BANKS_BACKGROUND); set_background_music(gCurrentArea->musicParam, gCurrentArea->musicParam2, 0); } diff --git a/src/game/sound_init.c b/src/game/sound_init.c index 50c5c913..b927e6c5 100644 --- a/src/game/sound_init.c +++ b/src/game/sound_init.c @@ -25,8 +25,8 @@ static OSMesgQueue sSoundMesgQueue; static OSMesg sSoundMesgBuf[1]; static struct VblankHandler sSoundVblankHandler; -static u8 D_8032C6C0 = 0; -static u8 D_8032C6C4 = 0; +static u8 sVolumeLoweredState = 0; +static u8 sBackgroundMusicDisabled = FALSE; static u16 sCurrentMusic = MUSIC_NONE; static u16 sCurrentShellMusic = MUSIC_NONE; static u16 sCurrentCapMusic = MUSIC_NONE; @@ -80,7 +80,7 @@ void play_menu_sounds_extra(s32 a, void *b); * Called from threads: thread5_game_loop */ void reset_volume(void) { - D_8032C6C0 = 0; + sVolumeLoweredState = 0; } /** @@ -95,7 +95,7 @@ void lower_background_noise(s32 a) { seq_player_lower_volume(SEQ_PLAYER_LEVEL, 60, 40); break; } - D_8032C6C0 |= a; + sVolumeLoweredState |= a; } /** @@ -110,15 +110,15 @@ void raise_background_noise(s32 a) { seq_player_unlower_volume(SEQ_PLAYER_LEVEL, 60); break; } - D_8032C6C0 &= ~a; + sVolumeLoweredState &= ~a; } /** * Called from threads: thread5_game_loop */ void disable_background_sound(void) { - if (D_8032C6C4 == 0) { - D_8032C6C4 = 1; + if (!sBackgroundMusicDisabled) { + sBackgroundMusicDisabled = TRUE; sound_banks_disable(SEQ_PLAYER_SFX, SOUND_BANKS_BACKGROUND); } } @@ -127,8 +127,8 @@ void disable_background_sound(void) { * Called from threads: thread5_game_loop */ void enable_background_sound(void) { - if (D_8032C6C4 == 1) { - D_8032C6C4 = 0; + if (sBackgroundMusicDisabled) { + sBackgroundMusicDisabled = FALSE; sound_banks_enable(SEQ_PLAYER_SFX, SOUND_BANKS_BACKGROUND); } }