#ifdef SVQC
- void _GlobalSound(entity this, entity gs, entity ps, string sample, int chan, int voicetype, bool fake)
+ void _GlobalSound(entity this, entity gs, entity ps, string sample, int chan, float vol, int voicetype, bool fake)
{
if (gs == NULL && ps == NULL && sample == "") return;
if(this.classname == "body") return;
if (IS_REAL_CLIENT(msg_entity))
{
float atten = (msg_entity.cvar_cl_voice_directional == 1) ? ATTEN_MIN : ATTEN_NONE;
- if (gs) globalsound(MSG_ONE, this, gs, r, chan, VOL_BASEVOICE, atten);
- else if (ps) playersound(MSG_ONE, this, ps, r, chan, VOL_BASEVOICE, atten);
- else soundto(MSG_ONE, this, chan, sample, VOL_BASEVOICE, atten);
+ if (gs) globalsound(MSG_ONE, this, gs, r, chan, vol, atten);
+ else if (ps) playersound(MSG_ONE, this, ps, r, chan, vol, atten);
+ else soundto(MSG_ONE, this, chan, sample, vol, atten);
}
}
if (voicetype == VOICETYPE_LASTATTACKER_ONLY) break;
MACRO_BEGIN \
{ \
float atten = (msg_entity.cvar_cl_voice_directional == 1) ? ATTEN_MIN : ATTEN_NONE; \
- if (gs) globalsound(MSG_ONE, this, gs, r, chan, VOL_BASEVOICE, atten); \
- else if (ps) playersound(MSG_ONE, this, ps, r, chan, VOL_BASEVOICE, atten); \
- else soundto(MSG_ONE, this, chan, sample, VOL_BASEVOICE, atten); \
+ if (gs) globalsound(MSG_ONE, this, gs, r, chan, vol, atten); \
+ else if (ps) playersound(MSG_ONE, this, ps, r, chan, vol, atten); \
+ else soundto(MSG_ONE, this, chan, sample, vol, atten); \
} MACRO_END
if (fake) { msg_entity = this; X(); }
? bound(ATTEN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, \
ATTEN_MAX) \
: ATTEN_NONE; \
- if (gs) globalsound(MSG_ONE, this, gs, r, chan, VOL_BASEVOICE, atten); \
- else if (ps) playersound(MSG_ONE, this, ps, r, chan, VOL_BASEVOICE, atten); \
- else soundto(MSG_ONE, this, chan, sample, VOL_BASEVOICE, atten); \
+ if (gs) globalsound(MSG_ONE, this, gs, r, chan, vol, atten); \
+ else if (ps) playersound(MSG_ONE, this, ps, r, chan, vol, atten); \
+ else soundto(MSG_ONE, this, chan, sample, vol, atten); \
} \
} MACRO_END
if (fake)
msg_entity = this;
if (fake)
{
- if (gs) globalsound(MSG_ONE, this, gs, r, chan, VOL_BASE, ATTEN_NORM);
- else if (ps) playersound(MSG_ONE, this, ps, r, chan, VOL_BASE, ATTEN_NORM);
- else soundto(MSG_ONE, this, chan, sample, VOL_BASE, ATTEN_NORM);
+ if (gs) globalsound(MSG_ONE, this, gs, r, chan, vol, ATTEN_NORM);
+ else if (ps) playersound(MSG_ONE, this, ps, r, chan, vol, ATTEN_NORM);
+ else soundto(MSG_ONE, this, chan, sample, vol, ATTEN_NORM);
}
else
{
- if (gs) globalsound(MSG_ALL, this, gs, r, chan, VOL_BASE, ATTEN_NORM);
- else if (ps) playersound(MSG_ALL, this, ps, r, chan, VOL_BASE, ATTEN_NORM);
- else _sound(this, chan, sample, VOL_BASE, ATTEN_NORM);
+ if (gs) globalsound(MSG_ALL, this, gs, r, chan, vol, ATTEN_NORM);
+ else if (ps) playersound(MSG_ALL, this, ps, r, chan, vol, ATTEN_NORM);
+ else _sound(this, chan, sample, vol, ATTEN_NORM);
}
break;
}
#ifdef SVQC
- void _GlobalSound(entity this, entity gs, entity ps, string sample, float chan, float voicetype, bool fake);
- #define GlobalSound(this, def, chan, voicetype) _GlobalSound(this, def, NULL, string_null, chan, voicetype, false)
- #define GlobalSound_string(this, def, chan, voicetype) _GlobalSound(this, NULL, NULL, def, chan, voicetype, false)
- #define PlayerSound(this, def, chan, voicetype) _GlobalSound(this, NULL, def, string_null, chan, voicetype, false)
+ void _GlobalSound(entity this, entity gs, entity ps, string sample, float chan, float vol, float voicetype, bool fake);
+ #define GlobalSound(this, def, chan, vol, voicetype) _GlobalSound(this, def, NULL, string_null, chan, vol, voicetype, false)
+ #define GlobalSound_string(this, def, chan, vol, voicetype) _GlobalSound(this, NULL, NULL, def, chan, vol, voicetype, false)
+ #define PlayerSound(this, def, chan, vol, voicetype) _GlobalSound(this, NULL, def, string_null, chan, vol, voicetype, false)
#define VoiceMessage(this, def, msg) \
MACRO_BEGIN \
{ \
if (IS_SPEC(this) || IS_OBSERVER(this) || flood < 0) fake = true; \
else if (flood > 0) fake = false; \
else break; \
- _GlobalSound(this, NULL, VM, string_null, CH_VOICE, voicetype, fake); \
+ _GlobalSound(this, NULL, VM, string_null, CH_VOICE, VOL_BASEVOICE, voicetype, fake); \
} MACRO_END
#endif
if(delaytoo)
if(time < this.msound_delay)
return; // too early
- GlobalSound_string(this, this.(samplefield), chan, VOICETYPE_PLAYERSOUND);
+ GlobalSound_string(this, this.(samplefield), chan, VOL_BASE, VOICETYPE_PLAYERSOUND);
this.msound_delay = time + sound_delay;
}
#ifdef SVQC
if (autocvar_sv_dodging_sound)
- PlayerSound(this, playersound_jump, CH_PLAYER, VOICETYPE_PLAYERSOUND);
+ PlayerSound(this, playersound_jump, CH_PLAYER, VOL_BASE, VOICETYPE_PLAYERSOUND);
animdecide_setaction(this, ANIMACTION_JUMP, true);
#endif
animdecide_setaction(this, ANIMACTION_JUMP, true);
if (autocvar_g_jump_grunt)
- PlayerSound(this, playersound_jump, CH_PLAYER, VOICETYPE_PLAYERSOUND);
+ PlayerSound(this, playersound_jump, CH_PLAYER, VOL_BASE, VOICETYPE_PLAYERSOUND);
#endif
return true;
}
entity gs = (trace_dphitq3surfaceflags & Q3SURFACEFLAG_METALSTEPS)
? GS_FALL_METAL
: GS_FALL;
- GlobalSound(this, gs, CH_PLAYER, VOICETYPE_PLAYERSOUND);
+ float vol = ((IS_DUCKED(this)) ? VOL_MUFFLED : VOL_BASE);
+ GlobalSound(this, gs, CH_PLAYER, vol, VOICETYPE_PLAYERSOUND);
#endif
}
entity gs = (trace_dphitq3surfaceflags & Q3SURFACEFLAG_METALSTEPS)
? GS_STEP_METAL
: GS_STEP;
- GlobalSound(this, gs, CH_PLAYER, VOICETYPE_PLAYERSOUND);
+ GlobalSound(this, gs, CH_PLAYER, VOL_BASE, VOICETYPE_PLAYERSOUND);
}
#endif
}
const float VOL_BASE = 0.7;
const float VOL_BASEVOICE = 1.0;
+const float VOL_MUFFLED = 0.35;
// Play all sounds via sound7, for access to the extra channels.
// Otherwise, channels 8 to 15 would be blocked for a weird QW feature.
entity e = this.teamkill_soundsource;
entity oldpusher = e.pusher;
e.pusher = this;
- PlayerSound(e, playersound_teamshoot, CH_VOICE, VOICETYPE_LASTATTACKER_ONLY);
+ PlayerSound(e, playersound_teamshoot, CH_VOICE, VOL_BASEVOICE, VOICETYPE_LASTATTACKER_ONLY);
e.pusher = oldpusher;
}
if (this.taunt_soundtime && time > this.taunt_soundtime) {
this.taunt_soundtime = 0;
- PlayerSound(this, playersound_taunt, CH_VOICE, VOICETYPE_AUTOTAUNT);
+ PlayerSound(this, playersound_taunt, CH_VOICE, VOL_BASEVOICE, VOICETYPE_AUTOTAUNT);
}
target_voicescript_next(this);
if (this.waterlevel != WATERLEVEL_SUBMERGED || this.vehicle)
{
if(this.air_finished < time)
- PlayerSound(this, playersound_gasp, CH_PLAYER, VOICETYPE_PLAYERSOUND);
+ PlayerSound(this, playersound_gasp, CH_PLAYER, VOL_BASE, VOICETYPE_PLAYERSOUND);
this.air_finished = time + autocvar_g_balance_contents_drowndelay;
this.dmg = 2;
}
// exclude pain sounds for laserjumps as long as you aren't REALLY low on health and would die of the next two
{
if(deathtype == DEATH_FALL.m_id)
- PlayerSound(this, playersound_fall, CH_PAIN, VOICETYPE_PLAYERSOUND);
+ PlayerSound(this, playersound_fall, CH_PAIN, VOL_BASE, VOICETYPE_PLAYERSOUND);
else if(this.health > 75)
- PlayerSound(this, playersound_pain100, CH_PAIN, VOICETYPE_PLAYERSOUND);
+ PlayerSound(this, playersound_pain100, CH_PAIN, VOL_BASE, VOICETYPE_PLAYERSOUND);
else if(this.health > 50)
- PlayerSound(this, playersound_pain75, CH_PAIN, VOICETYPE_PLAYERSOUND);
+ PlayerSound(this, playersound_pain75, CH_PAIN, VOL_BASE, VOICETYPE_PLAYERSOUND);
else if(this.health > 25)
- PlayerSound(this, playersound_pain50, CH_PAIN, VOICETYPE_PLAYERSOUND);
+ PlayerSound(this, playersound_pain50, CH_PAIN, VOL_BASE, VOICETYPE_PLAYERSOUND);
else
- PlayerSound(this, playersound_pain25, CH_PAIN, VOICETYPE_PLAYERSOUND);
+ PlayerSound(this, playersound_pain25, CH_PAIN, VOL_BASE, VOICETYPE_PLAYERSOUND);
}
}
}
if(sound_allowed(MSG_BROADCAST, attacker))
{
if(deathtype == DEATH_DROWN.m_id)
- PlayerSound(this, playersound_drown, CH_PAIN, VOICETYPE_PLAYERSOUND);
+ PlayerSound(this, playersound_drown, CH_PAIN, VOL_BASE, VOICETYPE_PLAYERSOUND);
else
- PlayerSound(this, playersound_death, CH_PAIN, VOICETYPE_PLAYERSOUND);
+ PlayerSound(this, playersound_death, CH_PAIN, VOL_BASE, VOICETYPE_PLAYERSOUND);
}
// get rid of kill indicator