From de1e7b13365f2b531c394ab5a42f6951b19a29ff Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 27 Nov 2021 00:33:28 +0100 Subject: [PATCH] - WH: fixed sound playback in the menu --- source/games/whaven/src/main.cpp | 10 +++++----- source/games/whaven/src/sound.cpp | 4 ++-- source/games/whaven/src/wh.h | 10 +++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/source/games/whaven/src/main.cpp b/source/games/whaven/src/main.cpp index b717722b0..b21c60820 100644 --- a/source/games/whaven/src/main.cpp +++ b/source/games/whaven/src/main.cpp @@ -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() diff --git a/source/games/whaven/src/sound.cpp b/source/games/whaven/src/sound.cpp index 26fc34ac2..af0baed43 100644 --- a/source/games/whaven/src/sound.cpp +++ b/source/games/whaven/src/sound.cpp @@ -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; diff --git a/source/games/whaven/src/wh.h b/source/games/whaven/src/wh.h index fdb949156..3af0edf20 100644 --- a/source/games/whaven/src/wh.h +++ b/source/games/whaven/src/wh.h @@ -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); } /*