]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/server/cl_player.qc
Fix and improve my last tweaks
[voretournament/voretournament.git] / data / qcsrc / server / cl_player.qc
index c8e9681f0c17f80cf57070aa20a9c12238706ff8..f7cae1c63e91919213bee6e60199d791b5d11158 100644 (file)
@@ -1240,10 +1240,9 @@ void GlobalSound(string sample, float chan, float voicetype)
        // modified volume, used for attenuated (non-radio) voices\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_scale *= pow(self.scale, cvar("g_healthsize_soundfactor"));\r
+               vol_scale *= bound(0, pow(self.scale, cvar("g_healthsize_soundfactor")), 1);\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
+               vol_prey *= bound(0, cvar("g_vore_soundocclusion"), 1);\r
 \r
        switch(voicetype)\r
        {\r
@@ -1256,7 +1255,8 @@ 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_BASEVOICE * vol_scale * vol_prey : VOL_BASEVOICE * vol_scale;\r
+                                                       vol_apply = VOL_BASEVOICE;\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);\r
                                                }\r
                                                else\r
@@ -1273,7 +1273,8 @@ 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_BASEVOICE * vol_scale * vol_prey : VOL_BASEVOICE * vol_scale;\r
+                                                       vol_apply = VOL_BASEVOICE;\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);\r
                                                }\r
                                                else\r
@@ -1290,7 +1291,8 @@ 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_BASEVOICE * vol_scale * vol_prey : VOL_BASEVOICE * vol_scale;\r
+                                               vol_apply = VOL_BASEVOICE;\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);\r
                                        }\r
                                        else\r
@@ -1310,7 +1312,8 @@ 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_BASEVOICE * vol_scale * vol_prey : VOL_BASEVOICE * vol_scale;\r
+                                               vol_apply = VOL_BASEVOICE;\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));\r
                                        }\r
                                        else\r
@@ -1329,7 +1332,8 @@ 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_BASEVOICE * vol_scale * vol_prey : VOL_BASEVOICE * vol_scale;\r
+                                       vol_apply = VOL_BASEVOICE;\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));\r
                                }\r
                                else\r
@@ -1338,13 +1342,15 @@ 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_BASEVOICE * vol_scale * vol_prey : VOL_BASEVOICE * vol_scale;\r
+                               vol_apply = VOL_BASEVOICE;\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);\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 * (self.stomach_load / self.stomach_maxload), 1), ATTN_NORM);\r
+                               sound(self, chan, sample, bound(0, vol_scale * (self.stomach_load / self.stomach_maxload), 1), ATTN_NORM);\r
                        else\r
                                stopsound(self, chan);\r
                        break;\r