foxygit / doom Log in
commit 72bdda2c48147f37c7f3630f0b5353ef319b6a85
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Wed Feb 13 19:06:11 2008 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Wed Feb 13 19:06:11 2008 +0000

    Don't try to precache sound effects that don't exist.

    Subversion-branch: /trunk/chocolate-doom
    Subversion-revision: 1085
---
 src/i_sdlsound.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/i_sdlsound.c b/src/i_sdlsound.c
index 54799ac3..f89c2aea 100644
--- a/src/i_sdlsound.c
+++ b/src/i_sdlsound.c
@@ -479,6 +479,7 @@ static void I_SDL_ShutdownSound(void)

 static void I_PrecacheSounds(void)
 {
+    char namebuf[9];
     int i;

     printf("I_PrecacheSounds: Precaching all sound effects..");
@@ -491,9 +492,12 @@ static void I_PrecacheSounds(void)
             fflush(stdout);
         }

-        if (S_sfx[i].link == NULL)
-        {
-            S_sfx[i].lumpnum = I_SDL_GetSfxLumpNum(&S_sfx[i]);
+        sprintf(namebuf, "ds%s", DEH_String(S_sfx[i].name));
+
+        S_sfx[i].lumpnum = W_CheckNumForName(namebuf);
+
+        if (S_sfx[i].lumpnum != -1)
+        {
             CacheSFX(i);

             if (sound_chunks[i].abuf != NULL)