From 837097387d436c8aba30124da34566403a1acfd8 Mon Sep 17 00:00:00 2001 From: MirceaKitsune Date: Sat, 3 Mar 2012 15:51:06 +0200 Subject: [PATCH] Play the normal footstep sounds based on micro status. A fully shrinked player will have no footstep sounds at all --- data/qcsrc/server/cl_player.qc | 22 +++++++++++----------- data/qcsrc/server/sv_main.qc | 10 +++++++--- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/data/qcsrc/server/cl_player.qc b/data/qcsrc/server/cl_player.qc index 7f22f580..5fccaf30 100644 --- a/data/qcsrc/server/cl_player.qc +++ b/data/qcsrc/server/cl_player.qc @@ -1255,12 +1255,12 @@ void GlobalSound(string sample, float chan, float voicetype, float vol) { if(msg_entity.cvar_cl_voice_directional == 1) { - vol_apply = VOL_BASEVOICE; + vol_apply = vol; vol_apply *= (self.predator != msg_entity.predator && self != msg_entity) ? vol_scale * vol_prey : vol_scale; soundto(MSG_ONE, self, chan, sample, vol_apply, ATTN_MIN); } else - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE); + soundto(MSG_ONE, self, chan, sample, vol, ATTN_NONE); } } break; @@ -1273,12 +1273,12 @@ void GlobalSound(string sample, float chan, float voicetype, float vol) { if(msg_entity.cvar_cl_voice_directional == 1) { - vol_apply = VOL_BASEVOICE; + vol_apply = vol; vol_apply *= (self.predator != msg_entity.predator && self != msg_entity) ? vol_scale * vol_prey : vol_scale; soundto(MSG_ONE, self, chan, sample, vol_apply, ATTN_MIN); } else - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE); + soundto(MSG_ONE, self, chan, sample, vol, ATTN_NONE); } msg_entity = self; if(clienttype(msg_entity) == CLIENTTYPE_REAL) @@ -1291,12 +1291,12 @@ void GlobalSound(string sample, float chan, float voicetype, float vol) { if(msg_entity.cvar_cl_voice_directional == 1) { - vol_apply = VOL_BASEVOICE; + vol_apply = vol; vol_apply *= (self.predator != msg_entity.predator && self != msg_entity) ? vol_scale * vol_prey : vol_scale; soundto(MSG_ONE, self, chan, sample, vol_apply, ATTN_MIN); } else - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE); + soundto(MSG_ONE, self, chan, sample, vol, ATTN_NONE); } break; case VOICETYPE_AUTOTAUNT: @@ -1312,12 +1312,12 @@ void GlobalSound(string sample, float chan, float voicetype, float vol) { if (msg_entity.cvar_cl_voice_directional >= 1) { - vol_apply = VOL_BASEVOICE; + vol_apply = vol; vol_apply *= (self.predator != msg_entity.predator && self != msg_entity) ? vol_scale * vol_prey : vol_scale; soundto(MSG_ONE, self, chan, sample, vol_apply, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX)); } else - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE); + soundto(MSG_ONE, self, chan, sample, vol, ATTN_NONE); } break; case VOICETYPE_TAUNT: @@ -1332,17 +1332,17 @@ void GlobalSound(string sample, float chan, float voicetype, float vol) { if (msg_entity.cvar_cl_voice_directional >= 1) { - vol_apply = VOL_BASEVOICE; + vol_apply = vol; vol_apply *= (self.predator != msg_entity.predator && self != msg_entity) ? vol_scale * vol_prey : vol_scale; soundto(MSG_ONE, self, chan, sample, vol_apply, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX)); } else - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE); + soundto(MSG_ONE, self, chan, sample, vol, ATTN_NONE); } case VOICETYPE_PLAYERSOUND: FOR_EACH_REALCLIENT(msg_entity) { - vol_apply = VOL_BASEVOICE; + vol_apply = vol; vol_apply *= (self.predator != msg_entity.predator && self != msg_entity) ? vol_scale * vol_prey : vol_scale; soundto(MSG_ONE, self, chan, sample, vol_apply, ATTN_NORM); } diff --git a/data/qcsrc/server/sv_main.qc b/data/qcsrc/server/sv_main.qc index 310fd446..b8baf296 100644 --- a/data/qcsrc/server/sv_main.qc +++ b/data/qcsrc/server/sv_main.qc @@ -106,12 +106,16 @@ void CreatureFrame (void) */ if not(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOSTEPS) { + float micro_to_normal, normal_to_macro; + micro_to_normal = 1 - bound(0, (self.health / cvar("g_healthsize_center") - 1) / (cvar("g_healthsize_min") / cvar("g_healthsize_center") - 1), 1); + normal_to_macro = 1 - bound(0, (self.health / cvar("g_healthsize_max") - 1) / (cvar("g_healthsize_center") / cvar("g_healthsize_max") - 1), 1); + if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_METALSTEPS) - GlobalSound(globalsound_metalstep, CHAN_PLAYER, VOICETYPE_PLAYERSOUND, VOL_BASE); + GlobalSound(globalsound_metalstep, CHAN_PLAYER, VOICETYPE_PLAYERSOUND, bound(0, VOL_BASE * micro_to_normal, 1)); else - GlobalSound(globalsound_step, CHAN_PLAYER, VOICETYPE_PLAYERSOUND, VOL_BASE); + GlobalSound(globalsound_step, CHAN_PLAYER, VOICETYPE_PLAYERSOUND, bound(0, VOL_BASE * micro_to_normal, 1)); - sound(self, CHAN_AUTO, "misc/macro_footstep.wav", VOL_BASE, ATTN_NORM); + //sound(self, CHAN_AUTO, "misc/macro_footstep.wav", VOL_BASE, ATTN_NORM); } } } -- 2.39.2