foxygit / doom Log in
commit 9736ada9a68709c1aea0093aef12f2855d152b2c
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Wed Oct 8 22:44:35 2008 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Wed Oct 8 22:44:35 2008 +0000

    Fix sound effects!

    Subversion-branch: /branches/raven-branch
    Subversion-revision: 1345
---
 src/hexen/s_sound.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/hexen/s_sound.c b/src/hexen/s_sound.c
index 5588ec05..80d6a85d 100644
--- a/src/hexen/s_sound.c
+++ b/src/hexen/s_sound.c
@@ -392,6 +392,8 @@ void S_StartSoundAtVolume(mobj_t * origin, int sound_id, int volume)
         }
     }

+    Channel[i].mo = origin;
+
     vol = (SoundCurve[dist] * (snd_MaxVolume * 8) * volume) >> 14;
     if (origin == players[displayplayer].mo)
     {
@@ -423,11 +425,15 @@ void S_StartSoundAtVolume(mobj_t * origin, int sound_id, int volume)
         Channel[i].pitch = 127;
     }
 #endif
+    if (S_sfx[sound_id].lumpnum == 0)
+    {
+        S_sfx[sound_id].lumpnum = I_GetSfxLumpNum(&S_sfx[sound_id]);
+    }
+
     Channel[i].handle = I_StartSound(&S_sfx[sound_id],
                                      i,
                                      vol,
                                      sep /* , Channel[i].pitch] */);
-    Channel[i].mo = origin;
     Channel[i].sound_id = sound_id;
     Channel[i].priority = priority;
     Channel[i].volume = volume;