Fix disabling background sound on main menu

This commit is contained in:
Agent X 2024-07-05 22:47:36 -04:00
parent dcd3665b7a
commit 3b17faf320
2 changed files with 11 additions and 11 deletions

View File

@ -1493,11 +1493,11 @@ void update_menu_level(void) {
stop_cap_music(); stop_cap_music();
if (!configMenuSound || configMenuStaffRoll || curLevel == LEVEL_CASTLE_GROUNDS) { if (!configMenuSound || configMenuStaffRoll || curLevel == LEVEL_CASTLE_GROUNDS) {
reset_volume(); reset_volume();
disable_background_sound(); sound_banks_disable(SEQ_PLAYER_SFX, SOUND_BANKS_BACKGROUND);
set_background_music(0, SEQ_MENU_TITLE_SCREEN, 0); set_background_music(0, SEQ_MENU_TITLE_SCREEN, 0);
} else { } else {
reset_volume(); reset_volume();
disable_background_sound(); sound_banks_disable(SEQ_PLAYER_SFX, SOUND_BANKS_BACKGROUND);
set_background_music(gCurrentArea->musicParam, gCurrentArea->musicParam2, 0); set_background_music(gCurrentArea->musicParam, gCurrentArea->musicParam2, 0);
} }

View File

@ -25,8 +25,8 @@ static OSMesgQueue sSoundMesgQueue;
static OSMesg sSoundMesgBuf[1]; static OSMesg sSoundMesgBuf[1];
static struct VblankHandler sSoundVblankHandler; static struct VblankHandler sSoundVblankHandler;
static u8 D_8032C6C0 = 0; static u8 sVolumeLoweredState = 0;
static u8 D_8032C6C4 = 0; static u8 sBackgroundMusicDisabled = FALSE;
static u16 sCurrentMusic = MUSIC_NONE; static u16 sCurrentMusic = MUSIC_NONE;
static u16 sCurrentShellMusic = MUSIC_NONE; static u16 sCurrentShellMusic = MUSIC_NONE;
static u16 sCurrentCapMusic = 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 * Called from threads: thread5_game_loop
*/ */
void reset_volume(void) { 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); seq_player_lower_volume(SEQ_PLAYER_LEVEL, 60, 40);
break; break;
} }
D_8032C6C0 |= a; sVolumeLoweredState |= a;
} }
/** /**
@ -110,15 +110,15 @@ void raise_background_noise(s32 a) {
seq_player_unlower_volume(SEQ_PLAYER_LEVEL, 60); seq_player_unlower_volume(SEQ_PLAYER_LEVEL, 60);
break; break;
} }
D_8032C6C0 &= ~a; sVolumeLoweredState &= ~a;
} }
/** /**
* Called from threads: thread5_game_loop * Called from threads: thread5_game_loop
*/ */
void disable_background_sound(void) { void disable_background_sound(void) {
if (D_8032C6C4 == 0) { if (!sBackgroundMusicDisabled) {
D_8032C6C4 = 1; sBackgroundMusicDisabled = TRUE;
sound_banks_disable(SEQ_PLAYER_SFX, SOUND_BANKS_BACKGROUND); sound_banks_disable(SEQ_PLAYER_SFX, SOUND_BANKS_BACKGROUND);
} }
} }
@ -127,8 +127,8 @@ void disable_background_sound(void) {
* Called from threads: thread5_game_loop * Called from threads: thread5_game_loop
*/ */
void enable_background_sound(void) { void enable_background_sound(void) {
if (D_8032C6C4 == 1) { if (sBackgroundMusicDisabled) {
D_8032C6C4 = 0; sBackgroundMusicDisabled = FALSE;
sound_banks_enable(SEQ_PLAYER_SFX, SOUND_BANKS_BACKGROUND); sound_banks_enable(SEQ_PLAYER_SFX, SOUND_BANKS_BACKGROUND);
} }
} }