diff --git a/source/common/audio/sound/s_sound.cpp b/source/common/audio/sound/s_sound.cpp index 550924854..269a49133 100644 --- a/source/common/audio/sound/s_sound.cpp +++ b/source/common/audio/sound/s_sound.cpp @@ -1536,6 +1536,7 @@ int SoundEngine::AddSoundLump(const char* logicalname, int lump, int CurrentPitc newsfx.PitchMask = CurrentPitchMask; newsfx.NearLimit = nearlimit; newsfx.ResourceId = resid; + newsfx.bTentative = false; if (resid >= 0) ResIdMap[resid] = S_sfx.Size() - 1; return (int)S_sfx.Size()-1; diff --git a/source/common/thirdparty/m_crc32.h b/source/common/thirdparty/m_crc32.h index 079bffec4..2930b8cbd 100644 --- a/source/common/thirdparty/m_crc32.h +++ b/source/common/thirdparty/m_crc32.h @@ -31,7 +31,7 @@ **--------------------------------------------------------------------------- ** */ - +#pragma once #include #include diff --git a/source/exhumed/src/sound.cpp b/source/exhumed/src/sound.cpp index ce7d35893..be7ac5b63 100644 --- a/source/exhumed/src/sound.cpp +++ b/source/exhumed/src/sound.cpp @@ -191,22 +191,17 @@ int LoadSound(const char* name) auto lump = S_LookupSound(filename); if (lump > 0) { - auto &S_sfx = soundEngine->GetSounds(); - S_sfx.Reserve(1); - int retval = S_sfx.Size() - 2; auto check = fileSystem.GetFileData(lump); + bool loops = false; if (check.Size() > 26 && check[26] == 6 && !memcmp("Creative Voice File", check.Data(), 19)) { // This game uses the actual loop point information in the sound data as its only means to check if a sound is looped. - looped[retval] = true; + loops = true; } - auto& newsfx = S_sfx.Last(); - newsfx.name = nname; - newsfx.lumpnum = lump; - newsfx.NearLimit = 6; - newsfx.bTentative = false; - soundEngine->CacheSound(retval + 1); - return retval; + int retval = soundEngine->AddSoundLump(nname, lump, 0, -1, 6); + soundEngine->CacheSound(retval); + looped[retval-1] = loops; + return retval - 1; } else if (!ISDEMOVER) // demo tries to load sound files it doesn't have {