mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 17:01:28 +00:00
Prepare back-end for updated in-game pausing.
This commit is contained in:
parent
804a2964a0
commit
7ed9f4fa8c
3 changed files with 81 additions and 17 deletions
|
@ -167,9 +167,9 @@ static bool S_StartMusicPlaying(ZMusic_MusicStream song, bool loop, float rel_vo
|
|||
|
||||
//==========================================================================
|
||||
//
|
||||
// S_PauseSound
|
||||
// S_PauseMusic
|
||||
//
|
||||
// Stop music and sound effects, during game PAUSE.
|
||||
// Stop music, during game PAUSE.
|
||||
//==========================================================================
|
||||
|
||||
void S_PauseMusic ()
|
||||
|
@ -184,9 +184,9 @@ void S_PauseMusic ()
|
|||
|
||||
//==========================================================================
|
||||
//
|
||||
// S_ResumeSound
|
||||
// S_ResumeMusic
|
||||
//
|
||||
// Resume music and sound effects, after game PAUSE.
|
||||
// Resume music, after game PAUSE.
|
||||
//==========================================================================
|
||||
|
||||
void S_ResumeMusic ()
|
||||
|
@ -682,3 +682,5 @@ CCMD(currentmusic)
|
|||
Printf("Currently no music playing\n");
|
||||
}
|
||||
}
|
||||
|
||||
extern int paused;
|
||||
|
|
|
@ -114,6 +114,9 @@ CVAR(Bool, disableautoload, false, CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALC
|
|||
|
||||
extern int hud_size_max;
|
||||
|
||||
int paused;
|
||||
bool pausedWithKey;
|
||||
|
||||
CUSTOM_CVAR(Int, cl_gender, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
{
|
||||
if (self < 0 || self > 3) self = 0;
|
||||
|
@ -826,6 +829,45 @@ CCMD(snd_reset)
|
|||
Mus_ResumeSaved();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// S_PauseSound
|
||||
//
|
||||
// Stop music and sound effects, during game PAUSE.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void S_PauseSound (bool notmusic, bool notsfx)
|
||||
{
|
||||
if (!notmusic)
|
||||
{
|
||||
S_PauseMusic();
|
||||
}
|
||||
if (!notsfx)
|
||||
{
|
||||
soundEngine->SetPaused(true);
|
||||
GSnd->SetSfxPaused (true, 0);
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// S_ResumeSound
|
||||
//
|
||||
// Resume music and sound effects, after game PAUSE.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void S_ResumeSound (bool notsfx)
|
||||
{
|
||||
S_ResumeMusic();
|
||||
if (!notsfx)
|
||||
{
|
||||
soundEngine->SetPaused(false);
|
||||
GSnd->SetSfxPaused (false, 0);
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// S_SetSoundPaused
|
||||
|
@ -836,7 +878,6 @@ CCMD(snd_reset)
|
|||
|
||||
void S_SetSoundPaused(int state)
|
||||
{
|
||||
#if 0
|
||||
if (state)
|
||||
{
|
||||
if (paused == 0)
|
||||
|
@ -855,21 +896,10 @@ void S_SetSoundPaused(int state)
|
|||
S_PauseSound(false, true);
|
||||
if (GSnd != nullptr)
|
||||
{
|
||||
GSnd->SetInactive(gamestate == GS_LEVEL || gamestate == GS_TITLELEVEL ?
|
||||
SoundRenderer::INACTIVE_Complete :
|
||||
SoundRenderer::INACTIVE_Mute);
|
||||
GSnd->SetInactive(SoundRenderer::INACTIVE_Complete);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!netgame
|
||||
#ifdef _DEBUG
|
||||
&& !demoplayback
|
||||
#endif
|
||||
)
|
||||
{
|
||||
pauseext = !state;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int CalcSmoothRatio(const ClockTicks &totalclk, const ClockTicks &ototalclk, int realgameticspersec)
|
||||
|
@ -940,3 +970,31 @@ bool CheckCheatmode(bool printmsg)
|
|||
return false;
|
||||
}
|
||||
|
||||
void updatePauseStatus()
|
||||
{
|
||||
if (M_Active() || GUICapture)
|
||||
{
|
||||
paused = 1;
|
||||
}
|
||||
else if ((!M_Active() || !GUICapture) && !pausedWithKey)
|
||||
{
|
||||
paused = 0;
|
||||
}
|
||||
|
||||
if (inputState.GetKeyStatus(sc_Pause))
|
||||
{
|
||||
inputState.ClearKeyStatus(sc_Pause);
|
||||
paused = !paused;
|
||||
|
||||
if (paused)
|
||||
{
|
||||
S_PauseSound(!paused, !paused);
|
||||
}
|
||||
else
|
||||
{
|
||||
S_ResumeSound(paused);
|
||||
}
|
||||
|
||||
pausedWithKey = paused;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -154,6 +154,8 @@ const char* G_DefaultConFile(void);
|
|||
const char* G_ConFile(void);
|
||||
|
||||
TArray<GrpEntry> GrpScan();
|
||||
void S_PauseSound(bool notmusic, bool notsfx);
|
||||
void S_ResumeSound(bool notsfx);
|
||||
void S_SetSoundPaused(int state);
|
||||
|
||||
void G_FatalEngineError(void);
|
||||
|
@ -182,3 +184,5 @@ enum
|
|||
PAUSESFX_CONSOLE = 2
|
||||
};
|
||||
|
||||
void updatePauseStatus();
|
||||
extern int paused;
|
||||
|
|
Loading…
Reference in a new issue