- Exhumed: Resolve sound issues following bad merge conflict resolve from b06a847d9a.

This commit is contained in:
Mitchell Richters 2020-10-11 22:01:27 +11:00
parent adaf25377c
commit 372f0db28a

View file

@ -191,17 +191,22 @@ int LoadSound(const char* name)
auto lump = S_LookupSound(filename); auto lump = S_LookupSound(filename);
if (lump > 0) if (lump > 0)
{ {
auto &S_sfx = soundEngine->GetSounds();
S_sfx.Reserve(1);
int retval = S_sfx.Size() - 2;
auto check = fileSystem.GetFileData(lump); auto check = fileSystem.GetFileData(lump);
bool loops = false;
if (check.Size() > 26 && check[26] == 6 && !memcmp("Creative Voice File", check.Data(), 19)) 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. // This game uses the actual loop point information in the sound data as its only means to check if a sound is looped.
loops = true; looped[retval] = true;
} }
int retval = soundEngine->AddSoundLump(nname, lump, -1, 6); auto& newsfx = S_sfx.Last();
soundEngine->CacheSound(retval); newsfx.name = nname;
looped[retval-1] = loops; newsfx.lumpnum = lump;
return retval - 1; newsfx.NearLimit = 6;
newsfx.bTentative = false;
soundEngine->CacheSound(retval + 1);
return retval;
} }
else if (!ISDEMOVER) // demo tries to load sound files it doesn't have else if (!ISDEMOVER) // demo tries to load sound files it doesn't have
{ {