return TRUE;
}
+#undef asound
+#undef csound
#ifdef COMPAT_XON010_CHANNELS
void(entity e, float chan, string samp, float vol, float atten) sound_builtin = #8;
-void sound(entity e, float chan, string samp, float vol, float atten)
+void asound(entity e, float chan, string samp, float vol, float atten)
+{
+ if (!sound_allowed(MSG_BROADCAST, e))
+ return;
+ if(chan == CH_TRIGGER && e.flags & FL_CLIENT)
+ chan = 0;
+ sound_builtin(e, chan, samp, vol, atten);
+}
+void csound(entity e, float chan, string samp, float vol, float atten)
{
if (!sound_allowed(MSG_BROADCAST, e))
return;
sound_builtin(e, chan, samp, vol, atten);
}
#else
-#undef sound
-void sound(entity e, float chan, string samp, float vol, float atten)
+void asound(entity e, float chan, string samp, float vol, float atten)
+{
+ if (!sound_allowed(MSG_BROADCAST, e))
+ return;
+ sound7(e, chan, samp, vol, atten, 0, SOUNDFLAG_AUTO);
+}
+void csound(entity e, float chan, string samp, float vol, float atten)
{
if (!sound_allowed(MSG_BROADCAST, e))
return;
sound7(e, chan, samp, vol, atten, 0, 0);
}
#endif
+#define sound DONOTUSE
-void soundtoat(float dest, entity e, vector o, float chan, string samp, float vol, float atten)
+void soundtoat(float dest, entity e, vector o, float chan, string samp, float vol, float atten, float pitchshift, float fl)
{
float entno, idx;
entno = num_for_edict(e);
idx = precache_sound_index(samp);
+ chan &~= 0x80;
+ if(fl & SOUNDFLAG_AUTO)
+ {
+ if(chan != 0)
+ chan |= 0x80;
+ }
+ else
+ {
+ if(chan == 0)
+ chan |= 0x80;
+ }
+
float sflags;
sflags = 0;
WriteCoord(dest, o_y);
WriteCoord(dest, o_z);
}
-void soundto(float dest, entity e, float chan, string samp, float vol, float atten)
+void soundto(float dest, entity e, float chan, string samp, float vol, float atten, float pitchshift, float pl)
{
vector o;
return;
o = e.origin + 0.5 * (e.mins + e.maxs);
- soundtoat(dest, e, o, chan, samp, vol, atten);
+ soundtoat(dest, e, o, chan, samp, vol, atten, pitchshift, pl);
}
-void soundat(entity e, vector o, float chan, string samp, float vol, float atten)
+void soundat(entity e, vector o, float chan, string samp, float vol, float atten, float pitchshift, float pl)
{
- soundtoat(((chan & 8) ? MSG_ALL : MSG_BROADCAST), e, o, chan, samp, vol, atten);
+ soundtoat(((chan & 8) ? MSG_ALL : MSG_BROADCAST), e, o, chan, samp, vol, atten, pitchshift, pl);
}
void stopsoundto(float dest, entity e, float chan)
{
{
//stuffcmd(e, strcat("play2 ", filename, "\n"));
msg_entity = e;
- soundtoat(MSG_ONE, world, '0 0 0', CH_INFO, filename, VOL_BASE, ATTN_NONE);
+ soundtoat(MSG_ONE, world, '0 0 0', CH_INFO, filename, VOL_BASE, ATTN_NONE, 0, SOUNDFLAG_AUTO);
}
// use this one if you might be causing spam (e.g. from touch functions that might get called more than once per frame)
if (time > e.spamtime)
{
e.spamtime = time;
- sound(e, chan, samp, vol, atten);
+ asound(e, chan, samp, vol, atten);
return TRUE;
}
return FALSE;
if (autocvar_bot_sound_monopoly)
return;
- sound(world, CH_INFO, samp, VOL_BASE, ATTN_NONE);
+ asound(world, CH_INFO, samp, VOL_BASE, ATTN_NONE);
}
void PrecachePlayerSounds(string f);
p = pow(2, chan);
if (pl.soundentity.cnt & p)
return;
- soundtoat(MSG_ALL, pl.soundentity, gettaginfo(pl.soundentity, 0), chan, samp, vol, attn);
+ soundtoat(MSG_ALL, pl.soundentity, gettaginfo(pl.soundentity, 0), chan, samp, vol, attn, 0, 0);
pl.soundentity.cnt |= p;
}