shithub: choc

Download patch

ref: c33c1fa07680ef07540fb1c48a323bdc816e3e77
parent: 52f81b4ef175358d1e1f7f9eecab2a1edb7f4b65
author: Simon Howard <fraggle@gmail.com>
date: Sat Feb 6 10:54:13 EST 2010

Fix Heretic/Hexen "noise" sound debug cheats.

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

--- a/src/heretic/s_sound.c
+++ b/src/heretic/s_sound.c
@@ -550,8 +550,16 @@
         c->priority = channel[i].priority;
         c->name = S_sfx[c->id].name;
         c->mo = channel[i].mo;
-        c->distance = P_AproxDistance(c->mo->x - viewx, c->mo->y - viewy)
-            >> FRACBITS;
+
+        if (c->mo != NULL)
+        {
+            c->distance = P_AproxDistance(c->mo->x - viewx, c->mo->y - viewy)
+                >> FRACBITS;
+        }
+        else
+        {
+            c->distance = 0;
+        }
     }
 }
 
--- a/src/hexen/s_sound.c
+++ b/src/hexen/s_sound.c
@@ -787,8 +787,16 @@
         c->priority = Channel[i].priority;
         c->name = S_sfx[c->id].name;
         c->mo = Channel[i].mo;
-        c->distance = P_AproxDistance(c->mo->x - viewx, c->mo->y - viewy)
-            >> FRACBITS;
+
+        if (c->mo != NULL)
+        {
+            c->distance = P_AproxDistance(c->mo->x - viewx, c->mo->y - viewy)
+                >> FRACBITS;
+        }
+        else
+        {
+            c->distance = 0;
+        }
     }
 }