shithub: choc

Download patch

ref: 0a5d1795ce8fe46e20627f8a7b4ba348f2ec400e
parent: 2b2abd2561d40154a61f332bfd89edf3f21a87c5
author: Simon Howard <fraggle@gmail.com>
date: Mon Sep 8 13:53:36 EDT 2008

Fix disabled PC speaker sounds.

Subversion-branch: /branches/raven-branch
Subversion-revision: 1215

--- a/src/i_pcsound.c
+++ b/src/i_pcsound.c
@@ -142,6 +142,33 @@
     return true;
 }
 
+// These Doom PC speaker sounds are not played - this can be seen in the 
+// Heretic source code, where there are remnants of this left over
+// from Doom.
+
+static boolean IsDisabledSound(sfxinfo_t *sfxinfo)
+{
+    int i;
+    const char *disabled_sounds[] = {
+        "posact",
+        "bgact",
+        "dmact",
+        "dmpain",
+        "popain",
+        "sawidl",
+    };
+
+    for (i=0; i<arrlen(disabled_sounds); ++i)
+    {
+        if (!strcmp(sfxinfo->name, disabled_sounds[i]))
+        {
+            return true;
+        }
+    }
+
+    return false;
+}
+
 static int I_PCS_StartSound(sfxinfo_t *sfxinfo,
                             int channel,
                             int vol,
@@ -154,17 +181,10 @@
         return -1;
     }
 
-/* TODO
-    // These PC speaker sounds are not played - this can be seen in the 
-    // Heretic source code, where there are remnants of this left over
-    // from Doom.
-
-    if (id == sfx_posact || id == sfx_bgact || id == sfx_dmact
-     || id == sfx_dmpain || id == sfx_popain || id == sfx_sawidl)
+    if (IsDisabledSound(sfxinfo))
     {
         return -1;
     }
-    */
 
     if (SDL_LockMutex(sound_lock) < 0)
     {