From 7355d1b2c06def5f07a1b78df0f38616df410e94 Mon Sep 17 00:00:00 2001 From: MirceaKitsune Date: Thu, 15 Mar 2012 10:51:14 +0200 Subject: [PATCH] Use a better system for initiating weapon display digits, and don't attempt to attach them each frame instead. This commit currently breaks them, and causes them to not appear on the first spawn of the player. To be fixed in the next commit... --- data/qcsrc/server/cl_weapons.qc | 2 + data/qcsrc/server/cl_weaponsystem.qc | 63 +++++++++++++++------------- data/qcsrc/server/w_grabber.qc | 1 - docs/TODO.txt | 10 ++++- 4 files changed, 44 insertions(+), 32 deletions(-) diff --git a/data/qcsrc/server/cl_weapons.qc b/data/qcsrc/server/cl_weapons.qc index 3599e378..e377a67b 100644 --- a/data/qcsrc/server/cl_weapons.qc +++ b/data/qcsrc/server/cl_weapons.qc @@ -348,6 +348,8 @@ 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); diff --git a/data/qcsrc/server/cl_weaponsystem.qc b/data/qcsrc/server/cl_weaponsystem.qc index ad316595..54670679 100644 --- a/data/qcsrc/server/cl_weaponsystem.qc +++ b/data/qcsrc/server/cl_weaponsystem.qc @@ -1597,6 +1597,8 @@ void W_SetupProjectileVelocity(entity missile, float pSpeed, float spread) void W_DisplayDigitThink() { + // dprint(strcat(ftos(gun.scale), " --------\n")); + self.nextthink = time; float w_load, w_ammo; w_load = self.owner.weapon_load[self.owner.weapon]; @@ -1611,33 +1613,15 @@ void W_DisplayDigitThink() return; } - entity gun; - if(self.dmg) // exterior weapon - { - // keep the digit attached to the same bone as the gun - setattachment(self, self.owner, "bip01 r hand"); - gun = self.owner.exteriorweaponentity; - } - else // view weapon - { - // keep the digit attached to the same bone as the gun - // 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; - } - // copy all properties of the weapon 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.origin = self.weaponentity.origin; + self.angles = self.weaponentity.angles; + self.scale = self.weaponentity.scale; + self.effects = self.weaponentity.effects; + self.alpha = self.weaponentity.alpha; + self.colormap = self.weaponentity.colormap; + self.colormod = self.weaponentity.colormod; // used by the regurgitating colors + self.glowmod = self.weaponentity.glowmod; string txt; if(self.team) // weapon load display @@ -1689,11 +1673,27 @@ void W_DisplayDigitSetup(entity own, float num, float load, float exterior) digit = spawn(); digit.owner = own; digit.weapon = own.weapon; - digit.dmg = exterior; digit.team = load; digit.cnt = num; e = get_weaponinfo(digit.weapon); + if(exterior) // exterior weapon + { + // keep the digit attached to the same bone as the gun + setattachment(digit, digit.owner, "bip01 r hand"); + digit.weaponentity = digit.owner.exteriorweaponentity; + } + else // view weapon + { + // keep the digit attached to the same bone as the gun + // TODO: Does this work with self-animated weapons too? + if(gettagindex(digit.owner.weaponentity, "weapon")) + setattachment(digit, digit.owner.weaponentity, "weapon"); + else if(gettagindex(digit.owner.weaponentity, "tag_weapon")) + setattachment(digit, digit.owner.weaponentity, "tag_weapon"); + digit.weaponentity = digit.owner.weaponentity; + } + if(load) { // weapon load digit @@ -1708,15 +1708,18 @@ void W_DisplayDigitSetup(entity own, float num, float load, float exterior) digit.nextthink = time; } -void W_Display(entity own, float load_num, float ammo_num) +void W_Display(entity own) { float i; - for(i = 1; i <= load_num; 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; i <= ammo_num; i++) + 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 diff --git a/data/qcsrc/server/w_grabber.qc b/data/qcsrc/server/w_grabber.qc index f0d34e0e..b0b2c137 100644 --- a/data/qcsrc/server/w_grabber.qc +++ b/data/qcsrc/server/w_grabber.qc @@ -219,7 +219,6 @@ float w_grabber(float req) weapon_setup(WEP_GRABBER); self.grabber_state &~= GRABBER_WAITING_FOR_RELEASE; self.current_ammo = ammo_fuel; - W_Display(self, 2, 3); } else if (req == WR_CHECKAMMO1) { diff --git a/docs/TODO.txt b/docs/TODO.txt index dcc8631e..a2afef3b 100644 --- a/docs/TODO.txt +++ b/docs/TODO.txt @@ -130,4 +130,12 @@ - 0.8: Make menu song depend on menu skin? -- 0.7: Make the insides of the color vixen character glow more \ No newline at end of file +- 0.7: Make the insides of the color vixen character glow more + +- 0.7 | 0.8: Always play the eating animations when the fire button is down? + +- 0.7 | 0.8: Rename fire keybinds to difference between weapon attach and vore attack? + +- 0.8 BUG: When you get stomach kicked, weapon reloading resets. Is this a bug, or does it actually work better? + +- 0.7: Move source branch to mediasource like Xonotic \ No newline at end of file -- 2.39.2