From c93dc4fbb49a6c6c355f05d530e7048fbe5a50db Mon Sep 17 00:00:00 2001 From: MirceaKitsune Date: Wed, 13 Jul 2011 16:30:45 +0300 Subject: [PATCH] Offset player sound volume based on player scale by default --- data/defaultVT.cfg | 1 + data/qcsrc/server/cl_player.qc | 56 +++++++++++++--------------------- 2 files changed, 22 insertions(+), 35 deletions(-) diff --git a/data/defaultVT.cfg b/data/defaultVT.cfg index 3b7bd6a5..08db8645 100644 --- a/data/defaultVT.cfg +++ b/data/defaultVT.cfg @@ -1603,6 +1603,7 @@ set g_vore_swallowmodel_range 100 "Distance by which the swallow model oscillate set g_healthsize 100 "Players who are low on health shrink and become smaller, value specifies health at which the player has default size" set g_healthsize_movementfactor 0.5 "Amount by which player size affects jumping and running" +set g_healthsize_soundfactor 1 "The sounds players make are amplified or reduced by this amount based on their size" set g_healthsize_exteriorweapon_scalefactor 1 "Amount by which player size resizes the exterior weapon model" set g_healthsize_weapon_scalefactor 1 "Amount by which player size resizes the view weapon model" set g_healthsize_weapon_scalefactor_pos 10 "Amount by which the view model is moved vertically based on player size" diff --git a/data/qcsrc/server/cl_player.qc b/data/qcsrc/server/cl_player.qc index 430d6655..7a5d7b1c 100644 --- a/data/qcsrc/server/cl_player.qc +++ b/data/qcsrc/server/cl_player.qc @@ -1219,6 +1219,7 @@ void GlobalSound(string sample, float chan, float voicetype) { float n; float tauntrand; + float vol; if(sample == "") return; @@ -1230,6 +1231,17 @@ void GlobalSound(string sample, float chan, float voicetype) else 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"); + if(cvar("g_healthsize") && cvar("g_healthsize_soundfactor")) // amplify or reduce sound volume based on the size of the player + { + vol /= 2; // volume being greater than 1 causes stuff to brake, so it must be 0.5 at normal scale + vol *= (self.scale * cvar("g_healthsize_soundfactor")); + } + vol = bound(0, vol, 1); + switch(voicetype) { case VOICETYPE_LASTATTACKER_ONLY: @@ -1240,12 +1252,7 @@ void GlobalSound(string sample, float chan, float voicetype) if(clienttype(msg_entity) == CLIENTTYPE_REAL) { if(msg_entity.cvar_cl_voice_directional == 1) - { - if(self.stat_eaten) - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE * bound(0, cvar("g_vore_soundocclusion"), 1), ATTN_MIN); - else - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_MIN); - } + soundto(MSG_ONE, self, chan, sample, vol, ATTN_MIN); else soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE); } @@ -1259,12 +1266,7 @@ void GlobalSound(string sample, float chan, float voicetype) if(clienttype(msg_entity) == CLIENTTYPE_REAL) { if(msg_entity.cvar_cl_voice_directional == 1) - { - if(self.stat_eaten) - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE * bound(0, cvar("g_vore_soundocclusion"), 1), ATTN_MIN); - else - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_MIN); - } + soundto(MSG_ONE, self, chan, sample, vol, ATTN_MIN); else soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE); } @@ -1278,12 +1280,7 @@ void GlobalSound(string sample, float chan, float voicetype) if(!teams_matter || msg_entity.team == self.team) { if(msg_entity.cvar_cl_voice_directional == 1) - { - if(self.stat_eaten) - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE * bound(0, cvar("g_vore_soundocclusion"), 1), ATTN_MIN); - else - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_MIN); - } + soundto(MSG_ONE, self, chan, sample, vol, ATTN_MIN); else soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE); } @@ -1298,15 +1295,12 @@ void GlobalSound(string sample, float chan, float voicetype) tauntrand = random(); FOR_EACH_REALCLIENT(msg_entity) if (tauntrand < msg_entity.cvar_cl_autotaunt) - if (msg_entity.cvar_cl_voice_directional >= 1) { - if(self.stat_eaten) - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE * bound(0, cvar("g_vore_soundocclusion"), 1), bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX)); + if (msg_entity.cvar_cl_voice_directional >= 1) + soundto(MSG_ONE, self, chan, sample, vol, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX)); else - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX)); + soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE); } - else - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE); break; case VOICETYPE_TAUNT: if(self.classname == "player") @@ -1319,24 +1313,16 @@ void GlobalSound(string sample, float chan, float voicetype) FOR_EACH_REALCLIENT(msg_entity) { if (msg_entity.cvar_cl_voice_directional >= 1) - { - if(self.stat_eaten) - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE * bound(0, cvar("g_vore_soundocclusion"), 1), bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX)); - else - soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX)); - } + soundto(MSG_ONE, self, chan, sample, vol, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX)); else soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE); } case VOICETYPE_PLAYERSOUND: - if(self.stat_eaten) - sound(self, chan, sample, VOL_BASE * bound(0, cvar("g_vore_soundocclusion"), 1), ATTN_NORM); - else - sound(self, chan, sample, VOL_BASE, ATTN_NORM); + sound(self, chan, sample, vol, ATTN_NORM); break; case VOICETYPE_GURGLE: if(self.stomach_load) - sound(self, chan, sample, VOL_BASE * self.stomach_load / g_balance_vore_swallow_limit, ATTN_NORM); + sound(self, chan, sample, vol * self.stomach_load / g_balance_vore_swallow_limit, ATTN_NORM); else stopsound(self, chan); break; -- 2.39.2