Skip to content

Commit

Permalink
- replicate GZDoom commit 12ed24d066
Browse files Browse the repository at this point in the history
  • Loading branch information
madame-rachelle authored and coelckers committed Jan 21, 2022
1 parent c6f991a commit 13ca744
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
3 changes: 1 addition & 2 deletions source/common/platform/posix/cocoa/i_main.mm
Expand Up @@ -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 )
Expand Down Expand Up @@ -293,7 +292,7 @@ - (void)applicationWillResignActive:(NSNotification*)aNotification
{
ZD_UNUSED(aNotification);

S_SetSoundPaused(i_soundinbackground);
S_SetSoundPaused(0);

AppActive = false;
}
Expand Down
4 changes: 1 addition & 3 deletions source/common/platform/posix/sdl/sdlglvideo.cpp
Expand Up @@ -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)
Expand Down Expand Up @@ -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;

Expand Down
3 changes: 1 addition & 2 deletions source/common/platform/win32/i_input.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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:
Expand Down
36 changes: 20 additions & 16 deletions source/core/gamecontrol.cpp
Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand All @@ -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();
Expand Down

0 comments on commit 13ca744

Please sign in to comment.