From: MirceaKitsune Date: Thu, 17 Nov 2011 16:01:34 +0000 (+0200) Subject: Properly get and attach all display digits X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=bfbf86043cf0303fa76a19c44ca2ae680602afa3;p=voretournament%2Fvoretournament.git Properly get and attach all display digits --- diff --git a/data/qcsrc/server/cl_weaponsystem.qc b/data/qcsrc/server/cl_weaponsystem.qc index b7654b46..590c42c3 100644 --- a/data/qcsrc/server/cl_weaponsystem.qc +++ b/data/qcsrc/server/cl_weaponsystem.qc @@ -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")) #define W_SETUPPROJECTILEVELOCITY(m,s) W_SetupProjectileVelocityEx(m, w_shotdir, v_up, cvar(#s "_speed"), 0, 0, cvar(#s "_spread")) -.float digit_type; void W_DisplayThink() { // the owner has switched to another weapon, remove the digits @@ -1598,34 +1597,37 @@ void W_DisplayThink() setattachment(self, self.owner.weaponentity, "tag_weapon"); } -void W_DisplaySetup(entity own, float load_num, float ammo_num) +void W_DisplaySetup(entity own, float num, float load) { - float i; - for(i = 1; i <= load_num + ammo_num; i += 1) - { - entity digit, e; - digit = spawn(); - digit.owner = own; - digit.weapon = own.switchweapon; - digit.cnt = i; - digit.movetype = MOVETYPE_FOLLOW; - e = get_weaponinfo(digit.weapon); + entity digit, e; + digit = spawn(); + digit.owner = own; + digit.weapon = own.switchweapon; + e = get_weaponinfo(digit.weapon); - if(i <= load_num) - { - // weapon load digit - digit.digit_type = 0; - setmodel(digit, strcat("models/weapons/v_", e.netname, "_digit1-", ftos(i) , ".md3")); - } - else - { - // ammo count digit - digit.digit_type = 1; - setmodel(digit, strcat("models/weapons/v_", e.netname, "_digit2-", ftos(i) , ".md3")); - } - digit.think = W_DisplayThink; - digit.nextthink = time; + if(load) + { + // weapon load digit + digit.cnt = 0; + setmodel(digit, strcat("models/weapons/v_", e.netname, "_digit1-", ftos(num) , ".md3")); } + else + { + // ammo count digit + digit.cnt = 1; + setmodel(digit, strcat("models/weapons/v_", e.netname, "_digit2-", ftos(num) , ".md3")); + } + digit.think = W_DisplayThink; + digit.nextthink = time; +} + +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 + for(i = 1; i <= ammo_num; i += 1) + W_DisplaySetup(own, i, FALSE); // ammo count digit } void W_DecreaseAmmo(.float ammo_type, float ammo_use, float ammo_reload) diff --git a/data/qcsrc/server/w_grabber.qc b/data/qcsrc/server/w_grabber.qc index 9e007f9f..f738a1ed 100644 --- a/data/qcsrc/server/w_grabber.qc +++ b/data/qcsrc/server/w_grabber.qc @@ -214,7 +214,7 @@ float w_grabber(float req) weapon_setup(WEP_GRABBER); self.grabber_state &~= GRABBER_WAITING_FOR_RELEASE; self.current_ammo = ammo_fuel; - W_DisplaySetup(self, 2, 3); + W_Display(self, 2, 3); } else if (req == WR_CHECKAMMO1) {