]> git.xonotic.org Git - voretournament/voretournament.git/commitdiff
Make the feature dependent on g_healthsize
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 3 Mar 2012 14:06:54 +0000 (16:06 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 3 Mar 2012 14:06:54 +0000 (16:06 +0200)
data/qcsrc/server/miscfunctions.qc
data/qcsrc/server/sv_main.qc

index 3d682845f02240fa801e4e6490695091d640f8b5..bcf1c1d8b09263e482a82708d3c3639fb1a1f56b 100644 (file)
@@ -2605,10 +2605,14 @@ void defer(float fdelay, void() func)
 // returns 1 if player is at minimum size and 0 if player is at normal size\r
 float playersize_micro(entity e)\r
 {\r
+       if(!cvar("g_healthsize"))\r
+               return 0;\r
        return bound(0, (e.health / cvar("g_healthsize_center") - 1) / (cvar("g_healthsize_min") / cvar("g_healthsize_center") - 1), 1);\r
 }\r
 // returns 0 if player is at normal size and 1 if player is at maximum size\r
 float playersize_macro(entity e)\r
 {\r
+       if(!cvar("g_healthsize"))\r
+               return 0;\r
        return bound(0, (e.health / cvar("g_healthsize_max") - 1) / (cvar("g_healthsize_center") / cvar("g_healthsize_max") - 1), 1);\r
 }\r
index fc1467445f725775bab0298fa6cf80b06b8b1e06..92819c2cf3b8a850be0ba19b0682656652859866 100644 (file)
@@ -106,10 +106,23 @@ void CreatureFrame (void)
                                        */\r
                                        if not(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOSTEPS)\r
                                        {\r
+                                               float micro_to_normal, normal_to_macro;\r
+                                               if(cvar("g_healthsize"))\r
+                                               {\r
+                                                       micro_to_normal = 1 - playersize_micro(self);\r
+                                                       normal_to_macro = playersize_macro(self);\r
+                                               }\r
+                                               else\r
+                                               {\r
+                                                       // healthsize is disabled, always play normal sounds\r
+                                                       micro_to_normal = 1;\r
+                                                       normal_to_macro = 0;\r
+                                               }\r
+\r
                                                if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_METALSTEPS)\r
-                                                       GlobalSound(globalsound_metalstep, CHAN_PLAYER, VOICETYPE_PLAYERSOUND, bound(0, VOL_BASE * (1 - playersize_micro(self)), 1));\r
+                                                       GlobalSound(globalsound_metalstep, CHAN_PLAYER, VOICETYPE_PLAYERSOUND, bound(0, VOL_BASE * micro_to_normal, 1));\r
                                                else\r
-                                                       GlobalSound(globalsound_step, CHAN_PLAYER, VOICETYPE_PLAYERSOUND, bound(0, VOL_BASE * (1 - playersize_micro(self)), 1));\r
+                                                       GlobalSound(globalsound_step, CHAN_PLAYER, VOICETYPE_PLAYERSOUND, bound(0, VOL_BASE * micro_to_normal, 1));\r
 \r
                                                //sound(self, CHAN_AUTO, "misc/macro_footstep.wav", VOL_BASE, ATTN_NORM);\r
                                        }\r