]> git.rm.cloudns.org Git - voretournament/voretournament.git/commitdiff
If the player is dead, use the last scale he had when he was alive
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sun, 7 Aug 2011 12:31:40 +0000 (15:31 +0300)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sun, 7 Aug 2011 12:31:40 +0000 (15:31 +0300)
data/qcsrc/server/cl_client.qc

index 0f144e81878fa9e3a9b497347f79b7ad6e81bce8..2da8bd65211991ac44beb22e7b1185b8514be297 100644 (file)
@@ -2313,29 +2313,40 @@ float vercmp(string v1, string v2)
        return vercmp_recursive(v1, v2);\r
 }\r
 \r
+.float last_alive_scale;\r
 void SetPlayerSize()\r
 {\r
        if(!cvar("g_healthsize"))\r
                return;\r
 \r
-       // change player scale based on the amount of health we have\r
-       self.scale = pow(bound(cvar("g_healthsize_min"), self.health, cvar("g_healthsize_max")) / cvar("g_healthsize_center"), cvar("g_healthsize"));\r
-\r
-       // The following code sets the bounding box to match the player's size.\r
-       // It is currently disabled because of issues with engine movement prediction (cl_movement).\r
-       // The engine expects the bounding box to be default size, and changing it will cause glitches.\r
-       // This code may be enabled once the engine has the ability to use different bbox sizes for movement prediction.\r
-       if(self.crouch)\r
+       if(self.deadflag == DEAD_NO)\r
        {\r
-               //setsize (self, PL_CROUCH_MIN * self.scale, PL_CROUCH_MAX * self.scale);\r
-               if(!self.stat_eaten)\r
-               self.view_ofs = PL_CROUCH_VIEW_OFS * self.scale;\r
+               // change player scale based on the amount of health we have\r
+               self.scale = pow(bound(cvar("g_healthsize_min"), self.health, cvar("g_healthsize_max")) / cvar("g_healthsize_center"), cvar("g_healthsize"));\r
+\r
+               // The following code sets the bounding box to match the player's size.\r
+               // It is currently disabled because of issues with engine movement prediction (cl_movement).\r
+               // The engine expects the bounding box to be default size, and changing it will cause glitches.\r
+               // This code may be enabled once the engine has the ability to use different bbox sizes for movement prediction.\r
+               if(self.crouch)\r
+               {\r
+                       //setsize (self, PL_CROUCH_MIN * self.scale, PL_CROUCH_MAX * self.scale);\r
+                       if(!self.stat_eaten)\r
+                               self.view_ofs = PL_CROUCH_VIEW_OFS * self.scale;\r
+               }\r
+               else\r
+               {\r
+                       //setsize (self, PL_MIN * self.scale, PL_MAX * self.scale);\r
+                       if(!self.stat_eaten)\r
+                               self.view_ofs = PL_VIEW_OFS * self.scale;\r
+               }\r
+\r
+               self.last_alive_scale = self.scale;\r
        }\r
-       else\r
+       else if(self.last_alive_scale)\r
        {\r
-               //setsize (self, PL_MIN * self.scale, PL_MAX * self.scale);\r
-               if(!self.stat_eaten)\r
-                       self.view_ofs = PL_VIEW_OFS * self.scale;\r
+               // if the player is dead, use the last scale he had when he was alive\r
+               self.scale = self.last_alive_scale;\r
        }\r
 \r
        if(cvar("g_healthsize_death") && self.deadflag != DEAD_NO)\r