]> git.xonotic.org Git - voretournament/voretournament.git/commitdiff
First usage of pitched sounds. Player sounds and voices will pitch based on size...
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 3 Mar 2012 21:54:38 +0000 (23:54 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 3 Mar 2012 21:54:38 +0000 (23:54 +0200)
data/defaultVT.cfg
data/qcsrc/server/cl_player.qc

index dbfe893c7c8241bb8f56f947ca88062d39dc667a..50574b6510b5251de9c8a83820e63e50b1719611 100644 (file)
@@ -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"\r
 set g_healthsize_quake_fall 20 "The view of nearby players is shaken by this amount when a macro falls near them"\r
 set g_healthsize_quake_fall_radius 750 "Radius in which a player must be located to shake the view"\r
+set g_healthsize_pitch 0.5 "The pitch of player sounds is modified by this amount based on player size"\r
 \r
 set g_power 5 "when armor is below this level, the HUD, crosshair and helper will not work"\r
 set g_power_reboot 2 "amount of time it takes to boot a player's subsystems once he has enough armor"\r
index 70a28021b5dfa23de362b84ccd0839923a947ed9..70ff9b24347965547619ca22a32fda562db2b348 100644 (file)
@@ -1226,6 +1226,7 @@ void GlobalSound(string sample, float chan, float voicetype, float vol)
        float n;\r
        float tauntrand;\r
        float vol_scale, vol_prey, vol_apply;\r
+       float pitch;\r
 \r
        if(sample == "")\r
                return;\r
@@ -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\r
                vol_prey *= bound(0, cvar("g_vore_soundocclusion"), 1);\r
 \r
+       // modified sound pitch, based on player scale\r
+       if(cvar("g_healthsize") && cvar("g_healthsize_pitch"))\r
+               pitch = pow(self.scale, -cvar("g_healthsize_pitch"));\r
+\r
        switch(voicetype)\r
        {\r
                case VOICETYPE_LASTATTACKER_ONLY:\r
@@ -1257,10 +1262,10 @@ void GlobalSound(string sample, float chan, float voicetype, float vol)
                                                {\r
                                                        vol_apply = vol;\r
                                                        vol_apply *= (self.predator != msg_entity.predator && self != msg_entity) ? vol_scale * vol_prey : vol_scale;\r
-                                                       soundto(MSG_ONE, self, chan, sample, vol_apply, ATTN_MIN, 0);\r
+                                                       soundto(MSG_ONE, self, chan, sample, vol_apply, ATTN_MIN, pitch);\r
                                                }\r
                                                else\r
-                                                       soundto(MSG_ONE, self, chan, sample, vol, ATTN_NONE, 0);\r
+                                                       soundto(MSG_ONE, self, chan, sample, vol, ATTN_NONE, pitch);\r
                                        }\r
                                }\r
                        break;\r
@@ -1275,14 +1280,14 @@ void GlobalSound(string sample, float chan, float voicetype, float vol)
                                                {\r
                                                        vol_apply = vol;\r
                                                        vol_apply *= (self.predator != msg_entity.predator && self != msg_entity) ? vol_scale * vol_prey : vol_scale;\r
-                                                       soundto(MSG_ONE, self, chan, sample, vol_apply, ATTN_MIN, 0);\r
+                                                       soundto(MSG_ONE, self, chan, sample, vol_apply, ATTN_MIN, pitch);\r
                                                }\r
                                                else\r
-                                                       soundto(MSG_ONE, self, chan, sample, vol, ATTN_NONE, 0);\r
+                                                       soundto(MSG_ONE, self, chan, sample, vol, ATTN_NONE, pitch);\r
                                        }\r
                                        msg_entity = self;\r
                                        if(clienttype(msg_entity) == CLIENTTYPE_REAL)\r
-                                               soundto(MSG_ONE, self, chan, sample, VOL_BASE, ATTN_NONE, 0);\r
+                                               soundto(MSG_ONE, self, chan, sample, VOL_BASE, ATTN_NONE, pitch);\r
                                }\r
                        break;\r
                case VOICETYPE_TEAMRADIO:\r
@@ -1293,10 +1298,10 @@ void GlobalSound(string sample, float chan, float voicetype, float vol)
                                        {\r
                                                vol_apply = vol;\r
                                                vol_apply *= (self.predator != msg_entity.predator && self != msg_entity) ? vol_scale * vol_prey : vol_scale;\r
-                                               soundto(MSG_ONE, self, chan, sample, vol_apply, ATTN_MIN, 0);\r
+                                               soundto(MSG_ONE, self, chan, sample, vol_apply, ATTN_MIN, pitch);\r
                                        }\r
                                        else\r
-                                               soundto(MSG_ONE, self, chan, sample, vol, ATTN_NONE, 0);\r
+                                               soundto(MSG_ONE, self, chan, sample, vol, ATTN_NONE, pitch);\r
                                }\r
                        break;\r
                case VOICETYPE_AUTOTAUNT:\r
@@ -1314,10 +1319,10 @@ void GlobalSound(string sample, float chan, float voicetype, float vol)
                                        {\r
                                                vol_apply = vol;\r
                                                vol_apply *= (self.predator != msg_entity.predator && self != msg_entity) ? vol_scale * vol_prey : vol_scale;\r
-                                               soundto(MSG_ONE, self, chan, sample, vol_apply, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX), 0);\r
+                                               soundto(MSG_ONE, self, chan, sample, vol_apply, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX), pitch);\r
                                        }\r
                                        else\r
-                                               soundto(MSG_ONE, self, chan, sample, vol, ATTN_NONE, 0);\r
+                                               soundto(MSG_ONE, self, chan, sample, vol, ATTN_NONE, pitch);\r
                                }\r
                        break;\r
                case VOICETYPE_TAUNT:\r
@@ -1334,23 +1339,23 @@ void GlobalSound(string sample, float chan, float voicetype, float vol)
                                {\r
                                        vol_apply = vol;\r
                                        vol_apply *= (self.predator != msg_entity.predator && self != msg_entity) ? vol_scale * vol_prey : vol_scale;\r
-                                       soundto(MSG_ONE, self, chan, sample, vol_apply, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX), 0);\r
+                                       soundto(MSG_ONE, self, chan, sample, vol_apply, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX), pitch);\r
                                }\r
                                else\r
-                                       soundto(MSG_ONE, self, chan, sample, vol, ATTN_NONE, 0);\r
+                                       soundto(MSG_ONE, self, chan, sample, vol, ATTN_NONE, pitch);\r
                        }\r
                case VOICETYPE_PLAYERSOUND:\r
                        FOR_EACH_REALCLIENT(msg_entity)\r
                        {\r
                                vol_apply = vol;\r
                                vol_apply *= (self.predator != msg_entity.predator && self != msg_entity) ? vol_scale * vol_prey : vol_scale;\r
-                               soundto(MSG_ONE, self, chan, sample, vol_apply, ATTN_NORM, 0);\r
+                               soundto(MSG_ONE, self, chan, sample, vol_apply, ATTN_NORM, pitch);\r
                        }\r
                        break;\r
                case VOICETYPE_GURGLE:\r
                        // since players can't be prey and predators at the same time, we don't use the prey modifier for the gurgle sound volume\r
                        if(self.stomach_load)\r
-                               sound(self, chan, sample, bound(0, vol_scale * (self.stomach_load / self.stomach_maxload), 1), ATTN_NORM);\r
+                               sound7(self, chan, sample, bound(0, vol_scale * (self.stomach_load / self.stomach_maxload), 1), ATTN_NORM, pitch, 0);\r
                        else\r
                                stopsound(self, chan);\r
                        break;\r