From: MirceaKitsune Date: Sun, 7 Aug 2011 12:31:40 +0000 (+0300) Subject: If the player is dead, use the last scale he had when he was alive X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=176b32334e250bcdd2c306d45223b6e9b192aa01;p=voretournament%2Fvoretournament.git If the player is dead, use the last scale he had when he was alive --- diff --git a/data/qcsrc/server/cl_client.qc b/data/qcsrc/server/cl_client.qc index 0f144e81..2da8bd65 100644 --- a/data/qcsrc/server/cl_client.qc +++ b/data/qcsrc/server/cl_client.qc @@ -2313,29 +2313,40 @@ float vercmp(string v1, string v2) return vercmp_recursive(v1, v2); } +.float last_alive_scale; void SetPlayerSize() { if(!cvar("g_healthsize")) return; - // change player scale based on the amount of health we have - self.scale = pow(bound(cvar("g_healthsize_min"), self.health, cvar("g_healthsize_max")) / cvar("g_healthsize_center"), cvar("g_healthsize")); - - // The following code sets the bounding box to match the player's size. - // It is currently disabled because of issues with engine movement prediction (cl_movement). - // The engine expects the bounding box to be default size, and changing it will cause glitches. - // This code may be enabled once the engine has the ability to use different bbox sizes for movement prediction. - if(self.crouch) + if(self.deadflag == DEAD_NO) { - //setsize (self, PL_CROUCH_MIN * self.scale, PL_CROUCH_MAX * self.scale); - if(!self.stat_eaten) - self.view_ofs = PL_CROUCH_VIEW_OFS * self.scale; + // change player scale based on the amount of health we have + self.scale = pow(bound(cvar("g_healthsize_min"), self.health, cvar("g_healthsize_max")) / cvar("g_healthsize_center"), cvar("g_healthsize")); + + // The following code sets the bounding box to match the player's size. + // It is currently disabled because of issues with engine movement prediction (cl_movement). + // The engine expects the bounding box to be default size, and changing it will cause glitches. + // This code may be enabled once the engine has the ability to use different bbox sizes for movement prediction. + if(self.crouch) + { + //setsize (self, PL_CROUCH_MIN * self.scale, PL_CROUCH_MAX * self.scale); + if(!self.stat_eaten) + self.view_ofs = PL_CROUCH_VIEW_OFS * self.scale; + } + else + { + //setsize (self, PL_MIN * self.scale, PL_MAX * self.scale); + if(!self.stat_eaten) + self.view_ofs = PL_VIEW_OFS * self.scale; + } + + self.last_alive_scale = self.scale; } - else + else if(self.last_alive_scale) { - //setsize (self, PL_MIN * self.scale, PL_MAX * self.scale); - if(!self.stat_eaten) - self.view_ofs = PL_VIEW_OFS * self.scale; + // if the player is dead, use the last scale he had when he was alive + self.scale = self.last_alive_scale; } if(cvar("g_healthsize_death") && self.deadflag != DEAD_NO)