mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
RR: Amend how game pauses.
- M_Active or GUICapture properly pause game using game's pause mechanisms. - Pausing game with Pause key now works again. - Pausing game with Pause key now properly stops all sounds as per upstream.
This commit is contained in:
parent
65265594e5
commit
b86d499e0b
11 changed files with 68 additions and 108 deletions
|
@ -580,7 +580,7 @@ void GameInterface::DrawNativeMenuText(int fontnum, int state, double xpos, doub
|
|||
|
||||
void GameInterface::MenuOpened()
|
||||
{
|
||||
S_PauseSounds(true);
|
||||
S_PauseSound(true, false);
|
||||
if ((!g_netServer && ud.multimode < 2))
|
||||
{
|
||||
ready2send = 0;
|
||||
|
@ -646,7 +646,7 @@ void GameInterface::MenuClosed()
|
|||
}
|
||||
|
||||
G_UpdateScreenArea();
|
||||
S_PauseSounds(false);
|
||||
S_ResumeSound(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ static int32_t G_OpenDemoRead(int32_t g_whichDemo) // 0 = mine
|
|||
|
||||
gFullMap = false;
|
||||
ud.god = ud.cashman = ud.eog = 0;
|
||||
ud.noclip = ud.scrollmode = ud.overhead_on = 0; //= ud.pause_on = 0;
|
||||
ud.noclip = ud.scrollmode = ud.overhead_on = 0; //= paused = 0;
|
||||
|
||||
totalclock = ototalclock = lockclock = 0;
|
||||
|
||||
|
@ -591,7 +591,7 @@ RECHECK:
|
|||
Demo_FinishProfile();
|
||||
|
||||
while (totalclock >= (lockclock+TICSPERFRAME)
|
||||
// || (ud.reccnt > REALGAMETICSPERSEC*2 && ud.pause_on)
|
||||
// || (ud.reccnt > REALGAMETICSPERSEC*2 && paused)
|
||||
|| (g_demo_goalCnt>0 && g_demo_cnt<g_demo_goalCnt))
|
||||
{
|
||||
if (ud.reccnt<=0)
|
||||
|
|
|
@ -849,7 +849,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
|
|||
videoSetCorrectedAspect();
|
||||
}
|
||||
|
||||
if (ud.pause_on || pPlayer->on_crane > -1)
|
||||
if (paused || pPlayer->on_crane > -1)
|
||||
smoothRatio = 65536;
|
||||
else
|
||||
smoothRatio = calc_smoothratio(totalclock, ototalclock);
|
||||
|
@ -924,7 +924,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
|
|||
|
||||
if (RRRA && pPlayer->drug_mode > 0)
|
||||
{
|
||||
while (pPlayer->drug_timer < totalclock && !(pPlayer->gm & MODE_MENU) && !ud.pause_on && !GUICapture)
|
||||
while (pPlayer->drug_timer < totalclock && !(pPlayer->gm & MODE_MENU) && !paused && !GUICapture)
|
||||
{
|
||||
int aspect;
|
||||
if (pPlayer->drug_stat[0] == 0)
|
||||
|
@ -5027,7 +5027,7 @@ default_case1:
|
|||
spritesortcnt++;
|
||||
}
|
||||
|
||||
if (g_player[playerNum].input->extbits & (1 << 7) && !ud.pause_on && spritesortcnt < maxspritesonscreen)
|
||||
if (g_player[playerNum].input->extbits & (1 << 7) && !paused && spritesortcnt < maxspritesonscreen)
|
||||
{
|
||||
tspritetype *const playerTyping = t;
|
||||
|
||||
|
@ -7296,7 +7296,9 @@ MAIN_LOOP_RESTART:
|
|||
char gameUpdate = false;
|
||||
double const gameUpdateStartTime = timerGetHiTicks();
|
||||
|
||||
if (M_Active() || GUICapture || ud.pause_on != 0)
|
||||
updatePauseStatus();
|
||||
|
||||
if (paused)
|
||||
{
|
||||
ototalclock = totalclock - TICSPERFRAME;
|
||||
buttonMap.ResetButtonStates();
|
||||
|
@ -7305,8 +7307,6 @@ MAIN_LOOP_RESTART:
|
|||
{
|
||||
while (((g_netClient || g_netServer) || !(g_player[myconnectindex].ps->gm & (MODE_MENU|MODE_DEMO))) && (int)(totalclock - ototalclock) >= TICSPERFRAME)
|
||||
{
|
||||
ototalclock += TICSPERFRAME;
|
||||
|
||||
if (RRRA && g_player[myconnectindex].ps->on_motorcycle)
|
||||
P_GetInputMotorcycle(myconnectindex);
|
||||
else if (RRRA && g_player[myconnectindex].ps->on_boat)
|
||||
|
@ -7330,7 +7330,9 @@ MAIN_LOOP_RESTART:
|
|||
|
||||
g_player[myconnectindex].movefifoend++;
|
||||
|
||||
if (((g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU || ud.recstat == 2 || (g_netServer || ud.multimode > 1)) &&
|
||||
ototalclock += TICSPERFRAME;
|
||||
|
||||
if (paused == 0 && ((g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU || ud.recstat == 2 || (g_netServer || ud.multimode > 1)) &&
|
||||
(g_player[myconnectindex].ps->gm&MODE_GAME))
|
||||
{
|
||||
G_MoveLoop();
|
||||
|
@ -7528,11 +7530,8 @@ int G_DoMoveThings(void)
|
|||
everyothertime++;
|
||||
if (g_earthquakeTime > 0) g_earthquakeTime--;
|
||||
|
||||
if (ud.pause_on == 0)
|
||||
{
|
||||
g_globalRandom = krand2();
|
||||
A_MoveDummyPlayers();//ST 13
|
||||
}
|
||||
g_globalRandom = krand2();
|
||||
A_MoveDummyPlayers();//ST 13
|
||||
|
||||
for (bssize_t TRAVERSE_CONNECT(i))
|
||||
{
|
||||
|
@ -7552,18 +7551,14 @@ int G_DoMoveThings(void)
|
|||
sprite[g_player[i].ps->i].pal = g_player[i].pcolor;
|
||||
|
||||
if (!DEER)
|
||||
P_HandleSharedKeys(i);
|
||||
P_HandleSharedKeys(i);
|
||||
|
||||
if (ud.pause_on == 0)
|
||||
{
|
||||
P_ProcessInput(i);
|
||||
if (!DEER)
|
||||
P_ProcessInput(i);
|
||||
if (!DEER)
|
||||
P_CheckSectors(i);
|
||||
}
|
||||
}
|
||||
|
||||
if (ud.pause_on == 0)
|
||||
G_MoveWorld();
|
||||
G_MoveWorld();
|
||||
|
||||
Net_CorrectPrediction();
|
||||
|
||||
|
@ -7578,8 +7573,8 @@ int G_DoMoveThings(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
G_AnimateWalls();
|
||||
A_MoveCyclers();
|
||||
G_AnimateWalls();
|
||||
A_MoveCyclers();
|
||||
}
|
||||
|
||||
//if (g_netServer && (everyothertime % 10) == 0)
|
||||
|
|
|
@ -314,7 +314,7 @@ static inline int32_t calc_smoothratio(ClockTicks totalclk, ClockTicks ototalclk
|
|||
if (!(((!g_netServer && ud.multimode < 2) && ((g_player[myconnectindex].ps->gm & MODE_MENU) == 0)) ||
|
||||
(g_netServer || ud.multimode > 1) ||
|
||||
ud.recstat == 2) ||
|
||||
ud.pause_on)
|
||||
paused)
|
||||
{
|
||||
return 65536;
|
||||
}
|
||||
|
|
|
@ -2093,7 +2093,7 @@ void P_DisplayWeapon(void)
|
|||
if (!RR && currentWeapon == KNEE_WEAPON && *weaponFrame == 0)
|
||||
goto enddisplayweapon;
|
||||
|
||||
int const doAnim = !(sprite[pPlayer->i].pal == 1 || ud.pause_on || g_player[myconnectindex].ps->gm & MODE_MENU);
|
||||
int const doAnim = !(sprite[pPlayer->i].pal == 1 || paused || g_player[myconnectindex].ps->gm & MODE_MENU);
|
||||
int const halfLookAng = fix16_to_int(pPlayer->q16look_ang) >> 1;
|
||||
|
||||
int const weaponPal = P_GetHudPal(pPlayer);
|
||||
|
@ -3209,7 +3209,15 @@ void P_GetInput(int const playerNum)
|
|||
auto const pSprite = &sprite[pPlayer->i];
|
||||
ControlInfo info;
|
||||
|
||||
if ((pPlayer->gm & (MODE_MENU|MODE_TYPE)) || (ud.pause_on && !inputState.GetKeyStatus(sc_Pause)))
|
||||
auto const currentHiTicks = timerGetHiTicks();
|
||||
double const elapsedInputTicks = currentHiTicks - thisPlayer.lastInputTicks;
|
||||
|
||||
thisPlayer.lastInputTicks = currentHiTicks;
|
||||
|
||||
if (elapsedInputTicks == currentHiTicks)
|
||||
return;
|
||||
|
||||
if ((pPlayer->gm & (MODE_MENU|MODE_TYPE)) || paused)
|
||||
{
|
||||
if (!(pPlayer->gm&MODE_MENU))
|
||||
CONTROL_GetInput(&info);
|
||||
|
@ -3272,14 +3280,6 @@ void P_GetInput(int const playerNum)
|
|||
input.svel -= info.dx * keyMove / analogExtent;
|
||||
input.fvel -= info.dz * keyMove / analogExtent;
|
||||
|
||||
auto const currentHiTicks = timerGetHiTicks();
|
||||
double const elapsedInputTicks = currentHiTicks - thisPlayer.lastInputTicks;
|
||||
|
||||
thisPlayer.lastInputTicks = currentHiTicks;
|
||||
|
||||
if (elapsedInputTicks == currentHiTicks)
|
||||
return;
|
||||
|
||||
auto scaleAdjustmentToInterval = [=](double x) { return x * REALGAMETICSPERSEC / (1000.0 / elapsedInputTicks); };
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Strafe))
|
||||
|
@ -3631,7 +3631,15 @@ void P_GetInputMotorcycle(int playerNum)
|
|||
auto const pSprite = &sprite[pPlayer->i];
|
||||
ControlInfo info;
|
||||
|
||||
if ((pPlayer->gm & (MODE_MENU|MODE_TYPE)) || (ud.pause_on && !inputState.GetKeyStatus(sc_Pause)))
|
||||
auto const currentHiTicks = timerGetHiTicks();
|
||||
double const elapsedInputTicks = currentHiTicks - thisPlayer.lastInputTicks;
|
||||
|
||||
thisPlayer.lastInputTicks = currentHiTicks;
|
||||
|
||||
if (elapsedInputTicks == currentHiTicks)
|
||||
return;
|
||||
|
||||
if ((pPlayer->gm & (MODE_MENU|MODE_TYPE)) || paused)
|
||||
{
|
||||
if (!(pPlayer->gm&MODE_MENU))
|
||||
CONTROL_GetInput(&info);
|
||||
|
@ -3670,14 +3678,6 @@ void P_GetInputMotorcycle(int playerNum)
|
|||
input.svel -= info.dx * keyMove / analogExtent;
|
||||
input.fvel -= info.dz * keyMove / analogExtent;
|
||||
|
||||
auto const currentHiTicks = timerGetHiTicks();
|
||||
double const elapsedInputTicks = currentHiTicks - thisPlayer.lastInputTicks;
|
||||
|
||||
thisPlayer.lastInputTicks = currentHiTicks;
|
||||
|
||||
if (elapsedInputTicks == currentHiTicks)
|
||||
return;
|
||||
|
||||
auto scaleAdjustmentToInterval = [=](double x) { return x * REALGAMETICSPERSEC / (1000.0 / elapsedInputTicks); };
|
||||
|
||||
pPlayer->crouch_toggle = 0;
|
||||
|
@ -3885,7 +3885,15 @@ void P_GetInputBoat(int playerNum)
|
|||
auto const pSprite = &sprite[pPlayer->i];
|
||||
ControlInfo info;
|
||||
|
||||
if ((pPlayer->gm & (MODE_MENU|MODE_TYPE)) || (ud.pause_on && !inputState.GetKeyStatus(sc_Pause)))
|
||||
auto const currentHiTicks = timerGetHiTicks();
|
||||
double const elapsedInputTicks = currentHiTicks - thisPlayer.lastInputTicks;
|
||||
|
||||
thisPlayer.lastInputTicks = currentHiTicks;
|
||||
|
||||
if (elapsedInputTicks == currentHiTicks)
|
||||
return;
|
||||
|
||||
if ((pPlayer->gm & (MODE_MENU|MODE_TYPE)) || paused)
|
||||
{
|
||||
if (!(pPlayer->gm&MODE_MENU))
|
||||
CONTROL_GetInput(&info);
|
||||
|
@ -3924,14 +3932,6 @@ void P_GetInputBoat(int playerNum)
|
|||
input.svel -= info.dx * keyMove / analogExtent;
|
||||
input.fvel -= info.dz * keyMove / analogExtent;
|
||||
|
||||
auto const currentHiTicks = timerGetHiTicks();
|
||||
double const elapsedInputTicks = currentHiTicks - thisPlayer.lastInputTicks;
|
||||
|
||||
thisPlayer.lastInputTicks = currentHiTicks;
|
||||
|
||||
if (elapsedInputTicks == currentHiTicks)
|
||||
return;
|
||||
|
||||
auto scaleAdjustmentToInterval = [=](double x) { return x * REALGAMETICSPERSEC / (1000.0 / elapsedInputTicks); };
|
||||
|
||||
pPlayer->crouch_toggle = 0;
|
||||
|
@ -4134,7 +4134,15 @@ void P_DHGetInput(int const playerNum)
|
|||
auto const pSprite = &sprite[pPlayer->i];
|
||||
ControlInfo info;
|
||||
|
||||
if ((pPlayer->gm & (MODE_MENU|MODE_TYPE)) || (ud.pause_on && !inputState.GetKeyStatus(sc_Pause)))
|
||||
auto const currentHiTicks = timerGetHiTicks();
|
||||
double const elapsedInputTicks = currentHiTicks - thisPlayer.lastInputTicks;
|
||||
|
||||
thisPlayer.lastInputTicks = currentHiTicks;
|
||||
|
||||
if (elapsedInputTicks == currentHiTicks)
|
||||
return;
|
||||
|
||||
if ((pPlayer->gm & (MODE_MENU|MODE_TYPE)) || paused)
|
||||
{
|
||||
if (!(pPlayer->gm&MODE_MENU))
|
||||
CONTROL_GetInput(&info);
|
||||
|
@ -4189,14 +4197,6 @@ void P_DHGetInput(int const playerNum)
|
|||
input.svel -= info.dx * keyMove / analogExtent;
|
||||
input.fvel -= info.dz * keyMove / analogExtent;
|
||||
|
||||
auto const currentHiTicks = timerGetHiTicks();
|
||||
double const elapsedInputTicks = currentHiTicks - thisPlayer.lastInputTicks;
|
||||
|
||||
thisPlayer.lastInputTicks = currentHiTicks;
|
||||
|
||||
if (elapsedInputTicks == currentHiTicks)
|
||||
return;
|
||||
|
||||
auto scaleAdjustmentToInterval = [=](double x) { return x * REALGAMETICSPERSEC / (1000.0 / elapsedInputTicks); };
|
||||
|
||||
if (buttonMap.ButtonDown(gamefunc_Strafe))
|
||||
|
|
|
@ -1154,7 +1154,7 @@ static void resetprestat(int playerNum, int gameMode)
|
|||
g_animateCnt = 0;
|
||||
parallaxtype = 0;
|
||||
randomseed = 17;
|
||||
ud.pause_on = 0;
|
||||
paused = 0;
|
||||
ud.camerasprite = -1;
|
||||
ud.eog = 0;
|
||||
tempwallptr = 0;
|
||||
|
@ -2293,7 +2293,7 @@ int G_EnterLevel(int gameMode)
|
|||
|
||||
//if (g_networkMode != NET_DEDICATED_SERVER)
|
||||
{
|
||||
S_PauseSounds(false);
|
||||
S_ResumeSound(false);
|
||||
FX_StopAllSounds();
|
||||
S_ClearSoundLocks();
|
||||
FX_SetReverb(0);
|
||||
|
|
|
@ -183,7 +183,7 @@ int32_t G_LoadPlayer(const char *path)
|
|||
|
||||
// some setup first
|
||||
ud.multimode = h.numplayers;
|
||||
S_PauseSounds(true);
|
||||
S_PauseSound(true, false);
|
||||
|
||||
if (numplayers > 1)
|
||||
{
|
||||
|
@ -834,7 +834,7 @@ static const dataspec_t svgm_udnetw[] =
|
|||
{ DS_NOCHK, &ud.ffire, sizeof(ud.ffire), 1 },
|
||||
{ DS_NOCHK, &ud.noexits, sizeof(ud.noexits), 1 },
|
||||
{ DS_NOCHK, &ud.playerai, sizeof(ud.playerai), 1 },
|
||||
{ 0, &ud.pause_on, sizeof(ud.pause_on), 1 },
|
||||
{ 0, &paused, sizeof(paused), 1 },
|
||||
{ 0, connectpoint2, sizeof(connectpoint2), 1 },
|
||||
{ 0, &randomseed, sizeof(randomseed), 1 },
|
||||
{ 0, &g_globalRandom, sizeof(g_globalRandom), 1 },
|
||||
|
|
|
@ -765,7 +765,7 @@ void G_DisplayRest(int32_t smoothratio)
|
|||
|
||||
if (ud.scrollmode == 0)
|
||||
{
|
||||
if (pp->newowner == -1 && !ud.pause_on)
|
||||
if (pp->newowner == -1 && !paused)
|
||||
{
|
||||
if (screenpeek == myconnectindex && numplayers > 1)
|
||||
{
|
||||
|
@ -789,7 +789,7 @@ void G_DisplayRest(int32_t smoothratio)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!ud.pause_on)
|
||||
if (!paused)
|
||||
{
|
||||
ud.fola += ud.folavel>>3;
|
||||
ud.folx += (ud.folfvel*sintable[(512+2048-ud.fola)&2047])>>14;
|
||||
|
@ -869,10 +869,10 @@ void G_DisplayRest(int32_t smoothratio)
|
|||
}
|
||||
*/
|
||||
|
||||
if (ud.pause_on==1 && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0)
|
||||
if (paused==1 && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0)
|
||||
menutext_center(100, GStrings("Game Paused"));
|
||||
|
||||
mdpause = (ud.pause_on || (ud.recstat==2 && (g_demo_paused && g_demo_goalCnt==0)) || (g_player[myconnectindex].ps->gm&MODE_MENU && numplayers < 2));
|
||||
mdpause = (paused || (ud.recstat==2 && (g_demo_paused && g_demo_goalCnt==0)) || (g_player[myconnectindex].ps->gm&MODE_MENU && numplayers < 2));
|
||||
|
||||
// JBF 20040124: display level stats in screen corner
|
||||
if (ud.overhead_on != 2 && hud_stats) // && VM_OnEvent(EVENT_DISPLAYLEVELSTATS, g_player[screenpeek].ps->i, screenpeek) == 0)
|
||||
|
|
|
@ -3648,29 +3648,7 @@ void P_HandleSharedKeys(int playerNum)
|
|||
{
|
||||
pPlayer->interface_toggle_flag = 1;
|
||||
|
||||
if (TEST_SYNC_KEY(playerBits, SK_PAUSE))
|
||||
{
|
||||
inputState.ClearKeyStatus(sc_Pause);
|
||||
if (ud.pause_on)
|
||||
ud.pause_on = 0;
|
||||
else ud.pause_on = 1+SHIFTS_IS_PRESSED;
|
||||
if (ud.pause_on)
|
||||
{
|
||||
Mus_SetPaused(true);
|
||||
S_PauseSounds(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Mus_SetPaused(false);
|
||||
|
||||
S_PauseSounds(false);
|
||||
|
||||
pub = NUMPAGES;
|
||||
pus = NUMPAGES;
|
||||
}
|
||||
}
|
||||
|
||||
if (ud.pause_on) return;
|
||||
if (paused) return;
|
||||
|
||||
if (sprite[pPlayer->i].extra <= 0) return; // if dead...
|
||||
|
||||
|
|
|
@ -79,17 +79,6 @@ TArray<uint8_t> DukeSoundEngine::ReadSound(int lumpnum)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void S_PauseSounds(bool paused)
|
||||
{
|
||||
soundEngine->SetPaused(paused);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void cacheAllSounds(void)
|
||||
{
|
||||
auto& sfx = soundEngine->GetSounds();
|
||||
|
|
|
@ -57,8 +57,6 @@ inline int S_CheckSoundPlaying(int sprnum, int soundNum) { return S_CheckSoundPl
|
|||
inline void S_ClearSoundLocks(void) {}
|
||||
void cacheAllSounds(void);
|
||||
void S_MenuSound(void);
|
||||
void S_PauseMusic(bool paused);
|
||||
void S_PauseSounds(bool paused);
|
||||
void S_PlayLevelMusicOrNothing(unsigned int);
|
||||
int S_TryPlaySpecialMusic(unsigned int);
|
||||
void S_PlaySpecialMusicOrNothing(unsigned int);
|
||||
|
|
Loading…
Reference in a new issue