From: Martin Taibr Date: Mon, 2 Sep 2019 12:32:32 +0000 (+0200) Subject: remove IT_UNLIMITED_BOTH X-Git-Tag: xonotic-v0.8.5~1274^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=590a5297bd4ad3b00dde7efc20d6cc860be4f853;p=xonotic%2Fxonotic-data.pk3dir.git remove IT_UNLIMITED_BOTH --- diff --git a/qcsrc/client/hud/panel/ammo.qc b/qcsrc/client/hud/panel/ammo.qc index bd9aa1a21..95ceced82 100644 --- a/qcsrc/client/hud/panel/ammo.qc +++ b/qcsrc/client/hud/panel/ammo.qc @@ -177,7 +177,7 @@ void HUD_Ammo() Weapon wep = wepent.switchweapon; int i; - bool infinite_ammo = (STAT(ITEMS) & IT_UNLIMITED_WEAPON_AMMO); + bool infinite_ammo = (STAT(ITEMS) & IT_UNLIMITED_AMMO); row = column = 0; if(autocvar_hud_panel_ammo_onlycurrent) { diff --git a/qcsrc/client/hud/panel/weapons.qc b/qcsrc/client/hud/panel/weapons.qc index ac32e23cb..fef3eec09 100644 --- a/qcsrc/client/hud/panel/weapons.qc +++ b/qcsrc/client/hud/panel/weapons.qc @@ -63,7 +63,7 @@ void HUD_Weapons() float when = max(1, autocvar_hud_panel_weapons_complainbubble_time); float fadetime = max(0, autocvar_hud_panel_weapons_complainbubble_fadetime); - bool infinite_ammo = (STAT(ITEMS) & IT_UNLIMITED_WEAPON_AMMO); + bool infinite_ammo = (STAT(ITEMS) & IT_UNLIMITED_AMMO); vector weapon_pos, weapon_size = '0 0 0'; vector color; diff --git a/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc b/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc index c966e16d8..408a14e0d 100644 --- a/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc +++ b/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc @@ -333,7 +333,7 @@ MUTATOR_HOOKFUNCTION(ca, GiveFragsForKill, CBC_ORDER_FIRST) MUTATOR_HOOKFUNCTION(ca, SetStartItems) { - start_items &= ~IT_UNLIMITED_BOTH; + start_items &= ~(IT_UNLIMITED_AMMO | IT_UNLIMITED_SUPERWEAPONS); start_health = warmup_start_health = cvar("g_lms_start_health"); start_armorvalue = warmup_start_armorvalue = cvar("g_lms_start_armor"); start_ammo_shells = warmup_start_ammo_shells = cvar("g_lms_start_ammo_shells"); diff --git a/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc b/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc index ed0209a7a..54f6268e3 100644 --- a/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc +++ b/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc @@ -549,7 +549,7 @@ MUTATOR_HOOKFUNCTION(ft, PlayerPreThink, CBC_ORDER_FIRST) MUTATOR_HOOKFUNCTION(ft, SetStartItems) { - start_items &= ~IT_UNLIMITED_BOTH; + start_items &= ~(IT_UNLIMITED_AMMO | IT_UNLIMITED_SUPERWEAPONS); //start_health = warmup_start_health = cvar("g_lms_start_health"); //start_armorvalue = warmup_start_armorvalue = cvar("g_lms_start_armor"); start_ammo_shells = warmup_start_ammo_shells = cvar("g_lms_start_ammo_shells"); diff --git a/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc b/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc index 6df1cb130..aceb66e03 100644 --- a/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc +++ b/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc @@ -323,7 +323,7 @@ MUTATOR_HOOKFUNCTION(lms, GiveFragsForKill) MUTATOR_HOOKFUNCTION(lms, SetStartItems) { - start_items &= ~IT_UNLIMITED_BOTH; + start_items &= ~(IT_UNLIMITED_AMMO | IT_UNLIMITED_SUPERWEAPONS); start_health = warmup_start_health = cvar("g_lms_start_health"); start_armorvalue = warmup_start_armorvalue = cvar("g_lms_start_armor"); start_ammo_shells = warmup_start_ammo_shells = cvar("g_lms_start_ammo_shells"); diff --git a/qcsrc/common/items/item.qh b/qcsrc/common/items/item.qh index 1f01790d2..8ba009671 100644 --- a/qcsrc/common/items/item.qh +++ b/qcsrc/common/items/item.qh @@ -11,7 +11,7 @@ #include #endif -const int IT_UNLIMITED_WEAPON_AMMO = BIT(0); // when this bit is set, using a weapon does not reduce ammo. Checkpoints can give this powerup. +const int IT_UNLIMITED_AMMO = BIT(0); // when this bit is set, using a weapon does not reduce ammo. Checkpoints can give this powerup. const int IT_UNLIMITED_SUPERWEAPONS = BIT(1); // when this bit is set, superweapons don't expire. Checkpoints can give this powerup. const int IT_JETPACK = BIT(2); // actual item @@ -44,8 +44,7 @@ const int IT_SUPERWEAPON = BIT(21); // suit const int IT_STRENGTH = BIT(22); // item masks -const int IT_UNLIMITED_BOTH = IT_UNLIMITED_WEAPON_AMMO | IT_UNLIMITED_SUPERWEAPONS; -const int IT_PICKUPMASK = IT_UNLIMITED_BOTH | IT_JETPACK | IT_FUEL_REGEN; // strength and invincible are handled separately +const int IT_PICKUPMASK = IT_UNLIMITED_AMMO | IT_UNLIMITED_SUPERWEAPONS | IT_JETPACK | IT_FUEL_REGEN; // strength and invincible are handled separately #ifdef SVQC const .float strength_finished = _STAT(STRENGTH_FINISHED); diff --git a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc index d25c3151f..7dc4461df 100644 --- a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc @@ -212,7 +212,7 @@ float buff_Available(entity buff) { if (buff == BUFF_Null) return false; - if (buff == BUFF_AMMO && ((start_items & IT_UNLIMITED_WEAPON_AMMO) || (start_items & IT_UNLIMITED_BOTH) || (cvar("g_melee_only")))) + if (buff == BUFF_AMMO && ((start_items & IT_UNLIMITED_AMMO) || cvar("g_melee_only"))) return false; if (buff == BUFF_VAMPIRE && cvar("g_vampire")) return false; @@ -918,8 +918,8 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink) BUFF_ONADD(BUFF_AMMO) { - player.buff_ammo_prev_infitems = (player.items & IT_UNLIMITED_WEAPON_AMMO); - player.items |= IT_UNLIMITED_WEAPON_AMMO; + player.buff_ammo_prev_infitems = (player.items & IT_UNLIMITED_AMMO); + player.items |= IT_UNLIMITED_AMMO; if(STAT(BUFFS, player) & BUFF_AMMO.m_itemid) { @@ -937,9 +937,9 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink) BUFF_ONREM(BUFF_AMMO) { if(player.buff_ammo_prev_infitems) - player.items |= IT_UNLIMITED_WEAPON_AMMO; + player.items |= IT_UNLIMITED_AMMO; else - player.items &= ~IT_UNLIMITED_WEAPON_AMMO; + player.items &= ~IT_UNLIMITED_AMMO; if(STAT(BUFFS, player) & BUFF_AMMO.m_itemid) { diff --git a/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc index 63f3182ea..c4f4b5d00 100644 --- a/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc +++ b/qcsrc/common/mutators/mutator/instagib/sv_instagib.qc @@ -82,7 +82,7 @@ void instagib_ammocheck(entity this) if(IS_DEAD(this) || game_stopped) instagib_stop_countdown(this); - else if (GetResource(this, RES_CELLS) > 0 || (this.items & IT_UNLIMITED_WEAPON_AMMO) || (this.flags & FL_GODMODE)) + else if (GetResource(this, RES_CELLS) > 0 || (this.items & IT_UNLIMITED_AMMO) || (this.flags & FL_GODMODE)) instagib_stop_countdown(this); else if(autocvar_g_rm && autocvar_g_rm_laser) { diff --git a/qcsrc/common/mutators/mutator/nix/sv_nix.qc b/qcsrc/common/mutators/mutator/nix/sv_nix.qc index efe8ee3ae..7214a699e 100644 --- a/qcsrc/common/mutators/mutator/nix/sv_nix.qc +++ b/qcsrc/common/mutators/mutator/nix/sv_nix.qc @@ -140,7 +140,7 @@ void NIX_GiveCurrentWeapon(entity this) SetResource(this, RES_CELLS, 0); SetResource(this, RES_PLASMA, 0); SetResource(this, RES_FUEL, 0); - if(this.items & IT_UNLIMITED_WEAPON_AMMO) + if(this.items & IT_UNLIMITED_AMMO) { switch (wpn.ammo_type) { @@ -193,7 +193,7 @@ void NIX_GiveCurrentWeapon(entity this) Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_NIX_COUNTDOWN, nix_nextweapon, dt); } - if(!(this.items & IT_UNLIMITED_WEAPON_AMMO) && time > this.nix_nextincr) + if(!(this.items & IT_UNLIMITED_AMMO) && time > this.nix_nextincr) { switch (wpn.ammo_type) { diff --git a/qcsrc/common/mutators/mutator/overkill/okhmg.qc b/qcsrc/common/mutators/mutator/overkill/okhmg.qc index bee61f2fe..df55fb88c 100644 --- a/qcsrc/common/mutators/mutator/overkill/okhmg.qc +++ b/qcsrc/common/mutators/mutator/overkill/okhmg.qc @@ -18,7 +18,7 @@ void W_OverkillHeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity return; } - if((!thiswep.wr_checkammo1(thiswep, actor, weaponentity) && !(actor.items & IT_UNLIMITED_WEAPON_AMMO)) || (!(actor.items & IT_SUPERWEAPON) && !(actor.items & IT_UNLIMITED_SUPERWEAPONS))) + if((!thiswep.wr_checkammo1(thiswep, actor, weaponentity) && !(actor.items & IT_UNLIMITED_AMMO)) || (!(actor.items & IT_SUPERWEAPON) && !(actor.items & IT_UNLIMITED_SUPERWEAPONS))) { W_SwitchWeapon_Force(actor, w_getbestweapon(actor, weaponentity), weaponentity); w_ready(thiswep, actor, weaponentity, fire); diff --git a/qcsrc/common/mutators/mutator/overkill/okmachinegun.qc b/qcsrc/common/mutators/mutator/overkill/okmachinegun.qc index f8dfa89fe..768e364a7 100644 --- a/qcsrc/common/mutators/mutator/overkill/okmachinegun.qc +++ b/qcsrc/common/mutators/mutator/overkill/okmachinegun.qc @@ -13,7 +13,7 @@ void W_OverkillMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weap } if(!thiswep.wr_checkammo1(thiswep, actor, weaponentity)) - if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO)) + if(!(actor.items & IT_UNLIMITED_AMMO)) { W_SwitchWeapon_Force(actor, w_getbestweapon(actor, weaponentity), weaponentity); w_ready(thiswep, actor, weaponentity, fire); diff --git a/qcsrc/common/mutators/mutator/overkill/oknex.qc b/qcsrc/common/mutators/mutator/overkill/oknex.qc index cbcc285a5..83a3a3cc0 100644 --- a/qcsrc/common/mutators/mutator/overkill/oknex.qc +++ b/qcsrc/common/mutators/mutator/overkill/oknex.qc @@ -221,7 +221,7 @@ METHOD(OverkillNex, wr_think, void(entity thiswep, entity actor, .entity weapone // if(fire & 2) // only eat ammo when the button is pressed // { // dt = min(dt, (1 - actor.(weaponentity).oknex_charge) / WEP_CVAR(oknex, charge_rate)); - // if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO)) + // if(!(actor.items & IT_UNLIMITED_AMMO)) // { // // if this weapon is reloadable, decrease its load. Else decrease the player's ammo // if(autocvar_g_balance_vortex_reload_ammo) diff --git a/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc index dbcda2d59..8176669de 100644 --- a/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc +++ b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc @@ -276,7 +276,7 @@ MUTATOR_HOOKFUNCTION(ok, SetStartItems, CBC_ORDER_LAST) // this gives unlimited ammo (the 4 types) but not fuel // using `g_use_ammunition` instead gives also fuel which is unnecessary and distracting in the HUD - start_items |= IT_UNLIMITED_WEAPON_AMMO; + start_items |= IT_UNLIMITED_AMMO; start_weapons = warmup_start_weapons = ok_start_items; } diff --git a/qcsrc/common/physics/player.qc b/qcsrc/common/physics/player.qc index acef8c97a..251bf995a 100644 --- a/qcsrc/common/physics/player.qc +++ b/qcsrc/common/physics/player.qc @@ -472,7 +472,7 @@ void CheckPlayerJump(entity this) bool air_jump = !playerjump || M_ARGV(2, bool); bool activate = JETPACK_JUMP(this) && air_jump && PHYS_INPUT_BUTTON_JUMP(this) || PHYS_INPUT_BUTTON_JETPACK(this); - bool has_fuel = !PHYS_JETPACK_FUEL(this) || PHYS_AMMO_FUEL(this) || (ITEMS_STAT(this) & IT_UNLIMITED_WEAPON_AMMO); + bool has_fuel = !PHYS_JETPACK_FUEL(this) || PHYS_AMMO_FUEL(this) || (ITEMS_STAT(this) & IT_UNLIMITED_AMMO); if (!(ITEMS_STAT(this) & ITEM_Jetpack.m_itemid)) { } else if (this.jetpack_stopped) { } @@ -785,7 +785,7 @@ void PM_jetpack(entity this, float maxspd_mod, float dt) wishvel_z = (wishvel_z - PHYS_GRAVITY(this)) * fz + PHYS_GRAVITY(this); fvel = min(1, vlen(wishvel) / best); - if (PHYS_JETPACK_FUEL(this) && !(ITEMS_STAT(this) & IT_UNLIMITED_WEAPON_AMMO)) + if (PHYS_JETPACK_FUEL(this) && !(ITEMS_STAT(this) & IT_UNLIMITED_AMMO)) f = min(1, PHYS_AMMO_FUEL(this) / (PHYS_JETPACK_FUEL(this) * dt * fvel)); else f = 1; @@ -798,7 +798,7 @@ void PM_jetpack(entity this, float maxspd_mod, float dt) UNSET_ONGROUND(this); #ifdef SVQC - if (!(ITEMS_STAT(this) & IT_UNLIMITED_WEAPON_AMMO)) + if (!(ITEMS_STAT(this) & IT_UNLIMITED_AMMO)) TakeResource(this, RES_FUEL, PHYS_JETPACK_FUEL(this) * dt * fvel * f); ITEMS_STAT(this) |= IT_USING_JETPACK; diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index 663f14be8..a1476ae14 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -1477,9 +1477,6 @@ void target_items_use(entity this, entity actor, entity trigger) spawnfunc(target_items) { - int n; - string s; - this.use = target_items_use; if(!this.strength_finished) this.strength_finished = autocvar_g_balance_powerup_strength_time; @@ -1488,7 +1485,7 @@ spawnfunc(target_items) if(!this.superweapons_finished) this.superweapons_finished = autocvar_g_balance_superweapons_time; - n = tokenize_console(this.netname); + int n = tokenize_console(this.netname); if(argv(0) == "give") { this.netname = substring(this.netname, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)); @@ -1497,8 +1494,9 @@ spawnfunc(target_items) { for(int j = 0; j < n; ++j) { - if (argv(j) == "unlimited_ammo") this.items |= IT_UNLIMITED_BOTH; - else if(argv(j) == "unlimited_weapon_ammo") this.items |= IT_UNLIMITED_WEAPON_AMMO; + // this is from a time when unlimited superweapons were handled together with ammo in some parts of the code + if (argv(j) == "unlimited_ammo") this.items |= IT_UNLIMITED_AMMO | IT_UNLIMITED_SUPERWEAPONS; + else if(argv(j) == "unlimited_weapon_ammo") this.items |= IT_UNLIMITED_AMMO; else if(argv(j) == "unlimited_superweapons") this.items |= IT_UNLIMITED_SUPERWEAPONS; else if(argv(j) == "strength") this.items |= ITEM_Strength.m_itemid; else if(argv(j) == "invincible") this.items |= ITEM_Shield.m_itemid; @@ -1509,7 +1507,7 @@ spawnfunc(target_items) { FOREACH(Buffs, it != BUFF_Null, { - s = Buff_UndeprecateName(argv(j)); + string s = Buff_UndeprecateName(argv(j)); if(s == it.netname) { STAT(BUFFS, this) |= (it.m_itemid); @@ -1519,7 +1517,7 @@ spawnfunc(target_items) } }); FOREACH(Weapons, it != WEP_Null, { - s = W_UndeprecateName(argv(j)); + string s = W_UndeprecateName(argv(j)); if(s == it.netname) { STAT(WEAPONS, this) |= (it.m_wepset); @@ -1559,7 +1557,7 @@ spawnfunc(target_items) } this.netname = ""; - this.netname = sprintf("%s %s%d %s", this.netname, itemprefix, boolean(this.items & IT_UNLIMITED_WEAPON_AMMO), "unlimited_weapon_ammo"); + this.netname = sprintf("%s %s%d %s", this.netname, itemprefix, boolean(this.items & IT_UNLIMITED_AMMO), "unlimited_weapon_ammo"); this.netname = sprintf("%s %s%d %s", this.netname, itemprefix, boolean(this.items & IT_UNLIMITED_SUPERWEAPONS), "unlimited_superweapons"); this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, this.strength_finished * boolean(this.items & ITEM_Strength.m_itemid), "strength"); this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, this.invincible_finished * boolean(this.items & ITEM_Shield.m_itemid), "invincible"); @@ -1763,7 +1761,7 @@ float GiveItems(entity e, float beginarg, float endarg) got += GiveValue(e, strength_finished, op, val); got += GiveValue(e, invincible_finished, op, val); got += GiveValue(e, superweapons_finished, op, val); - got += GiveBit(e, items, IT_UNLIMITED_BOTH, op, val); + got += GiveBit(e, items, IT_UNLIMITED_AMMO | IT_UNLIMITED_SUPERWEAPONS, op, val); case "all": got += GiveBit(e, items, ITEM_Jetpack.m_itemid, op, val); got += GiveResourceValue(e, RES_HEALTH, op, val); @@ -1781,10 +1779,11 @@ float GiveItems(entity e, float beginarg, float endarg) got += GiveResourceValue(e, RES_FUEL, op, val); break; case "unlimited_ammo": - got += GiveBit(e, items, IT_UNLIMITED_BOTH, op, val); + // this is from a time when unlimited superweapons were handled together with ammo in some parts of the code + got += GiveBit(e, items, IT_UNLIMITED_AMMO | IT_UNLIMITED_SUPERWEAPONS, op, val); break; case "unlimited_weapon_ammo": - got += GiveBit(e, items, IT_UNLIMITED_WEAPON_AMMO, op, val); + got += GiveBit(e, items, IT_UNLIMITED_AMMO, op, val); break; case "unlimited_superweapons": got += GiveBit(e, items, IT_UNLIMITED_SUPERWEAPONS, op, val); @@ -1847,7 +1846,7 @@ float GiveItems(entity e, float beginarg, float endarg) POSTGIVE_BIT(e, items, ITEM_JetpackRegen.m_itemid, SND_ITEMPICKUP, SND_Null); POSTGIVE_BIT(e, items, IT_UNLIMITED_SUPERWEAPONS, SND_POWERUP, SND_POWEROFF); - POSTGIVE_BIT(e, items, IT_UNLIMITED_WEAPON_AMMO, SND_POWERUP, SND_POWEROFF); + POSTGIVE_BIT(e, items, IT_UNLIMITED_AMMO, SND_POWERUP, SND_POWEROFF); POSTGIVE_BIT(e, items, ITEM_Jetpack.m_itemid, SND_ITEMPICKUP, SND_Null); FOREACH(Weapons, it != WEP_Null, { POSTGIVE_WEAPON(e, it, SND_WEAPONPICKUP, SND_Null); diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index 6efb21495..5948d6a12 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -232,7 +232,7 @@ void W_Arc_Beam_Think(entity this) } if(this == own.(weaponentity).arc_beam) { own.(weaponentity).arc_beam = NULL; } - if(!thiswep.wr_checkammo1(thiswep, own, weaponentity) && !(own.items & IT_UNLIMITED_WEAPON_AMMO)) + if(!thiswep.wr_checkammo1(thiswep, own, weaponentity) && !(own.items & IT_UNLIMITED_AMMO)) { // note: this doesn't force the switch W_SwitchToOtherWeapon(own, weaponentity); @@ -244,7 +244,7 @@ void W_Arc_Beam_Think(entity this) // decrease ammo float coefficient = frametime; - if(!(own.items & IT_UNLIMITED_WEAPON_AMMO)) + if(!(own.items & IT_UNLIMITED_AMMO)) { float rootammo; if(burst) diff --git a/qcsrc/common/weapons/weapon/crylink.qc b/qcsrc/common/weapons/weapon/crylink.qc index 358914635..2a42f475b 100644 --- a/qcsrc/common/weapons/weapon/crylink.qc +++ b/qcsrc/common/weapons/weapon/crylink.qc @@ -568,7 +568,7 @@ METHOD(Crylink, wr_think, void(entity thiswep, entity actor, .entity weaponentit } actor.(weaponentity).crylink_waitrelease = 0; if(!thiswep.wr_checkammo1(thiswep, actor, weaponentity) && !thiswep.wr_checkammo2(thiswep, actor, weaponentity)) - if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO)) + if(!(actor.items & IT_UNLIMITED_AMMO)) { // ran out of ammo! actor.cnt = thiswep.m_id; diff --git a/qcsrc/common/weapons/weapon/devastator.qc b/qcsrc/common/weapons/weapon/devastator.qc index 5654488dd..62b7b556f 100644 --- a/qcsrc/common/weapons/weapon/devastator.qc +++ b/qcsrc/common/weapons/weapon/devastator.qc @@ -47,7 +47,7 @@ void W_Devastator_Explode(entity this, entity directhitentity) if(this.realowner.(weaponentity).m_weapon == thiswep) { if(GetResource(this.realowner, thiswep.ammo_type) < WEP_CVAR(devastator, ammo)) - if(!(this.realowner.items & IT_UNLIMITED_WEAPON_AMMO)) + if(!(this.realowner.items & IT_UNLIMITED_AMMO)) { this.realowner.cnt = thiswep.m_id; ATTACK_FINISHED(this.realowner, weaponentity) = time; @@ -140,7 +140,7 @@ void W_Devastator_DoRemoteExplode(entity this, .entity weaponentity) if(this.realowner.(weaponentity).m_weapon == thiswep) { if(GetResource(this.realowner, thiswep.ammo_type) < WEP_CVAR(devastator, ammo)) - if(!(this.realowner.items & IT_UNLIMITED_WEAPON_AMMO)) + if(!(this.realowner.items & IT_UNLIMITED_AMMO)) { this.realowner.cnt = thiswep.m_id; ATTACK_FINISHED(this.realowner, weaponentity) = time; diff --git a/qcsrc/common/weapons/weapon/hagar.qc b/qcsrc/common/weapons/weapon/hagar.qc index 51699bf0c..0ffa0c74d 100644 --- a/qcsrc/common/weapons/weapon/hagar.qc +++ b/qcsrc/common/weapons/weapon/hagar.qc @@ -264,7 +264,7 @@ void W_Hagar_Attack2_Load(Weapon thiswep, entity actor, .entity weaponentity) // this is different than WR_CHECKAMMO when it comes to reloading bool enough_ammo; - if(actor.items & IT_UNLIMITED_WEAPON_AMMO) + if(actor.items & IT_UNLIMITED_AMMO) enough_ammo = true; else if(autocvar_g_balance_hagar_reload_ammo) enough_ammo = actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(hagar, ammo); @@ -352,7 +352,7 @@ void W_Hagar_Attack2_Load(Weapon thiswep, entity actor, .entity weaponentity) // we aren't checking ammo during an attack, so we must do it here if(!(thiswep.wr_checkammo1(thiswep, actor, weaponentity) + thiswep.wr_checkammo2(thiswep, actor, weaponentity))) - if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO)) + if(!(actor.items & IT_UNLIMITED_AMMO)) { // note: this doesn't force the switch W_SwitchToOtherWeapon(actor, weaponentity); @@ -370,7 +370,7 @@ void W_Hagar_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity, int } if(!thiswep.wr_checkammo1(thiswep, actor, weaponentity)) - if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO)) + if(!(actor.items & IT_UNLIMITED_AMMO)) { W_SwitchWeapon_Force(actor, w_getbestweapon(actor, weaponentity), weaponentity); w_ready(thiswep, actor, weaponentity, fire); diff --git a/qcsrc/common/weapons/weapon/hlac.qc b/qcsrc/common/weapons/weapon/hlac.qc index 849859763..6511d22b5 100644 --- a/qcsrc/common/weapons/weapon/hlac.qc +++ b/qcsrc/common/weapons/weapon/hlac.qc @@ -127,7 +127,7 @@ void W_HLAC_Attack_Frame(Weapon thiswep, entity actor, .entity weaponentity, int if(PHYS_INPUT_BUTTON_ATCK(actor)) { if(!thiswep.wr_checkammo1(thiswep, actor, weaponentity)) - if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO)) + if(!(actor.items & IT_UNLIMITED_AMMO)) { W_SwitchWeapon_Force(actor, w_getbestweapon(actor, weaponentity), weaponentity); w_ready(thiswep, actor, weaponentity, fire); diff --git a/qcsrc/common/weapons/weapon/hook.qc b/qcsrc/common/weapons/weapon/hook.qc index d8cebd740..d9e11dc01 100644 --- a/qcsrc/common/weapons/weapon/hook.qc +++ b/qcsrc/common/weapons/weapon/hook.qc @@ -145,7 +145,7 @@ METHOD(Hook, wr_think, void(entity thiswep, entity actor, .entity weaponentity, actor.(weaponentity).hook_refire = max(actor.(weaponentity).hook_refire, time + WEP_CVAR_PRI(hook, refire) * W_WeaponRateFactor(actor)); // hook also inhibits health regeneration, but only for 1 second - if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO)) + if(!(actor.items & IT_UNLIMITED_AMMO)) actor.pauseregen_finished = max(actor.pauseregen_finished, time + autocvar_g_balance_pause_fuel_regen); } @@ -163,7 +163,7 @@ METHOD(Hook, wr_think, void(entity thiswep, entity actor, .entity weaponentity, { if( time > actor.(weaponentity).hook_time_fueldecrease ) { - if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO)) + if(!(actor.items & IT_UNLIMITED_AMMO)) { if( GetResource(actor, RES_FUEL) >= (time - actor.(weaponentity).hook_time_fueldecrease) * hooked_fuel ) { diff --git a/qcsrc/common/weapons/weapon/machinegun.qc b/qcsrc/common/weapons/weapon/machinegun.qc index aaf4900fe..8aed35434 100644 --- a/qcsrc/common/weapons/weapon/machinegun.qc +++ b/qcsrc/common/weapons/weapon/machinegun.qc @@ -84,7 +84,7 @@ void W_MachineGun_Attack_Frame(Weapon thiswep, entity actor, .entity weaponentit if(PHYS_INPUT_BUTTON_ATCK(actor)) { if(!thiswep.wr_checkammo2(thiswep, actor, weaponentity)) - if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO)) + if(!(actor.items & IT_UNLIMITED_AMMO)) { W_SwitchWeapon_Force(actor, w_getbestweapon(actor, weaponentity), weaponentity); w_ready(thiswep, actor, weaponentity, fire); @@ -110,7 +110,7 @@ void W_MachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity } if(!thiswep.wr_checkammo1(thiswep, actor, weaponentity)) - if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO)) + if(!(actor.items & IT_UNLIMITED_AMMO)) { W_SwitchWeapon_Force(actor, w_getbestweapon(actor, weaponentity), weaponentity); w_ready(thiswep, actor, weaponentity, fire); @@ -206,7 +206,7 @@ METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponen if(weapon_prepareattack(thiswep, actor, weaponentity, true, 0)) { if(!thiswep.wr_checkammo2(thiswep, actor, weaponentity)) - if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO)) + if(!(actor.items & IT_UNLIMITED_AMMO)) { W_SwitchWeapon_Force(actor, w_getbestweapon(actor, weaponentity), weaponentity); w_ready(thiswep, actor, weaponentity, fire); diff --git a/qcsrc/common/weapons/weapon/seeker.qc b/qcsrc/common/weapons/weapon/seeker.qc index 648535eac..d7ba289f5 100644 --- a/qcsrc/common/weapons/weapon/seeker.qc +++ b/qcsrc/common/weapons/weapon/seeker.qc @@ -342,13 +342,11 @@ void W_Seeker_Attack(Weapon thiswep, entity actor, .entity weaponentity) void W_Seeker_Vollycontroller_Think(entity this) // TODO: Merge this with W_Seeker_Attack { - float c; - entity oldenemy; this.cnt = this.cnt - 1; Weapon thiswep = WEP_SEEKER; .entity weaponentity = this.weaponentity_fld; - if((!(this.realowner.items & IT_UNLIMITED_BOTH) && GetResource(this.realowner, thiswep.ammo_type) < WEP_CVAR(seeker, missile_ammo)) || (this.cnt <= -1) || (IS_DEAD(this.realowner)) || (this.realowner.(weaponentity).m_switchweapon != thiswep)) + if((!(this.realowner.items & IT_UNLIMITED_AMMO) && GetResource(this.realowner, thiswep.ammo_type) < WEP_CVAR(seeker, missile_ammo)) || (this.cnt <= -1) || (IS_DEAD(this.realowner)) || (this.realowner.(weaponentity).m_switchweapon != thiswep)) { delete(this); return; @@ -358,11 +356,10 @@ void W_Seeker_Vollycontroller_Think(entity this) // TODO: Merge this with W_Seek entity own = this.realowner; - oldenemy = own.enemy; + entity oldenemy = own.enemy; own.enemy = this.enemy; - c = own.cnt % 4; - switch(c) + switch(own.cnt % 4) { case 0: W_Seeker_Fire_Missile(thiswep, own, weaponentity, '-1.25 -3.75 0', own.enemy); // TODO diff --git a/qcsrc/common/weapons/weapon/shotgun.qc b/qcsrc/common/weapons/weapon/shotgun.qc index 22c928841..1eee25a05 100644 --- a/qcsrc/common/weapons/weapon/shotgun.qc +++ b/qcsrc/common/weapons/weapon/shotgun.qc @@ -153,7 +153,7 @@ void W_Shotgun_Attack2(Weapon thiswep, entity actor, .entity weaponentity, int f void W_Shotgun_Attack3_Frame2(Weapon thiswep, entity actor, .entity weaponentity, int fire) { if (!thiswep.wr_checkammo2(thiswep, actor, weaponentity)) - if (!(actor.items & IT_UNLIMITED_WEAPON_AMMO)) + if (!(actor.items & IT_UNLIMITED_AMMO)) { W_SwitchWeapon_Force(actor, w_getbestweapon(actor, weaponentity), weaponentity); w_ready(thiswep, actor, weaponentity, fire); @@ -174,7 +174,7 @@ void W_Shotgun_Attack3_Frame2(Weapon thiswep, entity actor, .entity weaponentity void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, .entity weaponentity, int fire) { if (!thiswep.wr_checkammo2(thiswep, actor, weaponentity)) - if (!(actor.items & IT_UNLIMITED_WEAPON_AMMO)) + if (!(actor.items & IT_UNLIMITED_AMMO)) { W_SwitchWeapon_Force(actor, w_getbestweapon(actor, weaponentity), weaponentity); w_ready(thiswep, actor, weaponentity, fire); @@ -254,7 +254,7 @@ METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentit } if(actor.(weaponentity).clip_load >= 0) // we are not currently reloading if(WEP_CVAR(shotgun, secondary) == 1) - if(((fire & 1) && GetResource(actor, thiswep.ammo_type) <= 0 && !(actor.items & IT_UNLIMITED_WEAPON_AMMO)) || (fire & 2)) + if(((fire & 1) && GetResource(actor, thiswep.ammo_type) <= 0 && !(actor.items & IT_UNLIMITED_AMMO)) || (fire & 2)) if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(shotgun, refire))) { // attempt forcing playback of the anim by switching to another anim (that we never play) here... diff --git a/qcsrc/common/weapons/weapon/vortex.qc b/qcsrc/common/weapons/weapon/vortex.qc index af7fac624..46fd4d8c0 100644 --- a/qcsrc/common/weapons/weapon/vortex.qc +++ b/qcsrc/common/weapons/weapon/vortex.qc @@ -230,7 +230,7 @@ METHOD(Vortex, wr_think, void(entity thiswep, entity actor, .entity weaponentity if(fire & 2) // only eat ammo when the button is pressed { dt = min(dt, (1 - actor.(weaponentity).vortex_charge) / WEP_CVAR(vortex, charge_rate)); - if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO)) + if(!(actor.items & IT_UNLIMITED_AMMO)) { // if this weapon is reloadable, decrease its load. Else decrease the player's ammo if(autocvar_g_balance_vortex_reload_ammo) diff --git a/qcsrc/server/bot/default/navigation.qc b/qcsrc/server/bot/default/navigation.qc index c666fa94e..d53922f58 100644 --- a/qcsrc/server/bot/default/navigation.qc +++ b/qcsrc/server/bot/default/navigation.qc @@ -1340,7 +1340,7 @@ void navigation_routerating(entity this, entity e, float f, float rangebias) LOG_DEBUG("jetpack ai: required fuel ", ftos(fuel), ", have ", ftos(GetResource(this, RES_FUEL))); // enough fuel ? - if(GetResource(this, RES_FUEL) > fuel || (this.items & IT_UNLIMITED_WEAPON_AMMO)) + if(GetResource(this, RES_FUEL) > fuel || (this.items & IT_UNLIMITED_AMMO)) { // Estimate cost // (as onground costs calculation is mostly based on distances, here we do the same establishing some relationship diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 0034c2dd9..98616a763 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -1617,7 +1617,7 @@ void player_regen(entity this) this.event_damage(this, this, this, 1, DEATH_ROT.m_id, DMG_NOWEP, this.origin, '0 0 0'); } - if (!(this.items & IT_UNLIMITED_WEAPON_AMMO)) + if (!(this.items & IT_UNLIMITED_AMMO)) { float minf, maxf, limitf; diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index c82f076d3..5fb0c7b94 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -715,7 +715,7 @@ void readplayerstartcvars() { g_weapon_stay = 0; // incompatible start_weapons = g_weaponarena_weapons; - start_items |= IT_UNLIMITED_BOTH; + start_items |= IT_UNLIMITED_AMMO | IT_UNLIMITED_SUPERWEAPONS; } else { @@ -735,9 +735,9 @@ void readplayerstartcvars() start_items |= IT_UNLIMITED_SUPERWEAPONS; if(!cvar("g_use_ammunition")) - start_items |= IT_UNLIMITED_WEAPON_AMMO; + start_items |= IT_UNLIMITED_AMMO; - if(start_items & IT_UNLIMITED_WEAPON_AMMO) + if(start_items & IT_UNLIMITED_AMMO) { start_ammo_shells = 999; start_ammo_nails = 999; diff --git a/qcsrc/server/tests.qc b/qcsrc/server/tests.qc index d4562dfc2..2f7dc88ba 100644 --- a/qcsrc/server/tests.qc +++ b/qcsrc/server/tests.qc @@ -23,7 +23,7 @@ TEST(Weapons, Hurt) it = a; PHYS_INPUT_BUTTON_ATCK(it) = true; - it.items |= IT_UNLIMITED_BOTH; + it.items |= IT_UNLIMITED_AMMO; Weapon wep = WEP_VORTEX; W_GiveWeapon(it, wep.m_id); W_SwitchWeapon_Force(it, wep, weaponentities[0]); diff --git a/qcsrc/server/weapons/selection.qc b/qcsrc/server/weapons/selection.qc index 7f9c6ad0d..f1866eab0 100644 --- a/qcsrc/server/weapons/selection.qc +++ b/qcsrc/server/weapons/selection.qc @@ -70,7 +70,7 @@ bool client_hasweapon(entity this, Weapon wpn, .entity weaponentity, float andam { if (andammo) { - if(this.items & IT_UNLIMITED_WEAPON_AMMO) + if(this.items & IT_UNLIMITED_AMMO) { f = 1; } diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index 19ba40aa0..f2eec236c 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -224,7 +224,7 @@ void w_ready(Weapon thiswep, entity actor, .entity weaponentity, int fire) .float prevwarntime; bool weapon_prepareattack_checkammo(Weapon thiswep, entity actor, bool secondary, .entity weaponentity) { - if ((actor.items & IT_UNLIMITED_WEAPON_AMMO)) return true; + if ((actor.items & IT_UNLIMITED_AMMO)) return true; bool ammo = false; if (secondary) ammo = thiswep.wr_checkammo2(thiswep, actor, weaponentity); else ammo = thiswep.wr_checkammo1(thiswep, actor, weaponentity); @@ -688,7 +688,7 @@ void W_AttachToShotorg(entity actor, .entity weaponentity, entity flash, vector void W_DecreaseAmmo(Weapon wep, entity actor, float ammo_use, .entity weaponentity) { if (MUTATOR_CALLHOOK(W_DecreaseAmmo, actor, actor.(weaponentity), ammo_use)) return; - if ((actor.items & IT_UNLIMITED_WEAPON_AMMO) && !wep.reloading_ammo) return; + if ((actor.items & IT_UNLIMITED_AMMO) && !wep.reloading_ammo) return; ammo_use = M_ARGV(2, float); @@ -735,7 +735,7 @@ void W_ReloadedAndReady(Weapon thiswep, entity actor, .entity weaponentity, int w_ent.clip_load = w_ent.old_clip_load; // restore the ammo counter, in case we still had ammo in the weapon before reloading // if the gun uses no ammo, max out weapon load, else decrease ammo as we increase weapon load - if (!w_ent.reload_ammo_min || (actor.items & IT_UNLIMITED_WEAPON_AMMO) || wpn.ammo_type == RES_NONE) + if (!w_ent.reload_ammo_min || (actor.items & IT_UNLIMITED_AMMO) || wpn.ammo_type == RES_NONE) { w_ent.clip_load = w_ent.reload_ammo_amount; } @@ -791,7 +791,7 @@ void W_Reload(entity actor, .entity weaponentity, float sent_ammo_min, Sound sen { if (!GetResource(actor, e.ammo_type) && this.reload_ammo_min) { - if (!(actor.items & IT_UNLIMITED_WEAPON_AMMO)) + if (!(actor.items & IT_UNLIMITED_AMMO)) { if (IS_REAL_CLIENT(actor) && actor.reload_complain < time) {