- WH: fixed sound playback in the menu

This commit is contained in:
Christoph Oelckers 2021-11-27 00:33:28 +01:00
parent c171ba38e7
commit de1e7b1336
3 changed files with 12 additions and 12 deletions

View file

@ -13,6 +13,7 @@
#include "cheathandler.h"
#include "screenjob_.h"
#include "vm.h"
#include "razemenu.h"
BEGIN_WH_NS
@ -783,19 +784,18 @@ void GameInterface::NewGame(MapRecord* map, int skill, bool)
void GameInterface::MenuSound(EMenuSounds snd)
{
if (!isWh2()) SND_Sound(85);
else SND_Sound(59);
if (!isWh2()) SND_Sound(85, CHAN_AUTO, CHANF_UI | CHANF_NOPAUSE);
else SND_Sound(59, CHAN_AUTO, CHANF_UI | CHANF_NOPAUSE);
}
void GameInterface::MenuOpened()
{
if (!isWh2()) SND_Sound(85);
else SND_Sound(59);
MenuSound(ActivateSound);
}
FSavegameInfo GameInterface::GetSaveSig()
{
return { SAVESIG_DN3D, MINSAVEVER_DN3D, SAVEVER_DN3D };
return { SAVESIG_WH, MINSAVEVER_WH, SAVEVER_WH };
}
void GameInterface::ToggleThirdPerson()

View file

@ -160,7 +160,7 @@ void GameInterface::UpdateSounds()
soundEngine->UpdateSounds(I_GetTime());
}
int playsound_internal(int sn, spritetype *spr, int x, int y, int loop, int chan)
int playsound_internal(int sn, spritetype *spr, int x, int y, int loop, int chan, int flags)
{
sn++;
if (!soundEngine->isValidSoundId(sn)) return -1;
@ -168,7 +168,7 @@ int playsound_internal(int sn, spritetype *spr, int x, int y, int loop, int chan
vec3_t pos = { x, y, 0 };
auto spos = GetSoundPos(&pos);
float attn = sourcetype == SOURCE_None ? ATTN_NONE : ATTN_NORM;
int flags = sourcetype == SOURCE_Unattached ? CHANF_LISTENERZ : CHANF_NONE;
flags |= sourcetype == SOURCE_Unattached ? CHANF_LISTENERZ : CHANF_NONE;
if (loop != 0) flags |= CHANF_LOOP;
auto sfx = soundEngine->StartSound(sourcetype, spr, &spos, chan, EChanFlags::FromInt(flags), sn, 1.f, attn);
if (!sfx) return -1;

View file

@ -468,14 +468,14 @@ void resetflash();
void applyflash();
int playsound_internal(int sn, spritetype* spr, int x, int y, int loop, int chan);
int playsound_internal(int sn, spritetype* spr, int x, int y, int loop, int chan, int flags = 0);
inline int playsound(int sn, int x, int y, int loop = 0, int channel = CHAN_AUTO) {
return playsound_internal(sn, nullptr, x, y, loop, channel);
inline int playsound(int sn, int x, int y, int loop = 0, int channel = CHAN_AUTO, int flags = 0) {
return playsound_internal(sn, nullptr, x, y, loop, channel, flags);
}
inline int SND_Sound(int sn) {
return playsound(sn, 0, 0);
inline int SND_Sound(int sn, int chan = CHAN_AUTO, int flags = 0) {
return playsound(sn, 0, 0, 0, chan, flags);
}
/*