mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-03-04 08:31:36 +00:00
Fix pause/un-pause on window focus gained or lost
Fixed pause/un-pause on window focus gained or lost in pull request #1017. Fixed ogg playback when switching video options, missed in #1004. Fixed ogg playback when the last menu closed, misplaced in #1004.
This commit is contained in:
parent
8cbbfaae9e
commit
be1e6e1743
2 changed files with 23 additions and 10 deletions
|
@ -693,7 +693,7 @@ IN_Update(void)
|
||||||
{
|
{
|
||||||
S_Activate(false);
|
S_Activate(false);
|
||||||
|
|
||||||
if (windowed_pauseonfocuslost->value == 1)
|
if (windowed_pauseonfocuslost->value != 2)
|
||||||
{
|
{
|
||||||
Cvar_SetValue("paused", 1);
|
Cvar_SetValue("paused", 1);
|
||||||
}
|
}
|
||||||
|
@ -710,6 +710,11 @@ IN_Update(void)
|
||||||
{
|
{
|
||||||
S_Activate(true);
|
S_Activate(true);
|
||||||
|
|
||||||
|
if (windowed_pauseonfocuslost->value == 0)
|
||||||
|
{
|
||||||
|
Cvar_SetValue("paused", 0);
|
||||||
|
}
|
||||||
|
|
||||||
/* play music */
|
/* play music */
|
||||||
if (Cvar_VariableValue("ogg_pausewithgame") == 1 &&
|
if (Cvar_VariableValue("ogg_pausewithgame") == 1 &&
|
||||||
OGG_Status() == PAUSE && cl.attractloop == false &&
|
OGG_Status() == PAUSE && cl.attractloop == false &&
|
||||||
|
@ -731,9 +736,18 @@ IN_Update(void)
|
||||||
{
|
{
|
||||||
Cvar_SetValue("paused", 0);
|
Cvar_SetValue("paused", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* play music */
|
||||||
|
if (Cvar_VariableValue("ogg_pausewithgame") == 1 &&
|
||||||
|
OGG_Status() == PAUSE && cl.attractloop == false &&
|
||||||
|
cl_paused->value == 0)
|
||||||
|
{
|
||||||
|
Cbuf_AddText("ogg toggle\n");
|
||||||
}
|
}
|
||||||
else if (event.window.event == SDL_WINDOWEVENT_MINIMIZED && windowed_pauseonfocuslost->value > 0 ||
|
|
||||||
event.window.event == SDL_WINDOWEVENT_HIDDEN && windowed_pauseonfocuslost->value > 0)
|
}
|
||||||
|
else if (event.window.event == SDL_WINDOWEVENT_MINIMIZED ||
|
||||||
|
event.window.event == SDL_WINDOWEVENT_HIDDEN)
|
||||||
{
|
{
|
||||||
Cvar_SetValue("paused", 1);
|
Cvar_SetValue("paused", 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,13 +124,6 @@ M_ForceMenuOff(void)
|
||||||
void
|
void
|
||||||
M_PopMenu(void)
|
M_PopMenu(void)
|
||||||
{
|
{
|
||||||
/* play music */
|
|
||||||
if (Cvar_VariableValue("ogg_pausewithgame") == 1 &&
|
|
||||||
OGG_Status() == PAUSE && cl.attractloop == false)
|
|
||||||
{
|
|
||||||
Cbuf_AddText("ogg toggle\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
S_StartLocalSound(menu_out_sound);
|
S_StartLocalSound(menu_out_sound);
|
||||||
|
|
||||||
if (m_menudepth < 1)
|
if (m_menudepth < 1)
|
||||||
|
@ -146,6 +139,12 @@ M_PopMenu(void)
|
||||||
if (!m_menudepth)
|
if (!m_menudepth)
|
||||||
{
|
{
|
||||||
M_ForceMenuOff();
|
M_ForceMenuOff();
|
||||||
|
/* play music */
|
||||||
|
if (Cvar_VariableValue("ogg_pausewithgame") == 1 &&
|
||||||
|
OGG_Status() == PAUSE && cl.attractloop == false)
|
||||||
|
{
|
||||||
|
Cbuf_AddText("ogg toggle\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue