From 616e31162104390e7b756b32ce906c008f1b177d Mon Sep 17 00:00:00 2001 From: MirceaKitsune Date: Tue, 2 Aug 2011 13:44:59 +0300 Subject: [PATCH] Don't allow player / weapon model scale to go under 0 --- data/qcsrc/server/cl_client.qc | 2 ++ data/qcsrc/server/cl_weaponsystem.qc | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/data/qcsrc/server/cl_client.qc b/data/qcsrc/server/cl_client.qc index 00849938..2b01ef06 100644 --- a/data/qcsrc/server/cl_client.qc +++ b/data/qcsrc/server/cl_client.qc @@ -2317,6 +2317,8 @@ void SetPlayerSize() // change player scale based on the amount of health we have self.scale = bound(cvar("g_healthsize_min"), self.health, cvar("g_healthsize_max")) / cvar("g_healthsize"); + if(self.scale <= 0) + self.scale = 0.00001; // 0 becomes 1 for scale, so do this to allow almost 0 scale // 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). diff --git a/data/qcsrc/server/cl_weaponsystem.qc b/data/qcsrc/server/cl_weaponsystem.qc index e76ebbf1..1434ac32 100644 --- a/data/qcsrc/server/cl_weaponsystem.qc +++ b/data/qcsrc/server/cl_weaponsystem.qc @@ -755,10 +755,11 @@ void CL_Weaponentity_Think() // create or update the lasertarget entity // if we are a micro or macro, size the weapon model accordingly - if(self.owner.scale && cvar("g_healthsize_weapon_scalefactor")) - if(self.model != "") + if(cvar("g_healthsize") && cvar("g_healthsize_weapon_scalefactor")) { self.weaponentity.scale = (1 + cvar("g_healthsize_weapon_scalefactor")) - cvar("g_healthsize_weapon_scalefactor") * self.owner.scale; + if(self.weaponentity.scale <= 0) + self.weaponentity.scale = 0.00001; // 0 becomes 1 for scale, so do this to allow almost 0 scale self.weaponentity.origin_z = (1 - self.weaponentity.scale) * cvar("g_healthsize_weapon_scalefactor_pos"); } }; -- 2.39.2