]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/sounds/all.qc
Merge branch 'master' into martin-t/globals
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / sounds / all.qc
index 751462498c2a0a4743c998f869a381c8e9da9040..fcd4d9a459983fc06a2e35fdb1cd5e8db753e8b9 100644 (file)
@@ -1,10 +1,14 @@
+#include "all.qh"
 #ifdef SVQC
 
+#include <server/utils.qh>
+
 bool autocvar_bot_sound_monopoly;
 
 .entity realowner;
 bool sound_allowed(int to, entity e)
 {
+       if(!e) return true; // save on a few checks
        for ( ; ; )
        {
                if (e.classname == "body") e = e.enemy;
@@ -108,18 +112,18 @@ void stopsound(entity e, int chan)
 void play2(entity e, string filename)
 {
        msg_entity = e;
-       soundtoat(MSG_ONE, world, '0 0 0', CH_INFO, filename, VOL_BASE, ATTEN_NONE);
+       soundtoat(MSG_ONE, NULL, '0 0 0', CH_INFO, filename, VOL_BASE, ATTEN_NONE);
 }
 
 .float spamtime;
 /** use this one if you might be causing spam (e.g. from touch functions that might get called more than once per frame) */
-float spamsound(entity e, int chan, string samp, float vol, float _atten)
+float spamsound(entity e, int chan, Sound samp, float vol, float _atten)
 {
        if (!sound_allowed(MSG_BROADCAST, e)) return false;
        if (time > e.spamtime)
        {
                e.spamtime = time;
-               _sound(e, chan, samp, vol, _atten);
+               sound(e, chan, samp, vol, _atten);
                return true;
        }
        return false;
@@ -134,7 +138,7 @@ void play2team(float t, string filename)
 void play2all(string samp)
 {
        if (autocvar_bot_sound_monopoly) return;
-       _sound(world, CH_INFO, samp, VOL_BASE, ATTEN_NONE);
+       _sound(NULL, CH_INFO, samp, VOL_BASE, ATTEN_NONE);
 }
 
 #endif