mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-31 12:30:40 +00:00
Pause and resume sounds instead of just stopping them when opening menus or pausing the game.
git-svn-id: https://svn.eduke32.com/eduke32@5606 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
0edf078f0c
commit
ea997707a1
4 changed files with 35 additions and 20 deletions
|
@ -3787,15 +3787,14 @@ void G_DisplayRest(int32_t smoothratio)
|
||||||
I_EscapeTriggerClear();
|
I_EscapeTriggerClear();
|
||||||
S_PlaySound(EXITMENUSOUND);
|
S_PlaySound(EXITMENUSOUND);
|
||||||
M_ChangeMenu(MENU_CLOSE);
|
M_ChangeMenu(MENU_CLOSE);
|
||||||
|
S_PauseSounds(0);
|
||||||
}
|
}
|
||||||
else if ((g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU &&
|
else if ((g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU &&
|
||||||
g_player[myconnectindex].ps->newowner == -1 &&
|
g_player[myconnectindex].ps->newowner == -1 &&
|
||||||
(g_player[myconnectindex].ps->gm&MODE_TYPE) != MODE_TYPE)
|
(g_player[myconnectindex].ps->gm&MODE_TYPE) != MODE_TYPE)
|
||||||
{
|
{
|
||||||
I_EscapeTriggerClear();
|
I_EscapeTriggerClear();
|
||||||
FX_StopAllSounds();
|
S_PauseSounds(1);
|
||||||
S_ClearSoundLocks();
|
|
||||||
|
|
||||||
S_MenuSound();
|
S_MenuSound();
|
||||||
|
|
||||||
M_OpenMenu(myconnectindex);
|
M_OpenMenu(myconnectindex);
|
||||||
|
@ -9031,9 +9030,8 @@ void G_HandleLocalKeys(void)
|
||||||
{
|
{
|
||||||
KB_ClearKeyDown(sc_F1);
|
KB_ClearKeyDown(sc_F1);
|
||||||
M_ChangeMenu(MENU_STORY);
|
M_ChangeMenu(MENU_STORY);
|
||||||
FX_StopAllSounds();
|
|
||||||
S_ClearSoundLocks();
|
|
||||||
|
|
||||||
|
S_PauseSounds(1);
|
||||||
M_OpenMenu(myconnectindex);
|
M_OpenMenu(myconnectindex);
|
||||||
|
|
||||||
if ((!g_netServer && ud.multimode < 2))
|
if ((!g_netServer && ud.multimode < 2))
|
||||||
|
@ -9083,8 +9081,7 @@ FAKE_F2:
|
||||||
G_DrawRooms(myconnectindex,65536);
|
G_DrawRooms(myconnectindex,65536);
|
||||||
g_screenCapture = 0;
|
g_screenCapture = 0;
|
||||||
|
|
||||||
FX_StopAllSounds();
|
S_PauseSounds(1);
|
||||||
S_ClearSoundLocks();
|
|
||||||
|
|
||||||
// setview(0,0,xdim-1,ydim-1);
|
// setview(0,0,xdim-1,ydim-1);
|
||||||
M_OpenMenu(myconnectindex);
|
M_OpenMenu(myconnectindex);
|
||||||
|
@ -9103,8 +9100,8 @@ FAKE_F2:
|
||||||
|
|
||||||
FAKE_F3:
|
FAKE_F3:
|
||||||
M_ChangeMenu(MENU_LOAD);
|
M_ChangeMenu(MENU_LOAD);
|
||||||
FX_StopAllSounds();
|
|
||||||
S_ClearSoundLocks();
|
S_PauseSounds(1);
|
||||||
|
|
||||||
// setview(0,0,xdim-1,ydim-1);
|
// setview(0,0,xdim-1,ydim-1);
|
||||||
M_OpenMenu(myconnectindex);
|
M_OpenMenu(myconnectindex);
|
||||||
|
@ -9120,8 +9117,7 @@ FAKE_F3:
|
||||||
if (KB_UnBoundKeyPressed(sc_F4))
|
if (KB_UnBoundKeyPressed(sc_F4))
|
||||||
{
|
{
|
||||||
KB_ClearKeyDown(sc_F4);
|
KB_ClearKeyDown(sc_F4);
|
||||||
FX_StopAllSounds();
|
S_PauseSounds(1);
|
||||||
S_ClearSoundLocks();
|
|
||||||
|
|
||||||
M_OpenMenu(myconnectindex);
|
M_OpenMenu(myconnectindex);
|
||||||
if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2)
|
if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2)
|
||||||
|
@ -9218,9 +9214,7 @@ FAKE_F3:
|
||||||
{
|
{
|
||||||
KB_FlushKeyboardQueue();
|
KB_FlushKeyboardQueue();
|
||||||
KB_ClearKeysDown();
|
KB_ClearKeysDown();
|
||||||
FX_StopAllSounds();
|
S_PauseSounds(1);
|
||||||
S_ClearSoundLocks();
|
|
||||||
|
|
||||||
G_LoadPlayerMaybeMulti(g_lastSaveSlot);
|
G_LoadPlayerMaybeMulti(g_lastSaveSlot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9229,8 +9223,7 @@ FAKE_F3:
|
||||||
{
|
{
|
||||||
KB_ClearKeyDown(sc_F10);
|
KB_ClearKeyDown(sc_F10);
|
||||||
M_ChangeMenu(MENU_QUIT_INGAME);
|
M_ChangeMenu(MENU_QUIT_INGAME);
|
||||||
FX_StopAllSounds();
|
S_PauseSounds(1);
|
||||||
S_ClearSoundLocks();
|
|
||||||
M_OpenMenu(myconnectindex);
|
M_OpenMenu(myconnectindex);
|
||||||
if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2)
|
if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2)
|
||||||
{
|
{
|
||||||
|
@ -9243,8 +9236,7 @@ FAKE_F3:
|
||||||
{
|
{
|
||||||
KB_ClearKeyDown(sc_F11);
|
KB_ClearKeyDown(sc_F11);
|
||||||
M_ChangeMenu(MENU_COLCORR_INGAME);
|
M_ChangeMenu(MENU_COLCORR_INGAME);
|
||||||
FX_StopAllSounds();
|
S_PauseSounds(1);
|
||||||
S_ClearSoundLocks();
|
|
||||||
M_OpenMenu(myconnectindex);
|
M_OpenMenu(myconnectindex);
|
||||||
if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2)
|
if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2461,12 +2461,14 @@ void P_HandleSharedKeys(int32_t snum)
|
||||||
if (ud.pause_on)
|
if (ud.pause_on)
|
||||||
{
|
{
|
||||||
S_PauseMusic(1);
|
S_PauseMusic(1);
|
||||||
FX_StopAllSounds();
|
S_PauseSounds(1);
|
||||||
S_ClearSoundLocks();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (ud.config.MusicToggle) S_PauseMusic(0);
|
if (ud.config.MusicToggle) S_PauseMusic(0);
|
||||||
|
|
||||||
|
S_PauseSounds(0);
|
||||||
|
|
||||||
pub = NUMPAGES;
|
pub = NUMPAGES;
|
||||||
pus = NUMPAGES;
|
pus = NUMPAGES;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,7 @@ static int32_t MusicIsWaveform = 0;
|
||||||
static char *MusicPtr = NULL;
|
static char *MusicPtr = NULL;
|
||||||
static int32_t MusicVoice = -1;
|
static int32_t MusicVoice = -1;
|
||||||
static int32_t MusicPaused = 0;
|
static int32_t MusicPaused = 0;
|
||||||
|
static int32_t SoundPaused = 0;
|
||||||
|
|
||||||
static mutex_t s_mutex;
|
static mutex_t s_mutex;
|
||||||
static volatile uint32_t dq[DQSIZE], dnum = 0;
|
static volatile uint32_t dq[DQSIZE], dnum = 0;
|
||||||
|
@ -148,6 +149,25 @@ void S_PauseMusic(int32_t onf)
|
||||||
MUSIC_Continue();
|
MUSIC_Continue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void S_PauseSounds(int32_t onf)
|
||||||
|
{
|
||||||
|
if (SoundPaused == onf)
|
||||||
|
return;
|
||||||
|
|
||||||
|
SoundPaused = onf;
|
||||||
|
|
||||||
|
for (int i=0; i<g_maxSoundPos; ++i)
|
||||||
|
{
|
||||||
|
for (int j = 0; j<MAXSOUNDINSTANCES; ++j)
|
||||||
|
{
|
||||||
|
if (g_sounds[i].SoundOwner[j].voice > 0)
|
||||||
|
FX_PauseVoice(g_sounds[i].SoundOwner[j].voice, onf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void S_MusicVolume(int32_t volume)
|
void S_MusicVolume(int32_t volume)
|
||||||
{
|
{
|
||||||
if (MusicIsWaveform && MusicVoice >= 0)
|
if (MusicIsWaveform && MusicVoice >= 0)
|
||||||
|
|
|
@ -95,6 +95,7 @@ void S_MusicStartup(void);
|
||||||
void S_MusicVolume(int32_t volume);
|
void S_MusicVolume(int32_t volume);
|
||||||
void S_RestartMusic(void);
|
void S_RestartMusic(void);
|
||||||
void S_PauseMusic(int32_t onf);
|
void S_PauseMusic(int32_t onf);
|
||||||
|
void S_PauseSounds(int32_t onf);
|
||||||
int32_t S_PlayMusic(const char *fn);
|
int32_t S_PlayMusic(const char *fn);
|
||||||
int32_t S_PlaySound(int32_t num);
|
int32_t S_PlaySound(int32_t num);
|
||||||
int32_t S_PlaySound3D(int32_t num,int32_t i,const vec3_t *pos);
|
int32_t S_PlaySound3D(int32_t num,int32_t i,const vec3_t *pos);
|
||||||
|
|
Loading…
Reference in a new issue