From: MirceaKitsune Date: Thu, 15 Mar 2012 09:01:52 +0000 (+0200) Subject: Improve the new display digit implementation, and get display digits properly working... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=81c94c583991dafa9ab5fe0fc744726e634a673e;p=voretournament%2Fvoretournament.git Improve the new display digit implementation, and get display digits properly working with it --- diff --git a/data/qcsrc/server/cl_weapons.qc b/data/qcsrc/server/cl_weapons.qc index e377a67b..dea7046d 100644 --- a/data/qcsrc/server/cl_weapons.qc +++ b/data/qcsrc/server/cl_weapons.qc @@ -312,9 +312,11 @@ void W_ThrowWeapon(vector velo, vector delta, float doreduce) }; // Bringed back weapon frame +.float display_setup; void W_WeaponFrame() { vector fo, ri, up; + entity e; if (frametime) self.weapon_frametime = frametime; @@ -339,6 +341,30 @@ void W_WeaponFrame() ri = v_right; up = v_up; + if(!self.display_setup) + { + if(self.weaponentity.modelindex && self.exteriorweaponentity.modelindex) + { + float i; + e = get_weaponinfo(self.weapon); + + for(i = 1; fexists(strcat("models/weapons/v_", e.netname, "_digit1-", ftos(i) , ".md3")); i++) + { + W_DisplayDigitSetup(self, i, TRUE, FALSE); // weapon load digit, view model + W_DisplayDigitSetup(self, i, TRUE, TRUE); // weapon load digit, exterior model + } + for(i = 1; fexists(strcat("models/weapons/v_", e.netname, "_digit2-", ftos(i) , ".md3")); i++) + { + W_DisplayDigitSetup(self, i, FALSE, FALSE); // ammo count digit, view model + W_DisplayDigitSetup(self, i, FALSE, TRUE); // ammo count digit, exterior model + } + + self.display_setup = TRUE; + } + } + else if(self.weapon != self.switchweapon || self.classname != "player" || self.deadflag != DEAD_NO) + self.display_setup = FALSE; + // Change weapon if (self.weapon != self.switchweapon) { @@ -348,10 +374,7 @@ void W_WeaponFrame() self.weaponentity.state = WS_RAISE; weapon_action(self.switchweapon, WR_SETUP); - W_Display(self); - // set our clip load to the load of the weapon we switched to, if it's reloadable - entity e; e = get_weaponinfo(self.switchweapon); if(e.spawnflags & WEP_FLAG_RELOADABLE && cvar(strcat("g_balance_", e.netname, "_reload_ammo"))) // prevent accessing undefined cvars { diff --git a/data/qcsrc/server/cl_weaponsystem.qc b/data/qcsrc/server/cl_weaponsystem.qc index 54670679..2d1644ac 100644 --- a/data/qcsrc/server/cl_weaponsystem.qc +++ b/data/qcsrc/server/cl_weaponsystem.qc @@ -1708,24 +1708,6 @@ void W_DisplayDigitSetup(entity own, float num, float load, float exterior) digit.nextthink = time; } -void W_Display(entity own) -{ - float i; - entity e; - e = get_weaponinfo(own.weapon); - - for(i = 1; fexists(strcat("models/weapons/v_", e.netname, "_digit1-", ftos(i) , ".md3")); i++) - { - W_DisplayDigitSetup(own, i, TRUE, FALSE); // weapon load digit, view model - W_DisplayDigitSetup(own, i, TRUE, TRUE); // weapon load digit, exterior model - } - for(i = 1; fexists(strcat("models/weapons/v_", e.netname, "_digit2-", ftos(i) , ".md3")); i++) - { - W_DisplayDigitSetup(own, i, FALSE, FALSE); // ammo count digit, view model - W_DisplayDigitSetup(own, i, FALSE, TRUE); // ammo count digit, exterior model - } -} - void W_DecreaseAmmo(.float ammo_type, float ammo_use, float ammo_reload) { if((self.items & IT_UNLIMITED_WEAPON_AMMO) && !ammo_reload)