From 356e23cc74727da5d839847c02f63a496e6b5d5f Mon Sep 17 00:00:00 2001 From: MirceaKitsune Date: Thu, 1 Mar 2012 13:26:29 +0200 Subject: [PATCH] Improve my last commit --- data/qcsrc/server/cl_player.qc | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/data/qcsrc/server/cl_player.qc b/data/qcsrc/server/cl_player.qc index e7bfb2d4..c8e9681f 100644 --- a/data/qcsrc/server/cl_player.qc +++ b/data/qcsrc/server/cl_player.qc @@ -1225,7 +1225,7 @@ void GlobalSound(string sample, float chan, float voicetype) { float n; float tauntrand; - float vol, vol_apply; + float vol_scale, vol_prey, vol_apply; if(sample == "") return; @@ -1238,11 +1238,11 @@ void GlobalSound(string sample, float chan, float voicetype) sample = strcat(argv(0), ".wav"); // randomization // modified volume, used for attenuated (non-radio) voices - vol = VOL_BASEVOICE; - if(self.stat_eaten && cvar("g_vore_soundocclusion")) // reduce sound volume for prey, to simulate stomach culling - vol *= cvar("g_vore_soundocclusion"); + vol_scale = vol_prey = 1; if(cvar("g_healthsize") && cvar("g_healthsize_soundfactor")) // amplify or reduce sound volume based on the size of the player - vol *= pow(self.scale, cvar("g_healthsize_soundfactor")); + vol_scale *= pow(self.scale, cvar("g_healthsize_soundfactor")); + if(self.stat_eaten && cvar("g_vore_soundocclusion")) // reduce sound volume for prey, to simulate stomach culling + vol_prey *= cvar("g_vore_soundocclusion"); vol = bound(0, vol, 1); switch(voicetype) @@ -1256,7 +1256,7 @@ void GlobalSound(string sample, float chan, float voicetype) { if(msg_entity.cvar_cl_voice_directional == 1) { - vol_apply = (self.predator != msg_entity.predator && self != msg_entity) ? vol : VOL_BASEVOICE; + vol_apply = (self.predator != msg_entity.predator && self != msg_entity) ? VOL_BASEVOICE * vol_scale * vol_prey : VOL_BASEVOICE * vol_scale; soundto(MSG_ONE, self, chan, sample, vol_apply, ATTN_MIN); } else @@ -1273,7 +1273,7 @@ void GlobalSound(string sample, float chan, float voicetype) { if(msg_entity.cvar_cl_voice_directional == 1) { - vol_apply = (self.predator != msg_entity.predator && self != msg_entity) ? vol : VOL_BASEVOICE; + vol_apply = (self.predator != msg_entity.predator && self != msg_entity) ? VOL_BASEVOICE * vol_scale * vol_prey : VOL_BASEVOICE * vol_scale; soundto(MSG_ONE, self, chan, sample, vol_apply, ATTN_MIN); } else @@ -1290,7 +1290,7 @@ void GlobalSound(string sample, float chan, float voicetype) { if(msg_entity.cvar_cl_voice_directional == 1) { - vol_apply = (self.predator != msg_entity.predator && self != msg_entity) ? vol : VOL_BASEVOICE; + vol_apply = (self.predator != msg_entity.predator && self != msg_entity) ? VOL_BASEVOICE * vol_scale * vol_prey : VOL_BASEVOICE * vol_scale; soundto(MSG_ONE, self, chan, sample, vol_apply, ATTN_MIN); } else @@ -1310,7 +1310,7 @@ void GlobalSound(string sample, float chan, float voicetype) { if (msg_entity.cvar_cl_voice_directional >= 1) { - vol_apply = (self.predator != msg_entity.predator && self != msg_entity) ? vol : VOL_BASEVOICE; + vol_apply = (self.predator != msg_entity.predator && self != msg_entity) ? VOL_BASEVOICE * vol_scale * vol_prey : VOL_BASEVOICE * vol_scale; soundto(MSG_ONE, self, chan, sample, vol_apply, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX)); } else @@ -1329,7 +1329,7 @@ void GlobalSound(string sample, float chan, float voicetype) { if (msg_entity.cvar_cl_voice_directional >= 1) { - vol_apply = (self.predator != msg_entity.predator && self != msg_entity) ? vol : VOL_BASEVOICE; + vol_apply = (self.predator != msg_entity.predator && self != msg_entity) ? VOL_BASEVOICE * vol_scale * vol_prey : VOL_BASEVOICE * vol_scale; soundto(MSG_ONE, self, chan, sample, vol_apply, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX)); } else @@ -1338,7 +1338,7 @@ void GlobalSound(string sample, float chan, float voicetype) case VOICETYPE_PLAYERSOUND: FOR_EACH_REALCLIENT(msg_entity) { - vol_apply = (self.predator != msg_entity.predator && self != msg_entity) ? vol : VOL_BASEVOICE; + vol_apply = (self.predator != msg_entity.predator && self != msg_entity) ? VOL_BASEVOICE * vol_scale * vol_prey : VOL_BASEVOICE * vol_scale; soundto(MSG_ONE, self, chan, sample, vol_apply, ATTN_NORM); } break; -- 2.39.2