From: MirceaKitsune Date: Sat, 3 Mar 2012 21:54:38 +0000 (+0200) Subject: First usage of pitched sounds. Player sounds and voices will pitch based on size... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c5af4a5c8f8ad3ac8368ddeb812143ac8ed01be7;p=voretournament%2Fvoretournament.git First usage of pitched sounds. Player sounds and voices will pitch based on size. Small players will have a high-pitch voice, whereas macro players will have a low-pitch voice --- diff --git a/data/defaultVT.cfg b/data/defaultVT.cfg index dbfe893c..50574b65 100644 --- a/data/defaultVT.cfg +++ b/data/defaultVT.cfg @@ -1667,6 +1667,7 @@ set g_healthsize_quake_step 10 "The view of nearby players is shaken by this amo set g_healthsize_quake_step_radius 500 "Radius in which a player must be located to shake the view" set g_healthsize_quake_fall 20 "The view of nearby players is shaken by this amount when a macro falls near them" set g_healthsize_quake_fall_radius 750 "Radius in which a player must be located to shake the view" +set g_healthsize_pitch 0.5 "The pitch of player sounds is modified by this amount based on player size" set g_power 5 "when armor is below this level, the HUD, crosshair and helper will not work" set g_power_reboot 2 "amount of time it takes to boot a player's subsystems once he has enough armor" diff --git a/data/qcsrc/server/cl_player.qc b/data/qcsrc/server/cl_player.qc index 70a28021..70ff9b24 100644 --- a/data/qcsrc/server/cl_player.qc +++ b/data/qcsrc/server/cl_player.qc @@ -1226,6 +1226,7 @@ void GlobalSound(string sample, float chan, float voicetype, float vol) float n; float tauntrand; float vol_scale, vol_prey, vol_apply; + float pitch; if(sample == "") return; @@ -1244,6 +1245,10 @@ void GlobalSound(string sample, float chan, float voicetype, float vol) if(self.stat_eaten && cvar("g_vore_soundocclusion")) // reduce sound volume for prey, to simulate stomach culling vol_prey *= bound(0, cvar("g_vore_soundocclusion"), 1); + // modified sound pitch, based on player scale + if(cvar("g_healthsize") && cvar("g_healthsize_pitch")) + pitch = pow(self.scale, -cvar("g_healthsize_pitch")); + switch(voicetype) { case VOICETYPE_LASTATTACKER_ONLY: @@ -1257,10 +1262,10 @@ void GlobalSound(string sample, float chan, float voicetype, float vol) { 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, 0); + soundto(MSG_ONE, self, chan, sample, vol_apply, ATTN_MIN, pitch); } else - soundto(MSG_ONE, self, chan, sample, vol, ATTN_NONE, 0); + soundto(MSG_ONE, self, chan, sample, vol, ATTN_NONE, pitch); } } break; @@ -1275,14 +1280,14 @@ void GlobalSound(string sample, float chan, float voicetype, float vol) { 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, 0); + soundto(MSG_ONE, self, chan, sample, vol_apply, ATTN_MIN, pitch); } else - soundto(MSG_ONE, self, chan, sample, vol, ATTN_NONE, 0); + soundto(MSG_ONE, self, chan, sample, vol, ATTN_NONE, pitch); } msg_entity = self; if(clienttype(msg_entity) == CLIENTTYPE_REAL) - soundto(MSG_ONE, self, chan, sample, VOL_BASE, ATTN_NONE, 0); + soundto(MSG_ONE, self, chan, sample, VOL_BASE, ATTN_NONE, pitch); } break; case VOICETYPE_TEAMRADIO: @@ -1293,10 +1298,10 @@ void GlobalSound(string sample, float chan, float voicetype, float vol) { 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, 0); + soundto(MSG_ONE, self, chan, sample, vol_apply, ATTN_MIN, pitch); } else - soundto(MSG_ONE, self, chan, sample, vol, ATTN_NONE, 0); + soundto(MSG_ONE, self, chan, sample, vol, ATTN_NONE, pitch); } break; case VOICETYPE_AUTOTAUNT: @@ -1314,10 +1319,10 @@ void GlobalSound(string sample, float chan, float voicetype, float vol) { 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), 0); + soundto(MSG_ONE, self, chan, sample, vol_apply, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX), pitch); } else - soundto(MSG_ONE, self, chan, sample, vol, ATTN_NONE, 0); + soundto(MSG_ONE, self, chan, sample, vol, ATTN_NONE, pitch); } break; case VOICETYPE_TAUNT: @@ -1334,23 +1339,23 @@ void GlobalSound(string sample, float chan, float voicetype, float vol) { 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), 0); + soundto(MSG_ONE, self, chan, sample, vol_apply, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX), pitch); } else - soundto(MSG_ONE, self, chan, sample, vol, ATTN_NONE, 0); + soundto(MSG_ONE, self, chan, sample, vol, ATTN_NONE, pitch); } case VOICETYPE_PLAYERSOUND: FOR_EACH_REALCLIENT(msg_entity) { 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, 0); + soundto(MSG_ONE, self, chan, sample, vol_apply, ATTN_NORM, pitch); } break; case VOICETYPE_GURGLE: // since players can't be prey and predators at the same time, we don't use the prey modifier for the gurgle sound volume if(self.stomach_load) - sound(self, chan, sample, bound(0, vol_scale * (self.stomach_load / self.stomach_maxload), 1), ATTN_NORM); + sound7(self, chan, sample, bound(0, vol_scale * (self.stomach_load / self.stomach_maxload), 1), ATTN_NORM, pitch, 0); else stopsound(self, chan); break;