]> de.git.xonotic.org Git - voretournament/voretournament.git/commitdiff
Improve my last commit
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Thu, 1 Mar 2012 11:26:29 +0000 (13:26 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Thu, 1 Mar 2012 11:26:29 +0000 (13:26 +0200)
data/qcsrc/server/cl_player.qc

index e7bfb2d488a6d177fb1ba5452879d08bc66d2a72..c8e9681f0c17f80cf57070aa20a9c12238706ff8 100644 (file)
@@ -1225,7 +1225,7 @@ void GlobalSound(string sample, float chan, float voicetype)
 {\r
        float n;\r
        float tauntrand;\r
-       float vol, vol_apply;\r
+       float vol_scale, vol_prey, vol_apply;\r
 \r
        if(sample == "")\r
                return;\r
@@ -1238,11 +1238,11 @@ void GlobalSound(string sample, float chan, float voicetype)
                sample = strcat(argv(0), ".wav"); // randomization\r
 \r
        // modified volume, used for attenuated (non-radio) voices\r
-       vol = VOL_BASEVOICE;\r
-       if(self.stat_eaten && cvar("g_vore_soundocclusion")) // reduce sound volume for prey, to simulate stomach culling\r
-               vol *= cvar("g_vore_soundocclusion");\r
+       vol_scale = vol_prey = 1;\r
        if(cvar("g_healthsize") && cvar("g_healthsize_soundfactor")) // amplify or reduce sound volume based on the size of the player\r
-               vol *= pow(self.scale, cvar("g_healthsize_soundfactor"));\r
+               vol_scale *= pow(self.scale, cvar("g_healthsize_soundfactor"));\r
+       if(self.stat_eaten && cvar("g_vore_soundocclusion")) // reduce sound volume for prey, to simulate stomach culling\r
+               vol_prey *= cvar("g_vore_soundocclusion");\r
        vol = bound(0, vol, 1);\r
 \r
        switch(voicetype)\r
@@ -1256,7 +1256,7 @@ void GlobalSound(string sample, float chan, float voicetype)
                                        {\r
                                                if(msg_entity.cvar_cl_voice_directional == 1)\r
                                                {\r
-                                                       vol_apply = (self.predator != msg_entity.predator && self != msg_entity) ? vol : VOL_BASEVOICE;\r
+                                                       vol_apply = (self.predator != msg_entity.predator && self != msg_entity) ? VOL_BASEVOICE * vol_scale * vol_prey : VOL_BASEVOICE * vol_scale;\r
                                                        soundto(MSG_ONE, self, chan, sample, vol_apply, ATTN_MIN);\r
                                                }\r
                                                else\r
@@ -1273,7 +1273,7 @@ void GlobalSound(string sample, float chan, float voicetype)
                                        {\r
                                                if(msg_entity.cvar_cl_voice_directional == 1)\r
                                                {\r
-                                                       vol_apply = (self.predator != msg_entity.predator && self != msg_entity) ? vol : VOL_BASEVOICE;\r
+                                                       vol_apply = (self.predator != msg_entity.predator && self != msg_entity) ? VOL_BASEVOICE * vol_scale * vol_prey : VOL_BASEVOICE * vol_scale;\r
                                                        soundto(MSG_ONE, self, chan, sample, vol_apply, ATTN_MIN);\r
                                                }\r
                                                else\r
@@ -1290,7 +1290,7 @@ void GlobalSound(string sample, float chan, float voicetype)
                                {\r
                                        if(msg_entity.cvar_cl_voice_directional == 1)\r
                                        {\r
-                                               vol_apply = (self.predator != msg_entity.predator && self != msg_entity) ? vol : VOL_BASEVOICE;\r
+                                               vol_apply = (self.predator != msg_entity.predator && self != msg_entity) ? VOL_BASEVOICE * vol_scale * vol_prey : VOL_BASEVOICE * vol_scale;\r
                                                soundto(MSG_ONE, self, chan, sample, vol_apply, ATTN_MIN);\r
                                        }\r
                                        else\r
@@ -1310,7 +1310,7 @@ void GlobalSound(string sample, float chan, float voicetype)
                                {\r
                                        if (msg_entity.cvar_cl_voice_directional >= 1)\r
                                        {\r
-                                               vol_apply = (self.predator != msg_entity.predator && self != msg_entity) ? vol : VOL_BASEVOICE;\r
+                                               vol_apply = (self.predator != msg_entity.predator && self != msg_entity) ? VOL_BASEVOICE * vol_scale * vol_prey : VOL_BASEVOICE * vol_scale;\r
                                                soundto(MSG_ONE, self, chan, sample, vol_apply, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX));\r
                                        }\r
                                        else\r
@@ -1329,7 +1329,7 @@ void GlobalSound(string sample, float chan, float voicetype)
                        {\r
                                if (msg_entity.cvar_cl_voice_directional >= 1)\r
                                {\r
-                                       vol_apply = (self.predator != msg_entity.predator && self != msg_entity) ? vol : VOL_BASEVOICE;\r
+                                       vol_apply = (self.predator != msg_entity.predator && self != msg_entity) ? VOL_BASEVOICE * vol_scale * vol_prey : VOL_BASEVOICE * vol_scale;\r
                                        soundto(MSG_ONE, self, chan, sample, vol_apply, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX));\r
                                }\r
                                else\r
@@ -1338,7 +1338,7 @@ void GlobalSound(string sample, float chan, float voicetype)
                case VOICETYPE_PLAYERSOUND:\r
                        FOR_EACH_REALCLIENT(msg_entity)\r
                        {\r
-                               vol_apply = (self.predator != msg_entity.predator && self != msg_entity) ? vol : VOL_BASEVOICE;\r
+                               vol_apply = (self.predator != msg_entity.predator && self != msg_entity) ? VOL_BASEVOICE * vol_scale * vol_prey : VOL_BASEVOICE * vol_scale;\r
                                soundto(MSG_ONE, self, chan, sample, vol_apply, ATTN_NORM);\r
                        }\r
                        break;\r