From: MirceaKitsune Date: Thu, 17 Nov 2011 16:30:25 +0000 (+0200) Subject: Enable display digits for exterior weapon too (so you won't see a hole in the screen... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=85bdc07f9e86dcdf85babed9669bb329f7a98e48;p=voretournament%2Fvoretournament.git Enable display digits for exterior weapon too (so you won't see a hole in the screen on the guns others are holding, or if you're in chase_active mode). The exterior weapon's digits will show the correct ammo too. In case you're experienced enough, you can spy on your enemy's ammo level that way ;) --- diff --git a/data/qcsrc/server/cl_weaponsystem.qc b/data/qcsrc/server/cl_weaponsystem.qc index e4fc0bd8..f78d20f7 100644 --- a/data/qcsrc/server/cl_weaponsystem.qc +++ b/data/qcsrc/server/cl_weaponsystem.qc @@ -1590,27 +1590,44 @@ void W_DisplayThink() return; } - if(gettagindex(self.owner.weaponentity, "weapon")) - setattachment(self, self.owner.weaponentity, "weapon"); - else if(gettagindex(self.owner.weaponentity, "tag_weapon")) - setattachment(self, self.owner.weaponentity, "tag_weapon"); - self.origin_z = self.owner.weaponentity.weaponentity.origin_z; - self.scale = self.owner.weaponentity.weaponentity.scale; - self.effects = self.owner.weaponentity.weaponentity.effects; - self.alpha = self.owner.weaponentity.weaponentity.alpha; - self.colormap = self.owner.weaponentity.weaponentity.colormap; - self.colormod = self.owner.weaponentity.weaponentity.colormod; // used by the regurgitating colors - self.glowmod = self.owner.weaponentity.weaponentity.glowmod; + entity gun; + if(self.team) // exterior weapon model + { + // keep the digit attached to the same bone as the weapon model + setattachment(self, self.owner, "bip01 r hand"); + gun = self.owner.exteriorweaponentity; + } + else + { + // keep the digit attached to the same bone as the weapon model + // TODO: Does this work with self-animated weapons too? + if(gettagindex(self.owner.weaponentity, "weapon")) + setattachment(self, self.owner.weaponentity, "weapon"); + else if(gettagindex(self.owner.weaponentity, "tag_weapon")) + setattachment(self, self.owner.weaponentity, "tag_weapon"); + gun = self.owner.weaponentity.weaponentity; + } + + // copy all properties of the weapon model to the digit + self.origin = gun.origin; + self.angles = gun.angles; + self.scale = gun.scale; + self.effects = gun.effects; + self.alpha = gun.alpha; + self.colormap = gun.colormap; + self.colormod = gun.colormod; // used by the regurgitating colors + self.glowmod = gun.glowmod; self.nextthink = time; } -void W_DisplaySetup(entity own, float num, float load) +void W_DisplaySetup(entity own, float num, float load, float exterior) { entity digit, e; digit = spawn(); digit.owner = own; digit.weapon = own.switchweapon; + digit.team = exterior; e = get_weaponinfo(digit.weapon); if(load) @@ -1633,9 +1650,15 @@ void W_Display(entity own, float load_num, float ammo_num) { float i; for(i = 1; i <= load_num; i += 1) - W_DisplaySetup(own, i, TRUE); // weapon load digit + { + W_DisplaySetup(own, i, TRUE, FALSE); // weapon load digit, view model + W_DisplaySetup(own, i, TRUE, TRUE); // weapon load digit, exterior model + } for(i = 1; i <= ammo_num; i += 1) - W_DisplaySetup(own, i, FALSE); // ammo count digit + { + W_DisplaySetup(own, i, FALSE, FALSE); // ammo count digit, view model + W_DisplaySetup(own, i, FALSE, TRUE); // ammo count digit, exterior model + } } void W_DecreaseAmmo(.float ammo_type, float ammo_use, float ammo_reload)