X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fsounds%2Fall.qc;h=328486d35470cfc3594e437742d6428d2426a14c;hb=bc3f297ed082b23fb33dd0d8f5dcd33bb0198507;hp=92c5ef059ae7e160b2f282f886c96135b6f86467;hpb=201f6309c92217b63dc34daf004fbb7424096eca;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/sounds/all.qc b/qcsrc/common/sounds/all.qc index 92c5ef059..328486d35 100644 --- a/qcsrc/common/sounds/all.qc +++ b/qcsrc/common/sounds/all.qc @@ -1,5 +1,8 @@ +#include "all.qh" #ifdef SVQC +#include + bool autocvar_bot_sound_monopoly; .entity realowner; @@ -76,7 +79,7 @@ void soundat(entity e, vector o, int chan, string samp, float vol, float _atten) void stopsoundto(int _dest, entity e, int chan) { if (!sound_allowed(_dest, e)) return; - int entno = num_for_edict(e); + int entno = etof(e); if (entno >= 8192 || chan < 0 || chan > 7) { int idx = precache_sound_index(SND(Null)); @@ -108,18 +111,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; @@ -128,17 +131,13 @@ float spamsound(entity e, int chan, string samp, float vol, float _atten) void play2team(float t, string filename) { if (autocvar_bot_sound_monopoly) return; - entity head; - FOR_EACH_REALPLAYER(head) - { - if (head.team == t) play2(head, filename); - } + FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && it.team == t, play2(it, 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