From: Samual Lenks Date: Mon, 1 Jul 2013 02:31:16 +0000 (-0400) Subject: Remove the weapon_setup function, it's stupid X-Git-Tag: xonotic-v0.8.0~152^2~351 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=394e6c70155ab9f4ed18ea95de5b04d586dddaef;p=xonotic%2Fxonotic-data.pk3dir.git Remove the weapon_setup function, it's stupid --- diff --git a/qcsrc/common/weapons/w_arc.qc b/qcsrc/common/weapons/w_arc.qc index 09ba8b67f..a827246ae 100644 --- a/qcsrc/common/weapons/w_arc.qc +++ b/qcsrc/common/weapons/w_arc.qc @@ -249,11 +249,6 @@ float w_arc(float req) //precache_sound ("weapons/W_Arc_Beam_fire.wav"); return TRUE; } - case WR_SETUP: - { - weapon_setup(WEP_ARC); - return TRUE; - } case WR_CHECKAMMO1: { return !WEP_CVAR_PRI(arc, ammo) || (self.ammo_cells > 0); diff --git a/qcsrc/common/weapons/w_blaster.qc b/qcsrc/common/weapons/w_blaster.qc index b755b762b..7b5721018 100644 --- a/qcsrc/common/weapons/w_blaster.qc +++ b/qcsrc/common/weapons/w_blaster.qc @@ -514,7 +514,6 @@ float W_Laser(float request) case WR_SETUP: { - weapon_setup(WEP_LASER); self.current_ammo = ammo_none; return TRUE; } diff --git a/qcsrc/common/weapons/w_crylink.qc b/qcsrc/common/weapons/w_crylink.qc index 8a107636c..b29293148 100644 --- a/qcsrc/common/weapons/w_crylink.qc +++ b/qcsrc/common/weapons/w_crylink.qc @@ -640,7 +640,6 @@ float w_crylink(float req) } case WR_SETUP: { - weapon_setup(WEP_CRYLINK); self.current_ammo = ammo_cells; return TRUE; } diff --git a/qcsrc/common/weapons/w_devastator.qc b/qcsrc/common/weapons/w_devastator.qc index 347652ef4..f14b8cd13 100644 --- a/qcsrc/common/weapons/w_devastator.qc +++ b/qcsrc/common/weapons/w_devastator.qc @@ -469,7 +469,6 @@ float W_Devastator(float req) } case WR_SETUP: { - weapon_setup(WEP_DEVASTATOR); self.current_ammo = ammo_rockets; self.rl_release = 1; return TRUE; diff --git a/qcsrc/common/weapons/w_electro.qc b/qcsrc/common/weapons/w_electro.qc index 1df1d13e4..9947da1f5 100644 --- a/qcsrc/common/weapons/w_electro.qc +++ b/qcsrc/common/weapons/w_electro.qc @@ -522,7 +522,6 @@ float w_electro(float req) } case WR_SETUP: { - weapon_setup(WEP_ELECTRO); self.current_ammo = ammo_cells; return TRUE; } diff --git a/qcsrc/common/weapons/w_fireball.qc b/qcsrc/common/weapons/w_fireball.qc index a45f08332..fc8e88ab5 100644 --- a/qcsrc/common/weapons/w_fireball.qc +++ b/qcsrc/common/weapons/w_fireball.qc @@ -401,7 +401,6 @@ float w_fireball(float req) } case WR_SETUP: { - weapon_setup(WEP_FIREBALL); self.current_ammo = ammo_none; return TRUE; } diff --git a/qcsrc/common/weapons/w_hagar.qc b/qcsrc/common/weapons/w_hagar.qc index 779333d87..814efeb26 100644 --- a/qcsrc/common/weapons/w_hagar.qc +++ b/qcsrc/common/weapons/w_hagar.qc @@ -447,7 +447,6 @@ float w_hagar(float req) } case WR_SETUP: { - weapon_setup(WEP_HAGAR); self.current_ammo = ammo_rockets; self.hagar_loadblock = FALSE; diff --git a/qcsrc/common/weapons/w_hlac.qc b/qcsrc/common/weapons/w_hlac.qc index 9079edd73..ced2505a6 100644 --- a/qcsrc/common/weapons/w_hlac.qc +++ b/qcsrc/common/weapons/w_hlac.qc @@ -212,7 +212,6 @@ float w_hlac(float req) } case WR_SETUP: { - weapon_setup(WEP_HLAC); self.current_ammo = ammo_cells; return TRUE; } diff --git a/qcsrc/common/weapons/w_hook.qc b/qcsrc/common/weapons/w_hook.qc index a9f2bad8f..a9b817006 100644 --- a/qcsrc/common/weapons/w_hook.qc +++ b/qcsrc/common/weapons/w_hook.qc @@ -291,7 +291,6 @@ float w_hook(float req) } case WR_SETUP: { - weapon_setup(WEP_HOOK); self.current_ammo = ammo_fuel; self.hook_state &~= HOOK_WAITING_FOR_RELEASE; return TRUE; diff --git a/qcsrc/common/weapons/w_machinegun.qc b/qcsrc/common/weapons/w_machinegun.qc index 216f55397..afdda53e9 100644 --- a/qcsrc/common/weapons/w_machinegun.qc +++ b/qcsrc/common/weapons/w_machinegun.qc @@ -309,7 +309,6 @@ float w_uzi(float req) } case WR_SETUP: { - weapon_setup(WEP_UZI); self.current_ammo = ammo_nails; return TRUE; } diff --git a/qcsrc/common/weapons/w_minelayer.qc b/qcsrc/common/weapons/w_minelayer.qc index 3469e3f7c..46f75bce0 100644 --- a/qcsrc/common/weapons/w_minelayer.qc +++ b/qcsrc/common/weapons/w_minelayer.qc @@ -537,7 +537,6 @@ float w_minelayer(float req) } case WR_SETUP: { - weapon_setup(WEP_MINE_LAYER); self.current_ammo = ammo_rockets; return TRUE; } diff --git a/qcsrc/common/weapons/w_minstanex.qc b/qcsrc/common/weapons/w_minstanex.qc index fd83f4bb9..37d9b8efe 100644 --- a/qcsrc/common/weapons/w_minstanex.qc +++ b/qcsrc/common/weapons/w_minstanex.qc @@ -160,7 +160,6 @@ float w_minstanex(float req) } case WR_SETUP: { - weapon_setup(WEP_MINSTANEX); self.current_ammo = ammo_cells; self.minstanex_lasthit = 0; return TRUE; diff --git a/qcsrc/common/weapons/w_mortar.qc b/qcsrc/common/weapons/w_mortar.qc index aff2122dc..ef6a36be2 100644 --- a/qcsrc/common/weapons/w_mortar.qc +++ b/qcsrc/common/weapons/w_mortar.qc @@ -391,7 +391,6 @@ float w_glauncher(float req) } case WR_SETUP: { - weapon_setup(WEP_GRENADE_LAUNCHER); self.current_ammo = ammo_rockets; return TRUE; } diff --git a/qcsrc/common/weapons/w_nex.qc b/qcsrc/common/weapons/w_nex.qc index 135111898..684622d9d 100644 --- a/qcsrc/common/weapons/w_nex.qc +++ b/qcsrc/common/weapons/w_nex.qc @@ -246,7 +246,6 @@ float w_nex(float req) } case WR_SETUP: { - weapon_setup(WEP_NEX); self.current_ammo = ammo_cells; return TRUE; } diff --git a/qcsrc/common/weapons/w_porto.qc b/qcsrc/common/weapons/w_porto.qc index 9ca3fdda0..b1618595a 100644 --- a/qcsrc/common/weapons/w_porto.qc +++ b/qcsrc/common/weapons/w_porto.qc @@ -377,7 +377,6 @@ float w_porto(float req) } case WR_SETUP: { - weapon_setup(WEP_PORTO); self.current_ammo = ammo_none; return TRUE; } diff --git a/qcsrc/common/weapons/w_rifle.qc b/qcsrc/common/weapons/w_rifle.qc index abcf6c694..869aadac6 100644 --- a/qcsrc/common/weapons/w_rifle.qc +++ b/qcsrc/common/weapons/w_rifle.qc @@ -210,7 +210,6 @@ float w_rifle(float req) } case WR_SETUP: { - weapon_setup(WEP_RIFLE); self.current_ammo = ammo_nails; return TRUE; } diff --git a/qcsrc/common/weapons/w_seeker.qc b/qcsrc/common/weapons/w_seeker.qc index 1f992c924..dd68cf34a 100644 --- a/qcsrc/common/weapons/w_seeker.qc +++ b/qcsrc/common/weapons/w_seeker.qc @@ -610,7 +610,6 @@ float w_seeker(float req) } case WR_SETUP: { - weapon_setup(WEP_SEEKER); self.current_ammo = ammo_rockets; return TRUE; } diff --git a/qcsrc/common/weapons/w_shockwave.qc b/qcsrc/common/weapons/w_shockwave.qc index af30b4ccd..bc47f7bc3 100644 --- a/qcsrc/common/weapons/w_shockwave.qc +++ b/qcsrc/common/weapons/w_shockwave.qc @@ -249,7 +249,6 @@ float w_shotgun(float req) } case WR_SETUP: { - weapon_setup(WEP_SHOTGUN); self.current_ammo = ammo_shells; return TRUE; } diff --git a/qcsrc/common/weapons/w_tuba.qc b/qcsrc/common/weapons/w_tuba.qc index 51a6120fb..a8b4ad118 100644 --- a/qcsrc/common/weapons/w_tuba.qc +++ b/qcsrc/common/weapons/w_tuba.qc @@ -403,7 +403,6 @@ float w_tuba(float req) } case WR_SETUP: { - weapon_setup(WEP_TUBA); self.current_ammo = ammo_none; self.tuba_instrument = 0; return TRUE; diff --git a/qcsrc/server/mutators/gamemode_nexball.qc b/qcsrc/server/mutators/gamemode_nexball.qc index d6dc52fbe..38d68f5c6 100644 --- a/qcsrc/server/mutators/gamemode_nexball.qc +++ b/qcsrc/server/mutators/gamemode_nexball.qc @@ -845,7 +845,7 @@ float w_nexball_weapon(float req) } else if(req == WR_SETUP) { - weapon_setup(WEP_PORTO); + //weapon_setup(WEP_PORTO); } // No need to check WR_CHECKAMMO* or WR_AIM, it should always return TRUE return TRUE; diff --git a/qcsrc/server/weapons/cl_weapons.qc b/qcsrc/server/weapons/cl_weapons.qc index 327d490e7..ee8e9115e 100644 --- a/qcsrc/server/weapons/cl_weapons.qc +++ b/qcsrc/server/weapons/cl_weapons.qc @@ -402,12 +402,17 @@ void W_WeaponFrame() { // end switching! self.switchingweapon = self.switchweapon; - entity newwep = get_weaponinfo(self.switchweapon); - //setanim(self, self.anim_draw, FALSE, TRUE, TRUE); - self.weaponentity.state = WS_RAISE; + self.items &~= IT_AMMO; + self.items = self.items | (newwep.items & IT_AMMO); + + // the two weapon entities will notice this has changed and update their models + self.weapon = self.switchweapon; + self.weaponname = newwep.mdl; + self.bulletcounter = 0; // WEAPONTODO WEP_ACTION(self.switchweapon, WR_SETUP); + self.weaponentity.state = WS_RAISE; // set our clip load to the load of the weapon we switched to, if it's reloadable if(newwep.spawnflags & WEP_FLAG_RELOADABLE && cvar(strcat("g_balance_", newwep.netname, "_reload_ammo"))) // prevent accessing undefined cvars diff --git a/qcsrc/server/weapons/main.qc b/qcsrc/server/weapons/main.qc index 83f38f9b3..c6e9e30a9 100644 --- a/qcsrc/server/weapons/main.qc +++ b/qcsrc/server/weapons/main.qc @@ -703,21 +703,6 @@ void w_ready() weapon_thinkf(WFRAME_IDLE, 1000000, w_ready); } -// Setup weapon for client (after this raise frame will be launched) -void weapon_setup(float windex) -{ - entity e; - e = get_weaponinfo(windex); - self.items &~= IT_AMMO; - self.items = self.items | (e.items & IT_AMMO); - - // the two weapon entities will notice this has changed and update their models - self.weapon = windex; - self.switchingweapon = windex; // to make sure - self.weaponname = e.mdl; - self.bulletcounter = 0; -} - // perform weapon to attack (weaponstate and attack_finished check is here) void W_SwitchToOtherWeapon(entity pl) {