6 bool autocvar_bot_sound_monopoly;
14 if (e.classname ==
"body") e = e.enemy;
15 else if (e.realowner && e.realowner != e) e = e.realowner;
16 else if (e.owner && e.owner != e) e = e.owner;
22 if (autocvar_bot_sound_monopoly &&
IS_REAL_CLIENT(e))
return false;
28 int precache_sound_index(
string s) = #19;
30 const int SVC_SOUND = 6;
31 const int SVC_STOPSOUND = 16;
33 const int SND_VOLUME =
BIT(0);
34 const int SND_ATTENUATION =
BIT(1);
35 const int SND_LARGEENTITY =
BIT(3);
36 const int SND_LARGESOUND =
BIT(4);
37 const int SND_SPEEDUSHORT4000 =
BIT(5);
39 void soundtoat(
int to,
entity e,
vector o,
int chan,
string samp,
float vol,
float attenu,
float _pitch)
41 if (!sound_allowed(to, e))
return;
43 int idx = precache_sound_index(samp);
44 attenu =
floor(attenu * 64);
45 vol =
floor(vol * 255);
47 int speed4000 =
floor((_pitch * 0.01) * 4000 + 0.5);
48 if (vol != 255) sflags |= SND_VOLUME;
49 if (attenu != 64) sflags |= SND_ATTENUATION;
50 if (entno >= 8192 || chan < 0 || chan > 7) sflags |= SND_LARGEENTITY;
51 if (idx >= 256) sflags |= SND_LARGESOUND;
52 if (speed4000 && speed4000 != 4000) sflags |= SND_SPEEDUSHORT4000;
55 if (sflags & SND_VOLUME)
WriteByte(to, vol);
56 if (sflags & SND_ATTENUATION)
WriteByte(to, attenu);
57 if (sflags & SND_SPEEDUSHORT4000)
WriteShort(to, speed4000);
58 if (sflags & SND_LARGEENTITY)
67 if (sflags & SND_LARGESOUND)
WriteShort(to, idx);
74 void soundto(
int _dest,
entity e,
int chan,
string samp,
float vol,
float _atten,
float _pitch)
76 if (!sound_allowed(_dest, e))
return;
77 vector o = e.origin + 0.5 * (e.mins + e.maxs);
78 soundtoat(_dest, e, o, chan, samp, vol, _atten, _pitch);
80 void soundat(
entity e,
vector o,
int chan,
string samp,
float vol,
float _atten)
84 void stopsoundto(
int _dest,
entity e,
int chan)
86 if (!sound_allowed(_dest, e))
return;
88 if (entno >= 8192 || chan < 0 || chan > 7)
90 int idx = precache_sound_index(
SND(Null));
91 int sflags = SND_LARGEENTITY;
92 if (idx >= 256) sflags |= SND_LARGESOUND;
97 if (sflags & SND_LARGESOUND)
WriteShort(_dest, idx);
109 void stopsound(
entity e,
int chan)
116 void play2(
entity e,
string filename)
124 float spamsound(
entity e,
int chan,
Sound samp,
float vol,
float _atten)
127 if (
time > e.spamtime)
130 sound(e, chan, samp, vol, _atten);
136 void play2team(
float t,
string filename)
138 if (autocvar_bot_sound_monopoly)
return;
142 void play2all(
string samp)
144 if (autocvar_bot_sound_monopoly)
return;
#define FOREACH_CLIENT(cond, body)
#define IS_REAL_CLIENT(v)
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
vector(float skel, float bonenum) _skel_get_boneabs_hidden
#define _sound(e, c, s, v, a)
#define sound(e, c, s, v, a)