11 REPLICATE(cvar_cl_autotaunt,
float,
"cl_autotaunt");
12 REPLICATE(cvar_cl_voice_directional,
int,
"cl_voice_directional");
13 REPLICATE(cvar_cl_voice_directional_taunt_attenuation,
float,
"cl_voice_directional_taunt_attenuation");
22 void globalsound(
int channel,
entity from,
entity gs,
float r,
int chan,
float _vol,
float _atten,
float _pitch)
26 if (!autocvar_g_debug_globalsounds) {
30 soundto(channel, from, chan, sample, _vol, _atten, _pitch);
34 sound7(from, chan, sample, _vol, _atten, _pitch, 0);
40 WriteHeader(channel, globalsound);
47 entcs_force_origin(from);
48 vector o = from.origin + 0.5 * (from.mins + from.maxs);
49 WriteVector(channel, o);
57 void playersound(
int channel,
entity from,
entity ps,
float r,
int chan,
float _vol,
float _atten,
float _pitch)
61 if (!autocvar_g_debug_globalsounds) {
63 string s = from.(ps.m_playersoundfld);
67 soundto(channel, from, chan, sample, _vol, _atten, _pitch);
71 sound7(from, chan, sample, _vol, _atten, _pitch, 0);
77 WriteHeader(channel, playersound);
84 entcs_force_origin(from);
85 vector o = from.origin + 0.5 * (from.mins + from.maxs);
86 WriteVector(channel, o);
95 float r = ReadByte() / 255;
98 entity e = entcs_receiver(who - 1);
99 int chan = ReadSByte();
100 float vol = ReadByte() / 255;
101 float atten = ReadByte() / 64;
105 else if (e) e.origin = o;
108 sound7(e, chan, sample, vol, atten, 0, 0);
113 LOG_WARNF(
"Missing entcs data for player %d", who);
114 sound8(e, o, chan, sample, vol, atten, 0, 0);
122 float r = ReadByte() / 255;
123 int who = ReadByte();
124 entity e = entcs_receiver(who - 1);
126 string s = e.(ps.m_playersoundfld);
128 int chan = ReadSByte();
129 float vol = ReadByte() / 255;
130 float atten = ReadByte() / 64;
133 else if (e) e.origin = o;
137 sound7(e, chan, sample, vol, atten, 0, 0);
142 LOG_WARNF(
"Missing entcs data for player %d", who);
143 sound8(e, o, chan, sample, vol, atten, 0, 0);
154 string s =
cdr(pair);
158 string sample =
car(pair);
159 if (n > 0) sample = sprintf(
"%s%d.wav", sample,
floor(r * n + 1));
160 else sample = sprintf(
"%s.wav", sample);
171 float pitch_shift = (b*d*(a-1) + a*c*(1-b)) / (d*(a-1) + c*(1-b));
173 return pitch_shift * 100;
180 string s =
cdr(sample);
184 sample =
car(sample);
187 for (
int i = 1; i <= n; ++i)
198 FOREACH(PlayerSounds, it.m_playersoundstr == type && it.instanceOfVoiceMessage ==
true,
return it);
204 FOREACH(PlayerSounds, it.m_playersoundstr == type && it.instanceOfVoiceMessage ==
false,
return it);
212 if (e)
return e.m_playersoundfld;
214 return playersound_taunt.m_playersoundfld;
227 LOG_WARNF(
"Player sound file not found: %s", f);
230 for (
string s; (s =
fgets(fh)); )
235 if (n != 0)
LOG_WARNF(
"Invalid sound info line: %s", s);
238 string file =
argv(1);
239 string variants =
argv(2);
255 .string fld = it.m_playersoundfld;
268 if (strict)
LOG_WARNF(
"Player sound file not found: %s", f);
271 for (
string s; (s =
fgets(fh)); )
276 if (n != 0)
LOG_WARNF(
"Invalid sound info line: %s", s);
279 string key =
argv(0);
284 LOG_TRACEF(
"Invalid sound info field in player sound file '%s': %s", f, key);
287 string file =
argv(1);
288 string variants =
argv(2);
307 if (this.
model ==
"null" 309 && autocvar_g_debug_globalsounds
312 if (autocvar_g_debug_defaultsounds)
return;
321 void _GlobalSound(
entity this,
entity gs,
entity ps,
string sample,
int chan,
float vol,
int voicetype,
bool fake)
323 if (gs ==
NULL && ps ==
NULL && sample ==
"")
return;
326 float myscale = ((this.
scale) ? this.
scale : 1);
341 if (gs) globalsound(
MSG_ONE,
this, gs, r, chan, vol, atten, thepitch);
342 else if (ps) playersound(
MSG_ONE,
this, ps, r, chan, vol, atten, thepitch);
343 else soundto(
MSG_ONE,
this, chan, sample, vol, atten, thepitch);
360 float atten = (CS_CVAR(msg_entity).cvar_cl_voice_directional == 1) ? ATTEN_MIN : ATTEN_NONE; \ 361 if (gs) globalsound(MSG_ONE, this, gs, r, chan, vol, atten, thepitch); \ 362 else if (ps) playersound(MSG_ONE, this, ps, r, chan, vol, atten, thepitch); \ 363 else soundto(MSG_ONE, this, chan, sample, vol, atten, thepitch); \ 382 if (!autocvar_sv_autotaunt)
break;
387 if (!autocvar_sv_taunt)
break;
388 if (autocvar_sv_gentle)
break;
394 if (voicetype != VOICETYPE_AUTOTAUNT || tauntrand < CS_CVAR(msg_entity).cvar_cl_autotaunt) \ 396 float atten = (CS_CVAR(msg_entity).cvar_cl_voice_directional >= 1) \ 397 ? bound(ATTEN_MIN, CS_CVAR(msg_entity).cvar_cl_voice_directional_taunt_attenuation, \ 400 if (gs) globalsound(MSG_ONE, this, gs, r, chan, vol, atten, thepitch); \ 401 else if (ps) playersound(MSG_ONE, this, ps, r, chan, vol, atten, thepitch); \ 402 else soundto(MSG_ONE, this, chan, sample, vol, atten, thepitch); \ string get_model_datafilename(string m, float sk, string fil)
entity GetPlayerSound(string type)
void PrecachePlayerSounds(string f)
const int VOICETYPE_PLAYERSOUND
#define sound8(e, o, chan, samp, vol, atten, speed, sf)
because sound7 didn't have origin
const int VOICETYPE_TAUNT
#define REGISTRY_GET(id, i)
#define FOREACH_CLIENT(cond, body)
ERASEABLE string cdr(string s)
returns all but first word
REPLICATE(cvar_cl_casings, bool, "cl_casings")
#define NET_HANDLE(id, param)
void UpdatePlayerSounds(entity this)
const int VOICETYPE_AUTOTAUNT
string _GetPlayerSoundSampleField(string type, bool voice)
ERASEABLE string car(string s)
returns first word
#define player_currententnum
#define IS_REAL_CLIENT(v)
string GetPlayerSoundSampleField(string type)
string GetVoiceMessageSampleField(string type)
const int VOICETYPE_LASTATTACKER
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
bool GetPlayerSoundSampleField_notFound
void animdecide_setaction(entity e, float action, float restart)
void PrecacheGlobalSound(string sample)
float GlobalSound_pitch(float _pitch)
bool LoadPlayerSounds(entity this, string f, bool strict)
vector(float skel, float bonenum) _skel_get_boneabs_hidden
void ClearPlayerSounds(entity this)
string GlobalSound_sample(string pair, float r)
const int ANIMACTION_TAUNT
bool autocvar_g_debug_defaultsounds
string model_for_playersound
#define REGISTER_NET_TEMP(id)
entity GetVoiceMessage(string type)
#define FOREACH(list, cond, body)
const int VOICETYPE_LASTATTACKER_ONLY
const int VOICETYPE_TEAMRADIO