From 40b9644e0c97a37d0ada389e81240d04e20273ca Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Mon, 22 Oct 2018 16:32:06 -0400 Subject: [PATCH] Use COM_ImmedExecute("restartaudio") instead of duplicated code --- src/d_netcmd.c | 6 +++++- src/m_menu.c | 17 +---------------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 120ffc55..0b885ab3 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -4855,9 +4855,13 @@ static void Command_RestartAudio_f(void) I_SetSfxVolume(cv_soundvolume.value); I_SetDigMusicVolume(cv_digmusicvolume.value); //I_SetMIDIMusicVolume(cv_midimusicvolume.value); + + S_StartSound(NULL, sfx_strpst); + if (Playing()) // Gotta make sure the player is in a level P_RestoreMusic(&players[consoleplayer]); - + else + S_ChangeMusicInternal("titles", looptitle); } /** Quits a game and returns to the title screen. diff --git a/src/m_menu.c b/src/m_menu.c index 2e2a79e0..8adcc954 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -9043,22 +9043,7 @@ static void M_ToggleDigital(INT32 choice) static void M_RestartAudio(void) { - S_StopMusic(); - I_ShutdownMusic(); - I_ShutdownSound(); - I_StartupSound(); - I_InitMusic(); - - I_SetSfxVolume(cv_soundvolume.value); - I_SetDigMusicVolume(cv_digmusicvolume.value); - //I_SetMIDIMusicVolume(cv_midimusicvolume.value); - - S_StartSound(NULL, sfx_strpst); - - if (Playing()) // Gotta make sure the player is in a level - P_RestoreMusic(&players[consoleplayer]); - else - S_ChangeMusicInternal("titles", looptitle); + COM_ImmedExecute("restartaudio"); } // ===============