]> git.rm.cloudns.org Git - voretournament/voretournament.git/commitdiff
Offset player sound volume based on player scale by default
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 13 Jul 2011 13:30:45 +0000 (16:30 +0300)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 13 Jul 2011 13:30:45 +0000 (16:30 +0300)
data/defaultVT.cfg
data/qcsrc/server/cl_player.qc

index 3b7bd6a57766931f8ccaceeac449230f9cbdbd79..08db8645ec3dabe94ea6ca6be6d7640a5aafedc1 100644 (file)
@@ -1603,6 +1603,7 @@ set g_vore_swallowmodel_range 100 "Distance by which the swallow model oscillate
 \r
 set g_healthsize 100 "Players who are low on health shrink and become smaller, value specifies health at which the player has default size"\r
 set g_healthsize_movementfactor 0.5 "Amount by which player size affects jumping and running"\r
+set g_healthsize_soundfactor 1 "The sounds players make are amplified or reduced by this amount based on their size"\r
 set g_healthsize_exteriorweapon_scalefactor 1 "Amount by which player size resizes the exterior weapon model"\r
 set g_healthsize_weapon_scalefactor 1 "Amount by which player size resizes the view weapon model"\r
 set g_healthsize_weapon_scalefactor_pos 10 "Amount by which the view model is moved vertically based on player size"\r
index 430d6655b9c7f692343153dfcae2031ea690c0a2..7a5d7b1cf7aa2572255c1e692aafb8497f793947 100644 (file)
@@ -1219,6 +1219,7 @@ void GlobalSound(string sample, float chan, float voicetype)
 {\r
        float n;\r
        float tauntrand;\r
+       float vol;\r
 \r
        if(sample == "")\r
                return;\r
@@ -1230,6 +1231,17 @@ void GlobalSound(string sample, float chan, float voicetype)
        else\r
                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
+       if(cvar("g_healthsize") && cvar("g_healthsize_soundfactor")) // amplify or reduce sound volume based on the size of the player\r
+       {\r
+               vol /= 2; // volume being greater than 1 causes stuff to brake, so it must be 0.5 at normal scale\r
+               vol *= (self.scale * cvar("g_healthsize_soundfactor"));\r
+       }\r
+       vol = bound(0, vol, 1);\r
+\r
        switch(voicetype)\r
        {\r
                case VOICETYPE_LASTATTACKER_ONLY:\r
@@ -1240,12 +1252,7 @@ void GlobalSound(string sample, float chan, float voicetype)
                                        if(clienttype(msg_entity) == CLIENTTYPE_REAL)\r
                                        {\r
                                                if(msg_entity.cvar_cl_voice_directional == 1)\r
-                                               {\r
-                                                       if(self.stat_eaten)\r
-                                                               soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE * bound(0, cvar("g_vore_soundocclusion"), 1), ATTN_MIN);\r
-                                                       else\r
-                                                               soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_MIN);\r
-                                               }\r
+                                                       soundto(MSG_ONE, self, chan, sample, vol, ATTN_MIN);\r
                                                else\r
                                                        soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE);\r
                                        }\r
@@ -1259,12 +1266,7 @@ void GlobalSound(string sample, float chan, float voicetype)
                                        if(clienttype(msg_entity) == CLIENTTYPE_REAL)\r
                                        {\r
                                                if(msg_entity.cvar_cl_voice_directional == 1)\r
-                                               {\r
-                                                       if(self.stat_eaten)\r
-                                                               soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE * bound(0, cvar("g_vore_soundocclusion"), 1), ATTN_MIN);\r
-                                                       else\r
-                                                               soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_MIN);\r
-                                               }\r
+                                                       soundto(MSG_ONE, self, chan, sample, vol, ATTN_MIN);\r
                                                else\r
                                                        soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE);\r
                                        }\r
@@ -1278,12 +1280,7 @@ void GlobalSound(string sample, float chan, float voicetype)
                                if(!teams_matter || msg_entity.team == self.team)\r
                                {\r
                                        if(msg_entity.cvar_cl_voice_directional == 1)\r
-                                       {\r
-                                               if(self.stat_eaten)\r
-                                                       soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE * bound(0, cvar("g_vore_soundocclusion"), 1), ATTN_MIN);\r
-                                               else\r
-                                                       soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_MIN);\r
-                                       }\r
+                                               soundto(MSG_ONE, self, chan, sample, vol, ATTN_MIN);\r
                                        else\r
                                                soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE);\r
                                }\r
@@ -1298,15 +1295,12 @@ void GlobalSound(string sample, float chan, float voicetype)
                        tauntrand = random();\r
                        FOR_EACH_REALCLIENT(msg_entity)\r
                                if (tauntrand < msg_entity.cvar_cl_autotaunt)\r
-                               if (msg_entity.cvar_cl_voice_directional >= 1)\r
                                {\r
-                                       if(self.stat_eaten)\r
-                                               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));\r
+                                       if (msg_entity.cvar_cl_voice_directional >= 1)\r
+                                               soundto(MSG_ONE, self, chan, sample, vol, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX));\r
                                        else\r
-                                               soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX));\r
+                                               soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE);\r
                                }\r
-                               else\r
-                                       soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE);\r
                        break;\r
                case VOICETYPE_TAUNT:\r
                        if(self.classname == "player")\r
@@ -1319,24 +1313,16 @@ void GlobalSound(string sample, float chan, float voicetype)
                        FOR_EACH_REALCLIENT(msg_entity)\r
                        {\r
                                if (msg_entity.cvar_cl_voice_directional >= 1)\r
-                               {\r
-                                       if(self.stat_eaten)\r
-                                               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));\r
-                                       else\r
-                                               soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX));\r
-                               }\r
+                                       soundto(MSG_ONE, self, chan, sample, vol, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX));\r
                                else\r
                                        soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE);\r
                        }\r
                case VOICETYPE_PLAYERSOUND:\r
-                       if(self.stat_eaten)\r
-                               sound(self, chan, sample, VOL_BASE * bound(0, cvar("g_vore_soundocclusion"), 1), ATTN_NORM);\r
-                       else\r
-                               sound(self, chan, sample, VOL_BASE, ATTN_NORM);\r
+                               sound(self, chan, sample, vol, ATTN_NORM);\r
                        break;\r
                case VOICETYPE_GURGLE:\r
                        if(self.stomach_load)\r
-                               sound(self, chan, sample, VOL_BASE * self.stomach_load / g_balance_vore_swallow_limit, ATTN_NORM);\r
+                               sound(self, chan, sample, vol * self.stomach_load / g_balance_vore_swallow_limit, ATTN_NORM);\r
                        else\r
                                stopsound(self, chan);\r
                        break;\r