]> git.rm.cloudns.org Git - voretournament/voretournament.git/commitdiff
Properly get and attach all display digits
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Thu, 17 Nov 2011 16:01:34 +0000 (18:01 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Thu, 17 Nov 2011 16:01:34 +0000 (18:01 +0200)
data/qcsrc/server/cl_weaponsystem.qc
data/qcsrc/server/w_grabber.qc

index b7654b46200e038d3c613458a09ce2644cac88ea..590c42c31408b0525abba372ae794b5bd635dad6 100644 (file)
@@ -1579,7 +1579,6 @@ void W_SetupProjectileVelocity(entity missile, float pSpeed, float spread)
 #define W_SETUPPROJECTILEVELOCITY_UP(m,s) W_SetupProjectileVelocityEx(m, w_shotdir, v_up, cvar(#s "_speed"), cvar(#s "_speed_up"), cvar(#s "_speed_z"), cvar(#s "_spread"))\r
 #define W_SETUPPROJECTILEVELOCITY(m,s) W_SetupProjectileVelocityEx(m, w_shotdir, v_up, cvar(#s "_speed"), 0, 0, cvar(#s "_spread"))\r
 \r
-.float digit_type;\r
 void W_DisplayThink()\r
 {\r
        // the owner has switched to another weapon, remove the digits\r
@@ -1598,34 +1597,37 @@ void W_DisplayThink()
                setattachment(self, self.owner.weaponentity, "tag_weapon");\r
 }\r
 \r
-void W_DisplaySetup(entity own, float load_num, float ammo_num)\r
+void W_DisplaySetup(entity own, float num, float load)\r
 {\r
-       float i;\r
-       for(i = 1; i <= load_num + ammo_num; i += 1)\r
-       {\r
-               entity digit, e;\r
-               digit = spawn();\r
-               digit.owner = own;\r
-               digit.weapon = own.switchweapon;\r
-               digit.cnt = i;\r
-               digit.movetype = MOVETYPE_FOLLOW;\r
-               e = get_weaponinfo(digit.weapon);\r
+       entity digit, e;\r
+       digit = spawn();\r
+       digit.owner = own;\r
+       digit.weapon = own.switchweapon;\r
+       e = get_weaponinfo(digit.weapon);\r
 \r
-               if(i <= load_num)\r
-               {\r
-                       // weapon load digit\r
-                       digit.digit_type = 0;\r
-                       setmodel(digit, strcat("models/weapons/v_", e.netname, "_digit1-", ftos(i) , ".md3"));\r
-               }\r
-               else\r
-               {\r
-                       // ammo count digit\r
-                       digit.digit_type = 1;\r
-                       setmodel(digit, strcat("models/weapons/v_", e.netname, "_digit2-", ftos(i) , ".md3"));\r
-               }\r
-               digit.think = W_DisplayThink;\r
-               digit.nextthink = time;\r
+       if(load)\r
+       {\r
+               // weapon load digit\r
+               digit.cnt = 0;\r
+               setmodel(digit, strcat("models/weapons/v_", e.netname, "_digit1-", ftos(num) , ".md3"));\r
        }\r
+       else\r
+       {\r
+               // ammo count digit\r
+               digit.cnt = 1;\r
+               setmodel(digit, strcat("models/weapons/v_", e.netname, "_digit2-", ftos(num) , ".md3"));\r
+       }\r
+       digit.think = W_DisplayThink;\r
+       digit.nextthink = time;\r
+}\r
+\r
+void W_Display(entity own, float load_num, float ammo_num)\r
+{\r
+       float i;\r
+       for(i = 1; i <= load_num; i += 1)\r
+               W_DisplaySetup(own, i, TRUE); // weapon load digit\r
+       for(i = 1; i <= ammo_num; i += 1)\r
+               W_DisplaySetup(own, i, FALSE); // ammo count digit\r
 }\r
 \r
 void W_DecreaseAmmo(.float ammo_type, float ammo_use, float ammo_reload)\r
index 9e007f9fe580a4d39b3f09037c6795fb4af6f972..f738a1edbd4cdbbfdac136803f0af7b6fd9052ad 100644 (file)
@@ -214,7 +214,7 @@ float w_grabber(float req)
                weapon_setup(WEP_GRABBER);\r
                self.grabber_state &~= GRABBER_WAITING_FOR_RELEASE;\r
                self.current_ammo = ammo_fuel;\r
-               W_DisplaySetup(self, 2, 3);\r
+               W_Display(self, 2, 3);\r
        }\r
        else if (req == WR_CHECKAMMO1)\r
        {\r