From 13ca744ef87a4abb62403364e130d96b4272819d Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sat, 15 Jan 2022 20:20:46 -0500 Subject: [PATCH] - replicate GZDoom commit 12ed24d066 --- source/common/platform/posix/cocoa/i_main.mm | 3 +- .../common/platform/posix/sdl/sdlglvideo.cpp | 4 +-- source/common/platform/win32/i_input.cpp | 3 +- source/core/gamecontrol.cpp | 36 ++++++++++--------- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/source/common/platform/posix/cocoa/i_main.mm b/source/common/platform/posix/cocoa/i_main.mm index 09c1daf56..382fabb23 100644 --- a/source/common/platform/posix/cocoa/i_main.mm +++ b/source/common/platform/posix/cocoa/i_main.mm @@ -55,7 +55,6 @@ // --------------------------------------------------------------------------- -CVAR (Bool, i_soundinbackground, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) EXTERN_CVAR(Int, vid_defwidth ) EXTERN_CVAR(Int, vid_defheight) EXTERN_CVAR(Bool, vid_vsync ) @@ -293,7 +292,7 @@ extern bool AppActive; { ZD_UNUSED(aNotification); - S_SetSoundPaused(i_soundinbackground); + S_SetSoundPaused(0); AppActive = false; } diff --git a/source/common/platform/posix/sdl/sdlglvideo.cpp b/source/common/platform/posix/sdl/sdlglvideo.cpp index 9b4aa6cd6..a5f7e6b52 100644 --- a/source/common/platform/posix/sdl/sdlglvideo.cpp +++ b/source/common/platform/posix/sdl/sdlglvideo.cpp @@ -95,8 +95,6 @@ CUSTOM_CVAR(Bool, gl_es, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCA Printf("This won't take effect until " GAMENAME " is restarted.\n"); } -CVAR(Bool, i_soundinbackground, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) - CVAR (Int, vid_adapter, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) CUSTOM_CVAR(String, vid_sdl_render_driver, "", CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) @@ -721,7 +719,7 @@ void ProcessSDLWindowEvent(const SDL_WindowEvent &event) break; case SDL_WINDOWEVENT_FOCUS_LOST: - S_SetSoundPaused(i_soundinbackground); + S_SetSoundPaused(0); AppActive = false; break; diff --git a/source/common/platform/win32/i_input.cpp b/source/common/platform/win32/i_input.cpp index c62bbcf42..06b1e9801 100644 --- a/source/common/platform/win32/i_input.cpp +++ b/source/common/platform/win32/i_input.cpp @@ -140,7 +140,6 @@ int BlockMouseMove; static bool EventHandlerResultForNativeMouse; -CVAR (Bool, i_soundinbackground, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR (Bool, k_allowfullscreentoggle, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) extern int chatmodeon; @@ -508,7 +507,7 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { SetPriorityClass (GetCurrentProcess (), IDLE_PRIORITY_CLASS); } - S_SetSoundPaused ((!!i_soundinbackground) || wParam); + S_SetSoundPaused (wParam); break; case WM_WTSSESSION_CHANGE: diff --git a/source/core/gamecontrol.cpp b/source/core/gamecontrol.cpp index 5951b33ca..3b02da93b 100644 --- a/source/core/gamecontrol.cpp +++ b/source/core/gamecontrol.cpp @@ -83,6 +83,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. CVAR(Bool, autoloadlights, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR(Bool, autoloadbrightmaps, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) CVAR(Bool, autoloadwidescreen, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) +CVAR (Bool, i_soundinbackground, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) +CVAR (Bool, i_pauseinbackground, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) // Note: For the automap label there is a separate option "am_textfont". CVARD(Bool, hud_textfont, false, CVAR_ARCHIVE, "Use the regular text font as replacement for the tiny 3x5 font for HUD messages whenever possible") @@ -1247,15 +1249,24 @@ void S_ResumeSound (bool notsfx) void S_SetSoundPaused(int state) { - if (state) + if (!netgame && (i_pauseinbackground) +#ifdef 0 //_DEBUG + && !demoplayback +#endif + ) + { + pauseext = !state; + } + + if ((state || i_soundinbackground) && !pauseext) { if (paused == 0) { S_ResumeSound(true); - } - if (GSnd != nullptr) - { - GSnd->SetInactive(SoundRenderer::INACTIVE_Active); + if (GSnd != nullptr) + { + GSnd->SetInactive(SoundRenderer::INACTIVE_Active); + } } } else @@ -1265,22 +1276,15 @@ void S_SetSoundPaused(int state) S_PauseSound(false, true); if (GSnd != nullptr) { - GSnd->SetInactive(SoundRenderer::INACTIVE_Complete); + GSnd->SetInactive(gamestate == GS_LEVEL || gamestate == GS_TITLELEVEL ? + SoundRenderer::INACTIVE_Complete : + SoundRenderer::INACTIVE_Mute); } } } -#if 0 - if (!netgame -#if 0 //def _DEBUG - && !demoplayback -#endif - ) - { - pauseext = !state; - } -#endif } + FString G_GetDemoPath() { FString path = M_GetDemoPath();