From: Samual Lenks Date: Wed, 11 Dec 2013 00:47:09 +0000 (-0500) Subject: Fix DecreaseAmmo usage X-Git-Tag: xonotic-v0.8.0~152^2~236 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ec68412ed503e7ab8425dd1c39b4e26eb4bfb476;p=xonotic%2Fxonotic-data.pk3dir.git Fix DecreaseAmmo usage --- diff --git a/qcsrc/common/weapons/w_crylink.qc b/qcsrc/common/weapons/w_crylink.qc index 3f8382864..928381ce6 100644 --- a/qcsrc/common/weapons/w_crylink.qc +++ b/qcsrc/common/weapons/w_crylink.qc @@ -341,7 +341,7 @@ void W_Crylink_Attack (void) vector forward, right, up; float maxdmg; - W_DecreaseAmmo(ammo_cells, WEP_CVAR_PRI(crylink, ammo), autocvar_g_balance_crylink_reload_ammo); + W_DecreaseAmmo(WEP_CVAR_PRI(crylink, ammo)); maxdmg = WEP_CVAR_PRI(crylink, damage) * WEP_CVAR_PRI(crylink, shots); maxdmg *= 1 + WEP_CVAR_PRI(crylink, bouncedamagefactor) * WEP_CVAR_PRI(crylink, bounces); @@ -450,7 +450,7 @@ void W_Crylink_Attack2 (void) vector forward, right, up; float maxdmg; - W_DecreaseAmmo(ammo_cells, WEP_CVAR_SEC(crylink, ammo), autocvar_g_balance_crylink_reload_ammo); + W_DecreaseAmmo(WEP_CVAR_SEC(crylink, ammo)); maxdmg = WEP_CVAR_SEC(crylink, damage) * WEP_CVAR_SEC(crylink, shots); maxdmg *= 1 + WEP_CVAR_SEC(crylink, bouncedamagefactor) * WEP_CVAR_SEC(crylink, bounces); diff --git a/qcsrc/common/weapons/w_devastator.qc b/qcsrc/common/weapons/w_devastator.qc index 3744ff81a..15d6c406f 100644 --- a/qcsrc/common/weapons/w_devastator.qc +++ b/qcsrc/common/weapons/w_devastator.qc @@ -262,7 +262,7 @@ void W_Devastator_Attack (void) entity missile; entity flash; - W_DecreaseAmmo(ammo_rockets, WEP_CVAR(devastator, ammo), WEP_CVAR(devastator, reload_ammo)); + W_DecreaseAmmo(WEP_CVAR(devastator, ammo)); W_SetupShot_ProjectileSize (self, '-3 -3 -3', '3 3 3', FALSE, 5, "weapons/rocket_fire.wav", CH_WEAPON_A, WEP_CVAR(devastator, damage)); pointparticles(particleeffectnum("rocketlauncher_muzzleflash"), w_shotorg, w_shotdir * 1000, 1); diff --git a/qcsrc/common/weapons/w_electro.qc b/qcsrc/common/weapons/w_electro.qc index 5b30a65dc..08c2f8ac0 100644 --- a/qcsrc/common/weapons/w_electro.qc +++ b/qcsrc/common/weapons/w_electro.qc @@ -241,7 +241,7 @@ void W_Electro_Attack_Bolt(void) { entity proj; - W_DecreaseAmmo(ammo_cells, WEP_CVAR_PRI(electro, ammo), autocvar_g_balance_electro_reload_ammo);//weapontodo + W_DecreaseAmmo(WEP_CVAR_PRI(electro, ammo)); W_SetupShot_ProjectileSize(self, '0 0 -3', '0 0 -3', FALSE, 2, "weapons/electro_fire.wav", CH_WEAPON_A, WEP_CVAR_PRI(electro, damage)); @@ -330,7 +330,7 @@ void W_Electro_Orb_Damage(entity inflictor, entity attacker, float damage, float void W_Electro_Attack_Orb(void) { - W_DecreaseAmmo(ammo_cells, WEP_CVAR_SEC(electro, ammo), autocvar_g_balance_electro_reload_ammo);//weapontodo + W_DecreaseAmmo(WEP_CVAR_SEC(electro, ammo)); W_SetupShot_ProjectileSize(self, '0 0 -4', '0 0 -4', FALSE, 2, "weapons/electro_fire2.wav", CH_WEAPON_A, WEP_CVAR_SEC(electro, damage)); diff --git a/qcsrc/common/weapons/w_hagar.qc b/qcsrc/common/weapons/w_hagar.qc index 20e7b7b90..4b5557852 100644 --- a/qcsrc/common/weapons/w_hagar.qc +++ b/qcsrc/common/weapons/w_hagar.qc @@ -119,7 +119,7 @@ void W_Hagar_Attack (void) { entity missile; - W_DecreaseAmmo(ammo_rockets, WEP_CVAR_PRI(hagar, ammo), autocvar_g_balance_hagar_reload_ammo); + W_DecreaseAmmo(WEP_CVAR_PRI(hagar, ammo)); W_SetupShot (self, FALSE, 2, "weapons/hagar_fire.wav", CH_WEAPON_A, WEP_CVAR_PRI(hagar, damage)); @@ -162,7 +162,7 @@ void W_Hagar_Attack2 (void) { entity missile; - W_DecreaseAmmo(ammo_rockets, WEP_CVAR_SEC(hagar, ammo), autocvar_g_balance_hagar_reload_ammo); + W_DecreaseAmmo(WEP_CVAR_SEC(hagar, ammo)); W_SetupShot (self, FALSE, 2, "weapons/hagar_fire.wav", CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage)); @@ -307,7 +307,7 @@ void W_Hagar_Attack2_Load (void) { // if we pressed primary fire while loading, unload all rockets and abort self.weaponentity.state = WS_READY; - W_DecreaseAmmo(ammo_rockets, WEP_CVAR_SEC(hagar, ammo) * self.hagar_load * -1, autocvar_g_balance_hagar_reload_ammo); // give back ammo + W_DecreaseAmmo(WEP_CVAR_SEC(hagar, ammo) * self.hagar_load * -1); // give back ammo self.hagar_load = 0; sound(self, CH_WEAPON_A, "weapons/hagar_beep.wav", VOL_BASE, ATTN_NORM); @@ -325,7 +325,7 @@ void W_Hagar_Attack2_Load (void) { if(!self.hagar_loadblock && self.hagar_loadstep < time) { - W_DecreaseAmmo(ammo_rockets, WEP_CVAR_SEC(hagar, ammo), autocvar_g_balance_hagar_reload_ammo); + W_DecreaseAmmo(WEP_CVAR_SEC(hagar, ammo)); self.weaponentity.state = WS_INUSE; self.hagar_load += 1; sound(self, CH_WEAPON_B, "weapons/hagar_load.wav", VOL_BASE * 0.8, ATTN_NORM); // sound is too loud according to most @@ -456,7 +456,7 @@ float w_hagar(float req) if(self.hagar_load) { - W_DecreaseAmmo(ammo_rockets, WEP_CVAR_SEC(hagar, ammo) * self.hagar_load * -1, autocvar_g_balance_hagar_reload_ammo); // give back ammo if necessary + W_DecreaseAmmo(WEP_CVAR_SEC(hagar, ammo) * self.hagar_load * -1); // give back ammo if necessary self.hagar_load = 0; } diff --git a/qcsrc/common/weapons/w_hlac.qc b/qcsrc/common/weapons/w_hlac.qc index d4e4b3136..d324142ab 100644 --- a/qcsrc/common/weapons/w_hlac.qc +++ b/qcsrc/common/weapons/w_hlac.qc @@ -64,7 +64,7 @@ void W_HLAC_Attack (void) entity missile; float spread; - W_DecreaseAmmo(ammo_cells, WEP_CVAR_PRI(hlac, ammo), autocvar_g_balance_hlac_reload_ammo); + W_DecreaseAmmo(WEP_CVAR_PRI(hlac, ammo)); spread = WEP_CVAR_PRI(hlac, spread_min) + (WEP_CVAR_PRI(hlac, spread_add) * self.misc_bulletcounter); spread = min(spread,WEP_CVAR_PRI(hlac, spread_max)); @@ -156,7 +156,7 @@ void W_HLAC_Attack2 (void) { float i; - W_DecreaseAmmo(ammo_cells, WEP_CVAR_SEC(hlac, ammo), autocvar_g_balance_hlac_reload_ammo); + W_DecreaseAmmo(WEP_CVAR_SEC(hlac, ammo)); for(i=WEP_CVAR_SEC(hlac, shots);i>0;--i) W_HLAC_Attack2f(); diff --git a/qcsrc/common/weapons/w_hook.qc b/qcsrc/common/weapons/w_hook.qc index 8a5cc0531..5310be536 100644 --- a/qcsrc/common/weapons/w_hook.qc +++ b/qcsrc/common/weapons/w_hook.qc @@ -129,7 +129,7 @@ void W_Hook_Attack2() { entity gren; - W_DecreaseAmmo(ammo_cells, WEP_CVAR_SEC(hook, ammo), FALSE); + W_DecreaseAmmo(WEP_CVAR_SEC(hook, ammo)); W_SetupShot (self, FALSE, 4, "weapons/hookbomb_fire.wav", CH_WEAPON_A, WEP_CVAR_SEC(hook, damage)); gren = spawn (); @@ -191,7 +191,7 @@ float w_hook(float req) if (time > self.hook_refire) if (weapon_prepareattack(0, -1)) { - W_DecreaseAmmo(ammo_fuel, WEP_CVAR_PRI(hook, ammo), FALSE); + W_DecreaseAmmo(WEP_CVAR_PRI(hook, ammo)); self.hook_state |= HOOK_FIRING; weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(hook, animtime), w_ready); } @@ -234,7 +234,7 @@ float w_hook(float req) { if ( self.ammo_fuel >= (time - self.hook_time_fueldecrease) * hooked_fuel ) { - W_DecreaseAmmo(ammo_fuel, (time - self.hook_time_fueldecrease) * hooked_fuel, FALSE); + W_DecreaseAmmo((time - self.hook_time_fueldecrease) * hooked_fuel); self.hook_time_fueldecrease = time; // decrease next frame again } diff --git a/qcsrc/common/weapons/w_machinegun.qc b/qcsrc/common/weapons/w_machinegun.qc index d6b028c2c..7a3f229e0 100644 --- a/qcsrc/common/weapons/w_machinegun.qc +++ b/qcsrc/common/weapons/w_machinegun.qc @@ -125,9 +125,9 @@ void W_UZI_Attack (float deathtype) SpawnCasing (((random () * 50 + 50) * v_right) - (v_forward * (random () * 25 + 25)) - ((random () * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, self); if (self.misc_bulletcounter == 1) - W_DecreaseAmmo(ammo_nails, WEP_CVAR(uzi, first_ammo), autocvar_g_balance_uzi_reload_ammo); + W_DecreaseAmmo(WEP_CVAR(uzi, first_ammo)); else - W_DecreaseAmmo(ammo_nails, WEP_CVAR(uzi, sustained_ammo), autocvar_g_balance_uzi_reload_ammo); + W_DecreaseAmmo(WEP_CVAR(uzi, sustained_ammo)); } // weapon frames @@ -174,7 +174,7 @@ void uzi_mode1_fire_auto() return; } - W_DecreaseAmmo(ammo_nails, WEP_CVAR(uzi, sustained_ammo), autocvar_g_balance_uzi_reload_ammo); + W_DecreaseAmmo(WEP_CVAR(uzi, sustained_ammo)); W_SetupShot (self, TRUE, 0, "weapons/uzi_fire.wav", CH_WEAPON_A, WEP_CVAR(uzi, sustained_damage)); if (!autocvar_g_norecoil) @@ -273,7 +273,7 @@ float w_uzi(float req) return FALSE; } - W_DecreaseAmmo(ammo_nails, WEP_CVAR(uzi, burst_ammo), autocvar_g_balance_uzi_reload_ammo); + W_DecreaseAmmo(WEP_CVAR(uzi, burst_ammo)); self.misc_bulletcounter = WEP_CVAR(uzi, burst) * -1; uzi_mode1_fire_burst(); diff --git a/qcsrc/common/weapons/w_minelayer.qc b/qcsrc/common/weapons/w_minelayer.qc index 4e1092eed..8449ec3d1 100644 --- a/qcsrc/common/weapons/w_minelayer.qc +++ b/qcsrc/common/weapons/w_minelayer.qc @@ -319,7 +319,7 @@ void W_Mine_Attack (void) } } - W_DecreaseAmmo(ammo_rockets, WEP_CVAR(minelayer, ammo), autocvar_g_balance_minelayer_reload_ammo); + W_DecreaseAmmo(WEP_CVAR(minelayer, ammo)); W_SetupShot_ProjectileSize (self, '-4 -4 -4', '4 4 4', FALSE, 5, "weapons/mine_fire.wav", CH_WEAPON_A, WEP_CVAR(minelayer, damage)); pointparticles(particleeffectnum("rocketlauncher_muzzleflash"), w_shotorg, w_shotdir * 1000, 1); diff --git a/qcsrc/common/weapons/w_minstanex.qc b/qcsrc/common/weapons/w_minstanex.qc index 433a5ee81..5fb10a296 100644 --- a/qcsrc/common/weapons/w_minstanex.qc +++ b/qcsrc/common/weapons/w_minstanex.qc @@ -105,7 +105,7 @@ void W_MinstaNex_Attack (void) break; } - W_DecreaseAmmo(ammo_cells, ((g_minstagib) ? 1 : WEP_CVAR_PRI(minstanex, ammo)), WEP_CVAR(minstanex, reload_ammo)); + W_DecreaseAmmo(((g_minstagib) ? 1 : WEP_CVAR_PRI(minstanex, ammo))); } float w_minstanex(float req) @@ -152,7 +152,7 @@ float w_minstanex(float req) // decrease ammo for the laser? if(WEP_CVAR_SEC(minstanex, ammo)) - W_DecreaseAmmo(ammo_cells, WEP_CVAR_SEC(minstanex, ammo), WEP_CVAR(minstanex, reload_ammo)); + W_DecreaseAmmo(WEP_CVAR_SEC(minstanex, ammo)); // ugly minstagib hack to reuse the fire mode of the laser float w; diff --git a/qcsrc/common/weapons/w_mortar.qc b/qcsrc/common/weapons/w_mortar.qc index 588d4994b..3f6316d20 100644 --- a/qcsrc/common/weapons/w_mortar.qc +++ b/qcsrc/common/weapons/w_mortar.qc @@ -216,7 +216,7 @@ void W_Grenade_Attack (void) { entity gren; - W_DecreaseAmmo(ammo_rockets, WEP_CVAR_PRI(mortar, ammo), autocvar_g_balance_mortar_reload_ammo); // WEAPONTODO + W_DecreaseAmmo(WEP_CVAR_PRI(mortar, ammo)); W_SetupShot_ProjectileSize (self, '-3 -3 -3', '3 3 3', FALSE, 4, "weapons/grenade_fire.wav", CH_WEAPON_A, WEP_CVAR_PRI(mortar, damage)); w_shotdir = v_forward; // no TrueAim for grenades please @@ -265,7 +265,7 @@ void W_Grenade_Attack2 (void) { entity gren; - W_DecreaseAmmo(ammo_rockets, WEP_CVAR_SEC(mortar, ammo), autocvar_g_balance_mortar_reload_ammo); + W_DecreaseAmmo(WEP_CVAR_SEC(mortar, ammo)); W_SetupShot_ProjectileSize (self, '-3 -3 -3', '3 3 3', FALSE, 4, "weapons/grenade_fire.wav", CH_WEAPON_A, WEP_CVAR_SEC(mortar, damage)); w_shotdir = v_forward; // no TrueAim for grenades please diff --git a/qcsrc/common/weapons/w_nex.qc b/qcsrc/common/weapons/w_nex.qc index 9c0dfbbe8..2ddf96cd4 100644 --- a/qcsrc/common/weapons/w_nex.qc +++ b/qcsrc/common/weapons/w_nex.qc @@ -109,7 +109,7 @@ void W_Nex_Attack (float issecondary) //beam and muzzle flash done on client SendCSQCNexBeamParticle(charge); - W_DecreaseAmmo(ammo_cells, myammo, autocvar_g_balance_nex_reload_ammo); + W_DecreaseAmmo(myammo); } void spawnfunc_weapon_nex (void); // defined in t_items.qc diff --git a/qcsrc/common/weapons/w_rifle.qc b/qcsrc/common/weapons/w_rifle.qc index 261eb65f6..4b07025ad 100644 --- a/qcsrc/common/weapons/w_rifle.qc +++ b/qcsrc/common/weapons/w_rifle.qc @@ -51,7 +51,7 @@ void W_Rifle_FireBullet(float pSpread, float pDamage, float pForce, float pSpeed { float i; - W_DecreaseAmmo(ammo_nails, pAmmo, autocvar_g_balance_rifle_reload_ammo); + W_DecreaseAmmo(pAmmo); W_SetupShot (self, TRUE, 2, pSound, CH_WEAPON_A, pDamage * pShots); diff --git a/qcsrc/common/weapons/w_seeker.qc b/qcsrc/common/weapons/w_seeker.qc index 5cd9dca24..e453f91b4 100644 --- a/qcsrc/common/weapons/w_seeker.qc +++ b/qcsrc/common/weapons/w_seeker.qc @@ -241,7 +241,7 @@ void W_Seeker_Fire_Missile(vector f_diff, entity m_target) { entity missile; - W_DecreaseAmmo(ammo_rockets, WEP_CVAR(seeker, missile_ammo), autocvar_g_balance_seeker_reload_ammo); + W_DecreaseAmmo(WEP_CVAR(seeker, missile_ammo)); makevectors(self.v_angle); W_SetupShot_ProjectileSize (self, '-2 -2 -2', '2 2 2', FALSE, 2, "weapons/seeker_fire.wav", CH_WEAPON_A, 0); @@ -316,7 +316,7 @@ void W_Seeker_Fire_Flac() vector f_diff; float c; - W_DecreaseAmmo(ammo_rockets, WEP_CVAR(seeker, flac_ammo), autocvar_g_balance_seeker_reload_ammo); + W_DecreaseAmmo(WEP_CVAR(seeker, flac_ammo)); c = mod(self.bulletcounter, 4); switch(c) @@ -552,7 +552,7 @@ void W_Seeker_Tag_Touch() void W_Seeker_Fire_Tag() { entity missile; - W_DecreaseAmmo(ammo_rockets, WEP_CVAR(seeker, tag_ammo), autocvar_g_balance_seeker_reload_ammo); + W_DecreaseAmmo(WEP_CVAR(seeker, tag_ammo)); W_SetupShot_ProjectileSize (self, '-2 -2 -2', '2 2 2', FALSE, 2, "weapons/tag_fire.wav", CH_WEAPON_A, WEP_CVAR(seeker, missile_damage) * WEP_CVAR(seeker, missile_count)); diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index 545d36ccc..aa6f7e6a7 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -808,13 +808,13 @@ void W_AttachToShotorg(entity flash, vector offset) } } -void W_DecreaseAmmo(.float ammo_type, float ammo_use, float ammo_reload) // WEAPONTODO: why does this have ammo_type? +void W_DecreaseAmmo(float ammo_use) { - if((self.items & IT_UNLIMITED_WEAPON_AMMO) && !ammo_reload) + if((self.items & IT_UNLIMITED_WEAPON_AMMO) && !self.reloading_ammo) return; // if this weapon is reloadable, decrease its load. Else decrease the player's ammo - if(ammo_reload) + if(self.reloading_ammo) { self.clip_load -= ammo_use; self.(weapon_load[self.weapon]) = self.clip_load;