- fixed the real issue for the sound problems and reverted the last commit.

It was far more serious than a botched merge.
This commit is contained in:
Christoph Oelckers 2020-10-11 13:36:42 +02:00
parent 5973391a51
commit 47e452f452
3 changed files with 8 additions and 12 deletions

View file

@ -1536,6 +1536,7 @@ int SoundEngine::AddSoundLump(const char* logicalname, int lump, int CurrentPitc
newsfx.PitchMask = CurrentPitchMask; newsfx.PitchMask = CurrentPitchMask;
newsfx.NearLimit = nearlimit; newsfx.NearLimit = nearlimit;
newsfx.ResourceId = resid; newsfx.ResourceId = resid;
newsfx.bTentative = false;
if (resid >= 0) ResIdMap[resid] = S_sfx.Size() - 1; if (resid >= 0) ResIdMap[resid] = S_sfx.Size() - 1;
return (int)S_sfx.Size()-1; return (int)S_sfx.Size()-1;

View file

@ -31,7 +31,7 @@
**--------------------------------------------------------------------------- **---------------------------------------------------------------------------
** **
*/ */
#pragma once
#include <zlib.h> #include <zlib.h>
#include <stdint.h> #include <stdint.h>

View file

@ -191,22 +191,17 @@ 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.
looped[retval] = true; loops = true;
} }
auto& newsfx = S_sfx.Last(); int retval = soundEngine->AddSoundLump(nname, lump, 0, -1, 6);
newsfx.name = nname; soundEngine->CacheSound(retval);
newsfx.lumpnum = lump; looped[retval-1] = loops;
newsfx.NearLimit = 6; return retval - 1;
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
{ {