- fix sound and music pausing with tweaks to updatePauseStatus(). Also removed unneeded game-side function. Fixes #11.

This commit is contained in:
Mitchell Richters 2020-07-26 17:20:53 +10:00
parent c7a9b5678b
commit f67a53a7c0
5 changed files with 13 additions and 35 deletions

View file

@ -1102,33 +1102,26 @@ bool CheckCheatmode(bool printmsg)
void updatePauseStatus()
{
bool GUICapture = System_WantGuiCapture();
if (M_Active() || ConsoleState != c_up)
if (M_Active() || System_WantGuiCapture())
{
paused = 1;
return;
}
else if (!pausedWithKey)
else if (!M_Active() || !System_WantGuiCapture())
{
paused = 0;
}
if (inputState.GetKeyStatus(sc_Pause))
{
inputState.ClearKeyStatus(sc_Pause);
paused = pausedWithKey ? 0 : 2;
if (paused)
if (!pausedWithKey)
{
S_PauseSound(!paused, !paused);
}
else
{
S_ResumeSound(!!paused);
paused = 0;
}
pausedWithKey = !!paused;
if (inputState.GetKeyStatus(sc_Pause))
{
inputState.ClearKeyStatus(sc_Pause);
paused = pausedWithKey ? 0 : 2;
pausedWithKey = !!paused;
}
}
paused ? S_PauseSound(!pausedWithKey, !paused) : S_ResumeSound(paused);
}
bool OkForLocalization(FTextureID texnum, const char* substitute)

View file

@ -215,7 +215,6 @@ void GameInterface::DrawNativeMenuText(int fontnum, int state, double oxpos, dou
void GameInterface::MenuOpened()
{
S_PauseSounds(true);
if (ud.multimode < 2)
{
ready2send = 0;
@ -263,8 +262,6 @@ void GameInterface::MenuClosed()
cameraclock = (int32_t)totalclock;
cameradist = 65536;
}
S_PauseSounds(false);
}
}

View file

@ -959,7 +959,7 @@ int enterlevel(MapRecord *mi, int gamemode)
OnEvent(EVENT_ENTERLEVEL);
// Stop all sounds
S_PauseSounds(false);
S_ResumeSound(false);
FX_StopAllSounds();
FX_SetReverb(0);

View file

@ -95,17 +95,6 @@ TArray<uint8_t> DukeSoundEngine::ReadSound(int lumpnum)
//
//==========================================================================
void S_PauseSounds(bool paused)
{
soundEngine->SetPaused(paused);
}
//==========================================================================
//
//
//
//==========================================================================
void S_CacheAllSounds(void)
{
auto& sfx = soundEngine->GetSounds();

View file

@ -52,7 +52,6 @@ inline int S_CheckSoundPlaying(int sprnum, int soundNum) { return S_CheckSoundPl
int S_CheckActorSoundPlaying(int spriteNum, int soundNum, int channel = 0);
int S_CheckAnyActorSoundPlaying(int spriteNum);
void S_PauseSounds(bool paused);
void S_ChangeSoundPitch(int soundNum, int spriteNum, int pitchoffset);
int S_GetUserFlags(int sndnum);