diff --git a/Source/effects_stubs.cpp b/Source/effects_stubs.cpp index eb14d8b12..2c68ebbc8 100644 --- a/Source/effects_stubs.cpp +++ b/Source/effects_stubs.cpp @@ -1,6 +1,8 @@ // Stubbed implementations of effects for the NOSOUND mode. #include "effects.h" +#include "engine/random.hpp" + namespace devilution { int sfxdelay; _sfx_id sfxdnum; @@ -13,8 +15,38 @@ void stream_stop() { } void InitMonsterSND(int monst) { } void FreeMonsterSnd() { } bool CalculateSoundPosition(Point soundPosition, int *plVolume, int *plPan) { return false; } -void PlaySFX(_sfx_id psfx) { } -void PlaySfxLoc(_sfx_id psfx, Point position, bool randomizeByCategory) { } +void PlaySFX(_sfx_id psfx) +{ + switch (psfx) { + case PS_WARR69: + case PS_MAGE69: + case PS_ROGUE69: + case PS_MONK69: + case PS_SWING: + case LS_ACID: + case IS_FMAG: + case IS_MAGIC: + case IS_BHIT: + case PS_WARR14: + case PS_WARR15: + case PS_WARR16: + case PS_WARR2: + case PS_ROGUE14: + case PS_MAGE14: + case PS_MONK14: + AdvanceRndSeed(); + break; + default: + break; + } +} +void PlaySfxLoc(_sfx_id psfx, Point position, bool randomizeByCategory) +{ + if (!randomizeByCategory) + return; + + PlaySFX(psfx); +} void sound_stop() { } void sound_update() { } void effects_cleanup_sfx() { } diff --git a/Source/items.cpp b/Source/items.cpp index b61fe8a06..3b7d86567 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -7,6 +7,9 @@ #include #include +#ifdef _DEBUG +#include +#endif #include #include diff --git a/Source/monster.cpp b/Source/monster.cpp index 37b9e77f8..6a484732e 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -4735,12 +4735,12 @@ void PrintUniqueHistory() void PlayEffect(MonsterStruct &monster, int mode) { -#ifndef NOSOUND if (Players[MyPlayerId].pLvlLoad != 0) { return; } int sndIdx = GenerateRnd(2); +#ifndef NOSOUND if (!gbSndInited || !gbSoundOn || gbBufferMsgs != 0) { return; } diff --git a/Source/sound_stubs.cpp b/Source/sound_stubs.cpp index a35057c6a..43454e686 100644 --- a/Source/sound_stubs.cpp +++ b/Source/sound_stubs.cpp @@ -11,10 +11,8 @@ bool gbSoundOn; // AllowShortFunctionsOnASingleLine: None // clang-format off void ClearDuplicateSounds() { } -void snd_stop_snd(TSnd *pSnd) { } void snd_play_snd(TSnd *pSnd, int lVolume, int lPan) { } std::unique_ptr sound_file_load(const char *path, bool stream) { return nullptr; } -void sound_file_cleanup(TSnd *sound_file) { } void snd_init() { } void snd_deinit() { } void music_stop() { }