]> git.rm.cloudns.org Git - voretournament/voretournament.git/commitdiff
Improve the new display digit implementation, and get display digits properly working...
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Thu, 15 Mar 2012 09:01:52 +0000 (11:01 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Thu, 15 Mar 2012 09:01:52 +0000 (11:01 +0200)
data/qcsrc/server/cl_weapons.qc
data/qcsrc/server/cl_weaponsystem.qc

index e377a67b1ce32d6b659ac648429fdaa2bfdae1df..dea7046d5634ed78a282a160f7a5c175bbcdf413 100644 (file)
@@ -312,9 +312,11 @@ void W_ThrowWeapon(vector velo, vector delta, float doreduce)
 };\r
 \r
 // Bringed back weapon frame\r
+.float display_setup;\r
 void W_WeaponFrame()\r
 {\r
        vector fo, ri, up;\r
+       entity e;\r
 \r
        if (frametime)\r
                self.weapon_frametime = frametime;\r
@@ -339,6 +341,30 @@ void W_WeaponFrame()
        ri = v_right;\r
        up = v_up;\r
 \r
+       if(!self.display_setup)\r
+       {\r
+               if(self.weaponentity.modelindex && self.exteriorweaponentity.modelindex)\r
+               {\r
+                       float i;\r
+                       e = get_weaponinfo(self.weapon);\r
+\r
+                       for(i = 1; fexists(strcat("models/weapons/v_", e.netname, "_digit1-", ftos(i) , ".md3")); i++)\r
+                       {\r
+                               W_DisplayDigitSetup(self, i, TRUE, FALSE); // weapon load digit, view model\r
+                               W_DisplayDigitSetup(self, i, TRUE, TRUE); // weapon load digit, exterior model\r
+                       }\r
+                       for(i = 1; fexists(strcat("models/weapons/v_", e.netname, "_digit2-", ftos(i) , ".md3")); i++)\r
+                       {\r
+                               W_DisplayDigitSetup(self, i, FALSE, FALSE); // ammo count digit, view model\r
+                               W_DisplayDigitSetup(self, i, FALSE, TRUE); // ammo count digit, exterior model\r
+                       }\r
+\r
+                       self.display_setup = TRUE;\r
+               }\r
+       }\r
+       else if(self.weapon != self.switchweapon || self.classname != "player" || self.deadflag != DEAD_NO)\r
+               self.display_setup = FALSE;\r
+\r
        // Change weapon\r
        if (self.weapon != self.switchweapon)\r
        {\r
@@ -348,10 +374,7 @@ void W_WeaponFrame()
                        self.weaponentity.state = WS_RAISE;\r
                        weapon_action(self.switchweapon, WR_SETUP);\r
 \r
-                       W_Display(self);\r
-\r
                        // set our clip load to the load of the weapon we switched to, if it's reloadable\r
-                       entity e;\r
                        e = get_weaponinfo(self.switchweapon);\r
                        if(e.spawnflags & WEP_FLAG_RELOADABLE && cvar(strcat("g_balance_", e.netname, "_reload_ammo"))) // prevent accessing undefined cvars\r
                        {\r
index 54670679781cef5acf5f69784c9f53112fb66304..2d1644ac97946878fab5c0a403807cca111e43ab 100644 (file)
@@ -1708,24 +1708,6 @@ void W_DisplayDigitSetup(entity own, float num, float load, float exterior)
        digit.nextthink = time;\r
 }\r
 \r
-void W_Display(entity own)\r
-{\r
-       float i;\r
-       entity e;\r
-       e = get_weaponinfo(own.weapon);\r
-\r
-       for(i = 1; fexists(strcat("models/weapons/v_", e.netname, "_digit1-", ftos(i) , ".md3")); i++)\r
-       {\r
-               W_DisplayDigitSetup(own, i, TRUE, FALSE); // weapon load digit, view model\r
-               W_DisplayDigitSetup(own, i, TRUE, TRUE); // weapon load digit, exterior model\r
-       }\r
-       for(i = 1; fexists(strcat("models/weapons/v_", e.netname, "_digit2-", ftos(i) , ".md3")); i++)\r
-       {\r
-               W_DisplayDigitSetup(own, i, FALSE, FALSE); // ammo count digit, view model\r
-               W_DisplayDigitSetup(own, i, FALSE, TRUE); // ammo count digit, exterior model\r
-       }\r
-}\r
-\r
 void W_DecreaseAmmo(.float ammo_type, float ammo_use, float ammo_reload)\r
 {\r
        if((self.items & IT_UNLIMITED_WEAPON_AMMO) && !ammo_reload)\r