From 372f0db28a2fa1ef315a9acb901eeb1f3141358a Mon Sep 17 00:00:00 2001
From: Mitchell Richters <mjr4077au@gmail.com>
Date: Sun, 11 Oct 2020 22:01:27 +1100
Subject: [PATCH] - Exhumed: Resolve sound issues following bad merge conflict
 resolve from b06a847d9af9df83e88657b3773ee6d96c4edab2.

---
 source/exhumed/src/sound.cpp | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/source/exhumed/src/sound.cpp b/source/exhumed/src/sound.cpp
index 480690e3d..ce7d35893 100644
--- a/source/exhumed/src/sound.cpp
+++ b/source/exhumed/src/sound.cpp
@@ -191,17 +191,22 @@ 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.
-            loops = true;
+            looped[retval] = true;
         }
-		int retval = soundEngine->AddSoundLump(nname, lump, -1, 6);
-        soundEngine->CacheSound(retval);
-		looped[retval-1] = loops;
-        return retval - 1;
+        auto& newsfx = S_sfx.Last();
+        newsfx.name = nname;
+        newsfx.lumpnum = lump;
+        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
     {