From: Martin Taibr Date: Sun, 18 Aug 2019 15:13:28 +0000 (+0200) Subject: rename misleading const, fix overkill X-Git-Tag: xonotic-v0.8.5~1274^2~5 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=2ac4588949fb33afd2028ff2a48fc53d32c491eb;p=xonotic%2Fxonotic-data.pk3dir.git rename misleading const, fix overkill --- diff --git a/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc b/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc index 0a8370899..8f769a459 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_AMMO; + start_items &= ~IT_UNLIMITED_BOTH; 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 2dfcf4811..1158719fc 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_AMMO; + start_items &= ~IT_UNLIMITED_BOTH; //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 6d420c7a9..fa76eaf2f 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_AMMO; + start_items &= ~IT_UNLIMITED_BOTH; 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 cf4e288ba..1f01790d2 100644 --- a/qcsrc/common/items/item.qh +++ b/qcsrc/common/items/item.qh @@ -44,8 +44,8 @@ const int IT_SUPERWEAPON = BIT(21); // suit const int IT_STRENGTH = BIT(22); // item masks -const int IT_UNLIMITED_AMMO = IT_UNLIMITED_WEAPON_AMMO | IT_UNLIMITED_SUPERWEAPONS; -const int IT_PICKUPMASK = IT_UNLIMITED_AMMO | IT_JETPACK | IT_FUEL_REGEN; // strength and invincible are handled separately +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 #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 97df48106..d25c3151f 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_AMMO) || (cvar("g_melee_only")))) + if (buff == BUFF_AMMO && ((start_items & IT_UNLIMITED_WEAPON_AMMO) || (start_items & IT_UNLIMITED_BOTH) || (cvar("g_melee_only")))) return false; if (buff == BUFF_VAMPIRE && cvar("g_vampire")) return false; diff --git a/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc index cb9aea5cc..dbcda2d59 100644 --- a/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc +++ b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc @@ -274,6 +274,10 @@ MUTATOR_HOOKFUNCTION(ok, SetStartItems, CBC_ORDER_LAST) if(WEP_OVERKILL_RPC.weaponstart > 0) { ok_start_items |= WEPSET(OVERKILL_RPC); } if(WEP_OVERKILL_HMG.weaponstart > 0) { ok_start_items |= WEPSET(OVERKILL_HMG); } + // 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_weapons = warmup_start_weapons = ok_start_items; } diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index 4a3712a25..cd3162e5c 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -1497,7 +1497,7 @@ spawnfunc(target_items) { for(int j = 0; j < n; ++j) { - if (argv(j) == "unlimited_ammo") this.items |= IT_UNLIMITED_AMMO; + if (argv(j) == "unlimited_ammo") this.items |= IT_UNLIMITED_BOTH; else if(argv(j) == "unlimited_weapon_ammo") this.items |= IT_UNLIMITED_WEAPON_AMMO; else if(argv(j) == "unlimited_superweapons") this.items |= IT_UNLIMITED_SUPERWEAPONS; else if(argv(j) == "strength") this.items |= ITEM_Strength.m_itemid; @@ -1763,7 +1763,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_AMMO, op, val); + got += GiveBit(e, items, IT_UNLIMITED_BOTH, op, val); case "all": got += GiveBit(e, items, ITEM_Jetpack.m_itemid, op, val); got += GiveResourceValue(e, RES_HEALTH, op, val); @@ -1781,7 +1781,7 @@ 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_AMMO, op, val); + got += GiveBit(e, items, IT_UNLIMITED_BOTH, op, val); break; case "unlimited_weapon_ammo": got += GiveBit(e, items, IT_UNLIMITED_WEAPON_AMMO, op, val); diff --git a/qcsrc/common/weapons/weapon/seeker.qc b/qcsrc/common/weapons/weapon/seeker.qc index f8c2be1d5..648535eac 100644 --- a/qcsrc/common/weapons/weapon/seeker.qc +++ b/qcsrc/common/weapons/weapon/seeker.qc @@ -348,7 +348,7 @@ void W_Seeker_Vollycontroller_Think(entity this) // TODO: Merge this with W_Seek Weapon thiswep = WEP_SEEKER; .entity weaponentity = this.weaponentity_fld; - 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)) + 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)) { delete(this); return; diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 522840e76..f305e4bb6 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -614,7 +614,7 @@ void readplayerstartcvars() { g_weapon_stay = 0; // incompatible start_weapons = g_weaponarena_weapons; - start_items |= IT_UNLIMITED_AMMO; + start_items |= IT_UNLIMITED_BOTH; } else { @@ -634,7 +634,7 @@ void readplayerstartcvars() start_items |= IT_UNLIMITED_SUPERWEAPONS; if(!cvar("g_use_ammunition")) - start_items |= IT_UNLIMITED_AMMO; + start_items |= IT_UNLIMITED_BOTH; if(start_items & IT_UNLIMITED_WEAPON_AMMO) { diff --git a/qcsrc/server/tests.qc b/qcsrc/server/tests.qc index 2f7dc88ba..d4562dfc2 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_AMMO; + it.items |= IT_UNLIMITED_BOTH; Weapon wep = WEP_VORTEX; W_GiveWeapon(it, wep.m_id); W_SwitchWeapon_Force(it, wep, weaponentities[0]); diff --git a/ruleset-overkill.cfg b/ruleset-overkill.cfg index 28b3d90a5..5b71bb60a 100644 --- a/ruleset-overkill.cfg +++ b/ruleset-overkill.cfg @@ -10,8 +10,6 @@ if_dedicated exec help-overkill.cfg g_overkill 1 -g_use_ammunition 0 - // hack - eventually, we should be able to choose overkill models in menu like for vanilla sv_defaultcharacter 1 sv_defaultplayermodel "models/ok_player/okrobot1.dpm models/ok_player/okrobot2.dpm models/ok_player/okrobot3.dpm models/ok_player/okrobot4.dpm models/ok_player/okmale1.dpm models/ok_player/okmale2.dpm models/ok_player/okmale3.dpm models/ok_player/okmale4.dpm"