mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-31 04:20:42 +00:00
- Stop music when ending a level, or when going back to the menu in Blood. Also play the sound on Blood's summary screen as an UI sound.
Fixes #349
This commit is contained in:
parent
b4dd006a40
commit
a7b198d7ee
5 changed files with 8 additions and 4 deletions
|
@ -288,6 +288,7 @@ void GameInterface::DrawCenteredTextScreen(const DVector2& origin, const char* t
|
||||||
|
|
||||||
void GameInterface::QuitToTitle()
|
void GameInterface::QuitToTitle()
|
||||||
{
|
{
|
||||||
|
Mus_Stop();
|
||||||
gameaction = ga_mainmenu;
|
gameaction = ga_mainmenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -167,7 +167,7 @@ class DBloodSummaryScreen : public DScreenJob
|
||||||
void GameInterface::LevelCompleted(MapRecord *map, int skill)
|
void GameInterface::LevelCompleted(MapRecord *map, int skill)
|
||||||
{
|
{
|
||||||
JobDesc job = { Create<DBloodSummaryScreen>() };
|
JobDesc job = { Create<DBloodSummaryScreen>() };
|
||||||
sndStartSample(268, 128, -1, false);
|
sndStartSample(268, 128, -1, false, CHANF_UI);
|
||||||
RunScreenJob(&job, 1, [=](bool)
|
RunScreenJob(&job, 1, [=](bool)
|
||||||
{
|
{
|
||||||
soundEngine->StopAllChannels();
|
soundEngine->StopAllChannels();
|
||||||
|
|
|
@ -158,7 +158,7 @@ void sndStartSample(const char *pzSound, int nVolume, int nChannel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sndStartSample(unsigned int nSound, int nVolume, int nChannel, bool bLoop)
|
void sndStartSample(unsigned int nSound, int nVolume, int nChannel, bool bLoop, EChanFlags chanflags)
|
||||||
{
|
{
|
||||||
if (!SoundEnabled())
|
if (!SoundEnabled())
|
||||||
return;
|
return;
|
||||||
|
@ -173,7 +173,8 @@ void sndStartSample(unsigned int nSound, int nVolume, int nChannel, bool bLoop)
|
||||||
if (udata) nVolume = std::min(Scale(udata[2], 255, 100), 255);
|
if (udata) nVolume = std::min(Scale(udata[2], 255, 100), 255);
|
||||||
else nVolume = 255;
|
else nVolume = 255;
|
||||||
}
|
}
|
||||||
soundEngine->StartSound(SOURCE_None, nullptr, nullptr, (nChannel + 1), (bLoop? CHANF_LOOP : EChanFlags::FromInt(0)), snd, nVolume / 255.f, ATTN_NONE);
|
if (bLoop) chanflags |= CHANF_LOOP;
|
||||||
|
soundEngine->StartSound(SOURCE_None, nullptr, nullptr, (nChannel + 1), chanflags, snd, nVolume / 255.f, ATTN_NONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "raze_music.h"
|
#include "raze_music.h"
|
||||||
|
#include "s_soundinternal.h"
|
||||||
|
|
||||||
BEGIN_BLD_NS
|
BEGIN_BLD_NS
|
||||||
|
|
||||||
|
@ -45,7 +46,7 @@ struct SFX
|
||||||
|
|
||||||
int sndGetRate(int format);
|
int sndGetRate(int format);
|
||||||
void sndStartSample(const char *pzSound, int nVolume, int nChannel = -1);
|
void sndStartSample(const char *pzSound, int nVolume, int nChannel = -1);
|
||||||
void sndStartSample(unsigned int nSound, int nVolume, int nChannel = -1, bool bLoop = false);
|
void sndStartSample(unsigned int nSound, int nVolume, int nChannel = -1, bool bLoop = false, EChanFlags soundflags = CHANF_NONE);
|
||||||
void sndStartWavID(unsigned int nSound, int nVolume, int nChannel = -1);
|
void sndStartWavID(unsigned int nSound, int nVolume, int nChannel = -1);
|
||||||
void sndStartWavDisk(const char *pzFile, int nVolume, int nChannel = -1);
|
void sndStartWavDisk(const char *pzFile, int nVolume, int nChannel = -1);
|
||||||
void sndKillAllSounds(void);
|
void sndKillAllSounds(void);
|
||||||
|
|
|
@ -147,6 +147,7 @@ static void GameTicker()
|
||||||
case ga_completed:
|
case ga_completed:
|
||||||
FX_StopAllSounds();
|
FX_StopAllSounds();
|
||||||
FX_SetReverb(0);
|
FX_SetReverb(0);
|
||||||
|
Mus_Stop();
|
||||||
if (g_nextmap == currentLevel)
|
if (g_nextmap == currentLevel)
|
||||||
{
|
{
|
||||||
// if the same level is restarted, skip any progression stuff like summary screens or cutscenes.
|
// if the same level is restarted, skip any progression stuff like summary screens or cutscenes.
|
||||||
|
|
Loading…
Reference in a new issue