From adaa580f88d0a97498ea660d6f5cad095dc42dad Mon Sep 17 00:00:00 2001 From: TimePath Date: Tue, 11 Aug 2015 20:07:55 +1000 Subject: [PATCH] Refer to item flags from item definitions --- qcsrc/Makefile | 2 +- qcsrc/client/hud.qc | 5 +- qcsrc/common/items/item/armor.qc | 4 +- qcsrc/common/items/item/powerup.qc | 7 +- qcsrc/common/monsters/monster/mage.qc | 2 +- qcsrc/common/physics.qc | 2 +- qcsrc/common/weapons/w_porto.qc | 2 +- qcsrc/server/cl_client.qc | 20 +++--- qcsrc/server/g_damage.qc | 4 +- qcsrc/server/miscfunctions.qc | 16 ++--- qcsrc/server/mutators/gamemode_ctf.qc | 2 +- qcsrc/server/mutators/gamemode_lms.qc | 2 +- qcsrc/server/mutators/mutator_instagib.qc | 28 ++++---- qcsrc/server/mutators/mutator_melee_only.qc | 4 +- qcsrc/server/mutators/mutator_nades.qc | 2 +- qcsrc/server/mutators/mutator_nix.qc | 17 +++-- qcsrc/server/mutators/mutator_overkill.qc | 6 +- qcsrc/server/t_items.qc | 72 ++++++++++----------- qcsrc/server/weapons/common.qc | 2 +- 19 files changed, 102 insertions(+), 97 deletions(-) diff --git a/qcsrc/Makefile b/qcsrc/Makefile index f53707e82..26797c55a 100644 --- a/qcsrc/Makefile +++ b/qcsrc/Makefile @@ -13,7 +13,7 @@ QCCFLAGS ?= \ -std=gmqcc \ -O3 -flno \ -Werror -fno-bail-on-werror -Wall \ - -fftepp -fftepp-predefs -Wcpp -futf8 \ + -fftepp -fftepp-predefs -Wcpp -futf8 -frelaxed-switch \ $(QCCFLAGS_WTFS) \ $(QCCFLAGS_FEATURES) \ $(QCCFLAGS_EXTRA) $(QCCFLAGS_WATERMARK) diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index c422892ea..4a26fdf0a 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -11,6 +11,7 @@ #include "../common/constants.qh" #include "../common/counting.qh" #include "../common/deathtypes.qh" +#include "../common/items/all.qc" #include "../common/mapinfo.qh" #include "../common/nades.qh" @@ -1358,7 +1359,7 @@ int getPowerupItemAlign(int align, int column, int row, int columns, int rows, b return 2; } -void HUD_Powerups(void) +void HUD_Powerups() { if(intermission == 2) return; @@ -1372,7 +1373,7 @@ void HUD_Powerups(void) if(!autocvar_hud_panel_powerups) return; if(spectatee_status == -1) return; if(getstati(STAT_HEALTH) <= 0) return; - if(!(allItems & (IT_STRENGTH | IT_INVINCIBLE | IT_SUPERWEAPON)) && !allBuffs) return; + if(!(allItems & (ITEM_Strength.m_itemid | ITEM_Shield.m_itemid | IT_SUPERWEAPON)) && !allBuffs) return; strengthTime = bound(0, getstatf(STAT_STRENGTH_FINISHED) - time, 99); shieldTime = bound(0, getstatf(STAT_INVINCIBLE_FINISHED) - time, 99); diff --git a/qcsrc/common/items/item/armor.qc b/qcsrc/common/items/item/armor.qc index 0db9d1f70..e5ade4f4b 100644 --- a/qcsrc/common/items/item/armor.qc +++ b/qcsrc/common/items/item/armor.qc @@ -27,7 +27,7 @@ REGISTER_ITEM(ArmorMedium, Armor) { #endif } -REGISTER_ITEM(ArmorBig, Armor) { +REGISTER_ITEM(ArmorLarge, Armor) { this.m_model = "models/items/item_armor_big.md3"; this.m_sound = "misc/armor17_5.wav"; this.m_name = "50 Armor"; @@ -39,7 +39,7 @@ REGISTER_ITEM(ArmorBig, Armor) { #endif } -REGISTER_ITEM(ArmorLarge, Armor) { +REGISTER_ITEM(ArmorMega, Armor) { this.m_model = "models/items/item_armor_large.md3"; this.m_sound = "misc/armor25.wav"; this.m_name = "100 Armor"; diff --git a/qcsrc/common/items/item/powerup.qc b/qcsrc/common/items/item/powerup.qc index 0f025aed8..c4bfb3936 100644 --- a/qcsrc/common/items/item/powerup.qc +++ b/qcsrc/common/items/item/powerup.qc @@ -1,19 +1,18 @@ #include "powerup.qh" #include "../../../server/t_items.qh" +#ifndef SVQC +.int m_itemid; +#endif REGISTER_ITEM(Strength, Powerup) { this.m_model = "models/items/g_strength.md3"; this.m_sound = "misc/powerup.wav"; this.m_name = "Strength Powerup"; -#ifdef SVQC this.m_itemid = IT_STRENGTH; -#endif } REGISTER_ITEM(Shield, Powerup) { this.m_model = "models/items/g_invincible.md3"; this.m_sound = "misc/powerup_shield.wav"; this.m_name = "Shield"; -#ifdef SVQC this.m_itemid = IT_INVINCIBLE; -#endif } diff --git a/qcsrc/common/monsters/monster/mage.qc b/qcsrc/common/monsters/monster/mage.qc index 1aab262fd..4ac1f3af1 100644 --- a/qcsrc/common/monsters/monster/mage.qc +++ b/qcsrc/common/monsters/monster/mage.qc @@ -64,7 +64,7 @@ float friend_needshelp(entity e) return false; if(!IS_PLAYER(e)) return ((e.flags & FL_MONSTER) && e.health < e.max_health); - if(e.items & IT_INVINCIBLE) + if(e.items & ITEM_Shield.m_itemid) return false; switch(self.skin) diff --git a/qcsrc/common/physics.qc b/qcsrc/common/physics.qc index 4143ad3b1..8d14f4b4f 100644 --- a/qcsrc/common/physics.qc +++ b/qcsrc/common/physics.qc @@ -709,7 +709,7 @@ void CheckPlayerJump() float activate = JETPACK_JUMP(self) && air_jump && PHYS_INPUT_BUTTON_JUMP(self) || PHYS_INPUT_BUTTON_JETPACK(self); float has_fuel = !PHYS_JETPACK_FUEL || PHYS_AMMO_FUEL(self) || ITEMS_STAT(self) & IT_UNLIMITED_WEAPON_AMMO; - if (!(ITEMS_STAT(self) & IT_JETPACK)) { } + if (!(ITEMS_STAT(self) & ITEM_Jetpack.m_itemid)) { } else if (self.jetpack_stopped) { } else if (!has_fuel) { diff --git a/qcsrc/common/weapons/w_porto.qc b/qcsrc/common/weapons/w_porto.qc index 82baf07bd..4a6dd7aa1 100644 --- a/qcsrc/common/weapons/w_porto.qc +++ b/qcsrc/common/weapons/w_porto.qc @@ -262,7 +262,7 @@ void W_Porto_Attack(float type) gren.think = W_Porto_Think; gren.touch = W_Porto_Touch; - if(self.items & IT_STRENGTH) + if(self.items & ITEM_Strength.m_itemid) W_SetupProjVelocity_Basic(gren, WEP_CVAR_BOTH(porto, (type <= 0), speed) * autocvar_g_balance_powerup_strength_force, 0); else W_SetupProjVelocity_Basic(gren, WEP_CVAR_BOTH(porto, (type <= 0), speed), 0); diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 6d3d786ae..038e6432c 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -33,6 +33,8 @@ #include "../common/net_notice.qh" #include "../common/physics.qh" +#include "../common/items/all.qc" + #include "../common/triggers/subs.qh" #include "../common/triggers/triggers.qh" #include "../common/triggers/trigger/secret.qh" @@ -1480,13 +1482,13 @@ void player_powerups (void) if (!g_instagib) { - if (self.items & IT_STRENGTH) + if (self.items & ITEM_Strength.m_itemid) { play_countdown(self.strength_finished, "misc/poweroff.wav"); self.effects = self.effects | (EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT); if (time > self.strength_finished) { - self.items = self.items - (self.items & IT_STRENGTH); + self.items = self.items - (self.items & ITEM_Strength.m_itemid); //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERDOWN_STRENGTH, self.netname); Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_STRENGTH); } @@ -1495,18 +1497,18 @@ void player_powerups (void) { if (time < self.strength_finished) { - self.items = self.items | IT_STRENGTH; + self.items = self.items | ITEM_Strength.m_itemid; Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_STRENGTH, self.netname); Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_STRENGTH); } } - if (self.items & IT_INVINCIBLE) + if (self.items & ITEM_Shield.m_itemid) { play_countdown(self.invincible_finished, "misc/poweroff.wav"); self.effects = self.effects | (EF_RED | EF_ADDITIVE | EF_FULLBRIGHT); if (time > self.invincible_finished) { - self.items = self.items - (self.items & IT_INVINCIBLE); + self.items = self.items - (self.items & ITEM_Shield.m_itemid); //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERDOWN_SHIELD, self.netname); Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_SHIELD); } @@ -1515,7 +1517,7 @@ void player_powerups (void) { if (time < self.invincible_finished) { - self.items = self.items | IT_INVINCIBLE; + self.items = self.items | ITEM_Shield.m_itemid; Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_SHIELD, self.netname); Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_SHIELD); } @@ -1669,7 +1671,7 @@ void player_regen (void) minf = autocvar_g_balance_fuel_regenstable; limitf = autocvar_g_balance_fuel_limit; - self.ammo_fuel = CalcRotRegen(self.ammo_fuel, minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear, frametime * (time > self.pauseregen_finished) * ((self.items & IT_FUEL_REGEN) != 0), maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, frametime * (time > self.pauserotfuel_finished), limitf); + self.ammo_fuel = CalcRotRegen(self.ammo_fuel, minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear, frametime * (time > self.pauseregen_finished) * ((self.items & ITEM_JetpackRegen.m_itemid) != 0), maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, frametime * (time > self.pauserotfuel_finished), limitf); } } @@ -2502,8 +2504,8 @@ void PlayerPreThink (void) W_WeaponFrame(); self.items_added = 0; - if(self.items & IT_JETPACK) - if(self.items & IT_FUEL_REGEN || self.ammo_fuel >= 0.01) + if(self.items & ITEM_Jetpack.m_itemid) + if(self.items & ITEM_JetpackRegen.m_itemid || self.ammo_fuel >= 0.01) self.items_added |= IT_FUEL; self.items |= self.items_added; diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index c5bbfcab5..e9ec41741 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -819,7 +819,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d if(!g_instagib) { // apply strength multiplier - if (attacker.items & IT_STRENGTH) + if (attacker.items & ITEM_Strength.m_itemid) { if(targ == attacker) { @@ -834,7 +834,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d } // apply invincibility multiplier - if (targ.items & IT_INVINCIBLE) + if (targ.items & ITEM_Shield.m_itemid) damage = damage * autocvar_g_balance_powerup_invincible_takedamage; } diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 2354e128e..0970d68e6 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -303,11 +303,11 @@ string formatmessage(string msg) wep = self.cnt; replacement = WEP_NAME(wep); } else if (escape == "W") { - if (self.items & IT_SHELLS) replacement = "shells"; - else if (self.items & IT_NAILS) replacement = "bullets"; - else if (self.items & IT_ROCKETS) replacement = "rockets"; - else if (self.items & IT_CELLS) replacement = "cells"; - else if (self.items & IT_PLASMA) replacement = "plasma"; + if (self.items & ITEM_Shells.m_itemid) replacement = "shells"; + else if (self.items & ITEM_Bullets.m_itemid) replacement = "bullets"; + else if (self.items & ITEM_Rockets.m_itemid) replacement = "rockets"; + else if (self.items & ITEM_Cells.m_itemid) replacement = "cells"; + else if (self.items & ITEM_Plasma.m_itemid) replacement = "plasma"; else replacement = "batteries"; // ;) } else if (escape == "x") { replacement = cursor_ent.netname; @@ -725,13 +725,13 @@ void readplayerstartcvars() } if (g_jetpack) - start_items |= IT_JETPACK; + start_items |= ITEM_Jetpack.m_itemid; MUTATOR_CALLHOOK(SetStartItems); - if ((start_items & IT_JETPACK) || (g_grappling_hook && (start_weapons & WEPSET_HOOK))) + if ((start_items & ITEM_Jetpack.m_itemid) || (g_grappling_hook && (start_weapons & WEPSET_HOOK))) { - start_items |= IT_FUEL_REGEN; + start_items |= ITEM_JetpackRegen.m_itemid; start_ammo_fuel = max(start_ammo_fuel, cvar("g_balance_fuel_rotstable")); warmup_start_ammo_fuel = max(warmup_start_ammo_fuel, cvar("g_balance_fuel_rotstable")); } diff --git a/qcsrc/server/mutators/gamemode_ctf.qc b/qcsrc/server/mutators/gamemode_ctf.qc index d17dc86a1..1cd01be7e 100644 --- a/qcsrc/server/mutators/gamemode_ctf.qc +++ b/qcsrc/server/mutators/gamemode_ctf.qc @@ -372,7 +372,7 @@ void ctf_Handle_Throw(entity player, entity receiver, int droptype) { makevectors((player.v_angle.y * '0 1 0') + (bound(autocvar_g_ctf_throw_angle_min, player.v_angle.x, autocvar_g_ctf_throw_angle_max) * '1 0 0')); - flag_velocity = (('0 0 1' * autocvar_g_ctf_throw_velocity_up) + ((v_forward * autocvar_g_ctf_throw_velocity_forward) * ((player.items & IT_STRENGTH) ? autocvar_g_ctf_throw_strengthmultiplier : 1))); + flag_velocity = (('0 0 1' * autocvar_g_ctf_throw_velocity_up) + ((v_forward * autocvar_g_ctf_throw_velocity_forward) * ((player.items & ITEM_Strength.m_itemid) ? autocvar_g_ctf_throw_strengthmultiplier : 1))); flag.velocity = W_CalculateProjectileVelocity(player.velocity, flag_velocity, false); ctf_Handle_Drop(flag, player, droptype); break; diff --git a/qcsrc/server/mutators/gamemode_lms.qc b/qcsrc/server/mutators/gamemode_lms.qc index 61e51451f..31207be30 100644 --- a/qcsrc/server/mutators/gamemode_lms.qc +++ b/qcsrc/server/mutators/gamemode_lms.qc @@ -170,7 +170,7 @@ MUTATOR_HOOKFUNCTION(lms_FilterItem) MUTATOR_HOOKFUNCTION(lms_ItemTouch) { // give extra lives for mega health - if(self.items & IT_HEALTH) + if (self.items & ITEM_HealthMega.m_itemid) { Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_EXTRALIVES); PlayerScore_Add(other, SP_LMS_LIVES, autocvar_g_lms_extra_lives); diff --git a/qcsrc/server/mutators/mutator_instagib.qc b/qcsrc/server/mutators/mutator_instagib.qc index 17381d34a..000eaa588 100644 --- a/qcsrc/server/mutators/mutator_instagib.qc +++ b/qcsrc/server/mutators/mutator_instagib.qc @@ -132,7 +132,7 @@ MUTATOR_HOOKFUNCTION(instagib_MonsterSpawn) MUTATOR_HOOKFUNCTION(instagib_BotShouldAttack) { - if(checkentity.items & IT_STRENGTH) + if(checkentity.items & ITEM_Strength.m_itemid) return true; return false; @@ -167,14 +167,14 @@ MUTATOR_HOOKFUNCTION(instagib_PlayerPowerups) if (!(self.effects & EF_FULLBRIGHT)) self.effects |= EF_FULLBRIGHT; - if (self.items & IT_STRENGTH) + if (self.items & ITEM_Strength.m_itemid) { play_countdown(self.strength_finished, "misc/poweroff.wav"); if (time > self.strength_finished) { self.alpha = default_player_alpha; self.exteriorweaponentity.alpha = default_weapon_alpha; - self.items &= ~IT_STRENGTH; + self.items &= ~ITEM_Strength.m_itemid; Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_INVISIBILITY); } } @@ -184,18 +184,18 @@ MUTATOR_HOOKFUNCTION(instagib_PlayerPowerups) { self.alpha = autocvar_g_instagib_invis_alpha; self.exteriorweaponentity.alpha = autocvar_g_instagib_invis_alpha; - self.items |= IT_STRENGTH; + self.items |= ITEM_Strength.m_itemid; Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_INVISIBILITY, self.netname); Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_INVISIBILITY); } } - if (self.items & IT_INVINCIBLE) + if (self.items & ITEM_Shield.m_itemid) { play_countdown(self.invincible_finished, "misc/poweroff.wav"); if (time > self.invincible_finished) { - self.items &= ~IT_INVINCIBLE; + self.items &= ~ITEM_Shield.m_itemid; Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_SPEED); } } @@ -203,7 +203,7 @@ MUTATOR_HOOKFUNCTION(instagib_PlayerPowerups) { if (time < self.invincible_finished) { - self.items |= IT_INVINCIBLE; + self.items |= ITEM_Shield.m_itemid; Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_SPEED, self.netname); Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_SPEED); } @@ -213,7 +213,7 @@ MUTATOR_HOOKFUNCTION(instagib_PlayerPowerups) MUTATOR_HOOKFUNCTION(instagib_PlayerPhysics) { - if(self.items & IT_INVINCIBLE) + if(self.items & ITEM_Shield.m_itemid) self.stat_sv_maxspeed = self.stat_sv_maxspeed * autocvar_g_instagib_speed_highspeed; return false; @@ -290,7 +290,7 @@ MUTATOR_HOOKFUNCTION(instagib_PlayerDamage) frag_mirrordamage = 0; } - if((frag_target.buffs & BUFF_INVISIBLE) || (frag_target.items & IT_STRENGTH)) + if((frag_target.buffs & BUFF_INVISIBLE) || (frag_target.items & ITEM_Strength.m_itemid)) yoda = 1; return false; @@ -355,7 +355,7 @@ MUTATOR_HOOKFUNCTION(instagib_CustomizeWaypoint) // if you have the invisibility powerup, sprites ALWAYS are restricted to your team // but only apply this to real players, not to spectators - if((self.owner.flags & FL_CLIENT) && (self.owner.items & IT_STRENGTH) && (e == other)) + if((self.owner.flags & FL_CLIENT) && (self.owner.items & ITEM_Strength.m_itemid) && (e == other)) if(DIFF_TEAM(self.owner, e)) return true; @@ -364,11 +364,11 @@ MUTATOR_HOOKFUNCTION(instagib_CustomizeWaypoint) MUTATOR_HOOKFUNCTION(instagib_ItemCountdown) { - switch(self.items) + switch (self.items) { - case IT_STRENGTH: item_name = "item-invis"; item_color = '0 0 1'; break; - case IT_NAILS: item_name = "item-extralife"; item_color = '1 0 0'; break; - case IT_INVINCIBLE: item_name = "item-speed"; item_color = '1 0 1'; break; + case ITEM_Strength.m_itemid: item_name = "item-invis"; item_color = '0 0 1'; break; + case ITEM_ExtraLife.m_itemid: item_name = "item-extralife"; item_color = '1 0 0'; break; + case ITEM_Shield.m_itemid: item_name = "item-speed"; item_color = '1 0 1'; break; } return false; } diff --git a/qcsrc/server/mutators/mutator_melee_only.qc b/qcsrc/server/mutators/mutator_melee_only.qc index ed7cd2074..c77bba516 100644 --- a/qcsrc/server/mutators/mutator_melee_only.qc +++ b/qcsrc/server/mutators/mutator_melee_only.qc @@ -19,8 +19,8 @@ MUTATOR_HOOKFUNCTION(melee_FilterItem) { switch (self.items) { - case IT_5HP: - case IT_ARMOR_SHARD: + case ITEM_HealthSmall.m_itemid: + case ITEM_ArmorSmall.m_itemid: return false; } diff --git a/qcsrc/server/mutators/mutator_nades.qc b/qcsrc/server/mutators/mutator_nades.qc index 292bba261..7362abaeb 100644 --- a/qcsrc/server/mutators/mutator_nades.qc +++ b/qcsrc/server/mutators/mutator_nades.qc @@ -803,7 +803,7 @@ void nade_prime() n.classname = "nade"; fn.classname = "fake_nade"; - if(self.items & IT_STRENGTH && autocvar_g_nades_bonus_onstrength) + if(self.items & ITEM_Strength.m_itemid && autocvar_g_nades_bonus_onstrength) n.nade_type = self.nade_type; else if (self.bonus_nades >= 1) { diff --git a/qcsrc/server/mutators/mutator_nix.qc b/qcsrc/server/mutators/mutator_nix.qc index 42a490b00..ecf07cb78 100644 --- a/qcsrc/server/mutators/mutator_nix.qc +++ b/qcsrc/server/mutators/mutator_nix.qc @@ -180,16 +180,19 @@ MUTATOR_HOOKFUNCTION(nix_FilterItem) { switch (self.items) { - case IT_HEALTH: - case IT_5HP: - case IT_25HP: - case IT_ARMOR: - case IT_ARMOR_SHARD: + case ITEM_HealthSmall.m_itemid: + case ITEM_HealthMedium.m_itemid: + case ITEM_HealthLarge.m_itemid: + case ITEM_HealthMega.m_itemid: + case ITEM_ArmorSmall.m_itemid: + case ITEM_ArmorMedium.m_itemid: + case ITEM_ArmorLarge.m_itemid: + case ITEM_ArmorMega.m_itemid: if (autocvar_g_nix_with_healtharmor) return 0; break; - case IT_STRENGTH: - case IT_INVINCIBLE: + case ITEM_Strength.m_itemid: + case ITEM_Shield.m_itemid: if (autocvar_g_nix_with_powerups) return 0; break; diff --git a/qcsrc/server/mutators/mutator_overkill.qc b/qcsrc/server/mutators/mutator_overkill.qc index 39b244a72..75c7b41c4 100644 --- a/qcsrc/server/mutators/mutator_overkill.qc +++ b/qcsrc/server/mutators/mutator_overkill.qc @@ -114,7 +114,7 @@ MUTATOR_HOOKFUNCTION(ok_PlayerRegen) minf = autocvar_g_balance_fuel_regenstable; limitf = autocvar_g_balance_fuel_limit; - self.ammo_fuel = CalcRotRegen(self.ammo_fuel, minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear, frametime * (time > self.pauseregen_finished) * ((self.items & IT_FUEL_REGEN) != 0), maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, frametime * (time > self.pauserotfuel_finished), limitf); + self.ammo_fuel = CalcRotRegen(self.ammo_fuel, minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear, frametime * (time > self.pauseregen_finished) * ((self.items & ITEM_JetpackRegen.m_itemid) != 0), maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, frametime * (time > self.pauserotfuel_finished), limitf); } return true; // return true anyway, as frozen uses no regen } @@ -256,8 +256,8 @@ MUTATOR_HOOKFUNCTION(ok_ItemRemove) switch(self.items) { - case IT_HEALTH: return !(autocvar_g_overkill_100h_anyway); - case IT_ARMOR: return !(autocvar_g_overkill_100a_anyway); + case ITEM_HealthMega.m_itemid: return !(autocvar_g_overkill_100h_anyway); + case ITEM_ArmorMega.m_itemid: return !(autocvar_g_overkill_100a_anyway); } return true; diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index 873f7a53c..459e68a93 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -384,7 +384,7 @@ void Item_Show (entity e, float mode) e.ItemStatus &= ~ITS_AVAILABLE; } - if (e.items & IT_STRENGTH || e.items & IT_INVINCIBLE) + if (e.items & ITEM_Strength.m_itemid || e.items & ITEM_Shield.m_itemid) e.ItemStatus |= ITS_POWERUP; if (autocvar_g_nodepthtestitems) @@ -590,9 +590,9 @@ void Item_Respawn (void) { Item_Show(self, 1); // this is ugly... - if(self.items == IT_STRENGTH) + if(self.items == ITEM_Strength.m_itemid) sound (self, CH_TRIGGER, "misc/strength_respawn.wav", VOL_BASE, ATTEN_NORM); // play respawn sound - else if(self.items == IT_INVINCIBLE) + else if(self.items == ITEM_Shield.m_itemid) sound (self, CH_TRIGGER, "misc/shield_respawn.wav", VOL_BASE, ATTEN_NORM); // play respawn sound else sound (self, CH_TRIGGER, "misc/itemrespawn.wav", VOL_BASE, ATTEN_NORM); // play respawn sound @@ -629,17 +629,17 @@ void Item_RespawnCountdown (void) string name; vector rgb = '1 0 1'; name = string_null; - switch(self.items) + switch (self.items) { - case IT_FUEL_REGEN: name = "item-fuelregen"; rgb = '1 0.5 0'; break; - case IT_JETPACK: name = "item-jetpack"; rgb = '0.5 0.5 0.5'; break; - case IT_STRENGTH: name = "item-strength"; rgb = '0 0 1'; break; - case IT_INVINCIBLE: name = "item-shield"; rgb = '1 0 1'; break; - case IT_HEALTH: + case ITEM_JetpackRegen.m_itemid: name = "item-fuelregen"; rgb = '1 0.5 0'; break; + case ITEM_Jetpack.m_itemid: name = "item-jetpack"; rgb = '0.5 0.5 0.5'; break; + case ITEM_Strength.m_itemid: name = "item-strength"; rgb = '0 0 1'; break; + case ITEM_Shield.m_itemid: name = "item-shield"; rgb = '1 0 1'; break; + case ITEM_HealthMega.m_itemid: //if (self.classname == "item_health_mega") {name = "item_health_mega"; rgb = '1 0 0';} break; - case IT_ARMOR: + case ITEM_ArmorMega.m_itemid: if (self.classname == "item_armor_large") {name = "item_armor_large"; rgb = '0 1 0';} break; @@ -1085,17 +1085,17 @@ float commodity_pickupevalfunc(entity player, entity item) if (!(player.weapons & WepSet_FromWeapon(i))) continue; - if(wi.items & IT_SHELLS) + if(wi.items & ITEM_Shells.m_itemid) need_shells = true; - else if(wi.items & IT_NAILS) + else if(wi.items & ITEM_Bullets.m_itemid) need_nails = true; - else if(wi.items & IT_ROCKETS) + else if(wi.items & ITEM_Rockets.m_itemid) need_rockets = true; - else if(wi.items & IT_CELLS) + else if(wi.items & ITEM_Cells.m_itemid) need_cells = true; - else if(wi.items & IT_PLASMA) + else if(wi.items & ITEM_Plasma.m_itemid) need_plasma = true; - else if(wi.items & IT_FUEL) + else if(wi.items & ITEM_JetpackFuel.m_itemid) need_fuel = true; } @@ -1288,9 +1288,9 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, precache_sound (self.item_pickupsound); precache_sound ("misc/itemrespawncountdown.wav"); - if(itemid == IT_STRENGTH) + if(itemid == ITEM_Strength.m_itemid) precache_sound ("misc/strength_respawn.wav"); - else if(itemid == IT_INVINCIBLE) + else if(itemid == ITEM_Shield.m_itemid) precache_sound ("misc/shield_respawn.wav"); else precache_sound ("misc/itemrespawn.wav"); @@ -1460,7 +1460,7 @@ void spawnfunc_item_armor_big (void) { self.max_armorvalue = g_pickup_armorbig_max; if(!self.pickup_anyway) self.pickup_anyway = g_pickup_armorbig_anyway; - StartItemA (ITEM_ArmorBig); + StartItemA (ITEM_ArmorLarge); } void spawnfunc_item_armor_large (void) { @@ -1470,7 +1470,7 @@ void spawnfunc_item_armor_large (void) { self.max_armorvalue = g_pickup_armorlarge_max; if(!self.pickup_anyway) self.pickup_anyway = g_pickup_armorlarge_anyway; - StartItemA (ITEM_ArmorLarge); + StartItemA (ITEM_ArmorMega); } void spawnfunc_item_health_small (void) { @@ -1593,11 +1593,11 @@ void spawnfunc_target_items (void) if (argv(i) == "unlimited_ammo") self.items |= IT_UNLIMITED_AMMO; else if(argv(i) == "unlimited_weapon_ammo") self.items |= IT_UNLIMITED_WEAPON_AMMO; else if(argv(i) == "unlimited_superweapons") self.items |= IT_UNLIMITED_SUPERWEAPONS; - else if(argv(i) == "strength") self.items |= IT_STRENGTH; - else if(argv(i) == "invincible") self.items |= IT_INVINCIBLE; + else if(argv(i) == "strength") self.items |= ITEM_Strength.m_itemid; + else if(argv(i) == "invincible") self.items |= ITEM_Shield.m_itemid; else if(argv(i) == "superweapons") self.items |= IT_SUPERWEAPON; - else if(argv(i) == "jetpack") self.items |= IT_JETPACK; - else if(argv(i) == "fuel_regen") self.items |= IT_FUEL_REGEN; + else if(argv(i) == "jetpack") self.items |= ITEM_Jetpack.m_itemid; + else if(argv(i) == "fuel_regen") self.items |= ITEM_JetpackRegen.m_itemid; else { for(j = WEP_FIRST; j <= WEP_LAST; ++j) @@ -1647,11 +1647,11 @@ void spawnfunc_target_items (void) self.netname = ""; self.netname = sprintf("%s %s%d %s", self.netname, itemprefix, !!(self.items & IT_UNLIMITED_WEAPON_AMMO), "unlimited_weapon_ammo"); self.netname = sprintf("%s %s%d %s", self.netname, itemprefix, !!(self.items & IT_UNLIMITED_SUPERWEAPONS), "unlimited_superweapons"); - self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, self.strength_finished * !!(self.items & IT_STRENGTH), "strength"); - self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, self.invincible_finished * !!(self.items & IT_INVINCIBLE), "invincible"); + self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, self.strength_finished * !!(self.items & ITEM_Strength.m_itemid), "strength"); + self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, self.invincible_finished * !!(self.items & ITEM_Shield.m_itemid), "invincible"); self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, self.superweapons_finished * !!(self.items & IT_SUPERWEAPON), "superweapons"); - self.netname = sprintf("%s %s%d %s", self.netname, itemprefix, !!(self.items & IT_JETPACK), "jetpack"); - self.netname = sprintf("%s %s%d %s", self.netname, itemprefix, !!(self.items & IT_FUEL_REGEN), "fuel_regen"); + self.netname = sprintf("%s %s%d %s", self.netname, itemprefix, !!(self.items & ITEM_Jetpack.m_itemid), "jetpack"); + self.netname = sprintf("%s %s%d %s", self.netname, itemprefix, !!(self.items & ITEM_JetpackRegen.m_itemid), "fuel_regen"); if(self.ammo_shells != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.ammo_shells), "shells"); if(self.ammo_nails != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.ammo_nails), "nails"); if(self.ammo_rockets != 0) self.netname = sprintf("%s %s%d %s", self.netname, valueprefix, max(0, self.ammo_rockets), "rockets"); @@ -1696,7 +1696,7 @@ void spawnfunc_item_fuel(void) void spawnfunc_item_fuel_regen(void) { - if(start_items & IT_FUEL_REGEN) + if(start_items & ITEM_JetpackRegen.m_itemid) { spawnfunc_item_fuel(); return; @@ -1708,7 +1708,7 @@ void spawnfunc_item_jetpack(void) { if(!self.ammo_fuel) self.ammo_fuel = g_pickup_fuel_jetpack; - if(start_items & IT_JETPACK) + if(start_items & ITEM_Jetpack.m_itemid) { spawnfunc_item_fuel(); return; @@ -1888,13 +1888,13 @@ float GiveItems(entity e, float beginarg, float endarg) op = OP_MINUS; continue; case "ALL": - got += GiveBit(e, items, IT_FUEL_REGEN, op, val); + got += GiveBit(e, items, ITEM_JetpackRegen.m_itemid, op, val); 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); case "all": - got += GiveBit(e, items, IT_JETPACK, op, val); + got += GiveBit(e, items, ITEM_Jetpack.m_itemid, op, val); got += GiveValue(e, health, op, val); got += GiveValue(e, armorvalue, op, val); case "allweapons": @@ -1923,10 +1923,10 @@ float GiveItems(entity e, float beginarg, float endarg) got += GiveBit(e, items, IT_UNLIMITED_SUPERWEAPONS, op, val); break; case "jetpack": - got += GiveBit(e, items, IT_JETPACK, op, val); + got += GiveBit(e, items, ITEM_Jetpack.m_itemid, op, val); break; case "fuel_regen": - got += GiveBit(e, items, IT_FUEL_REGEN, op, val); + got += GiveBit(e, items, ITEM_JetpackRegen.m_itemid, op, val); break; case "strength": got += GiveValue(e, strength_finished, op, val); @@ -1980,10 +1980,10 @@ float GiveItems(entity e, float beginarg, float endarg) op = OP_SET; } - POSTGIVE_BIT(e, items, IT_FUEL_REGEN, "misc/itempickup.wav", string_null); + POSTGIVE_BIT(e, items, ITEM_JetpackRegen.m_itemid, "misc/itempickup.wav", string_null); POSTGIVE_BIT(e, items, IT_UNLIMITED_SUPERWEAPONS, "misc/powerup.wav", "misc/poweroff.wav"); POSTGIVE_BIT(e, items, IT_UNLIMITED_WEAPON_AMMO, "misc/powerup.wav", "misc/poweroff.wav"); - POSTGIVE_BIT(e, items, IT_JETPACK, "misc/itempickup.wav", string_null); + POSTGIVE_BIT(e, items, ITEM_Jetpack.m_itemid, "misc/itempickup.wav", string_null); for(j = WEP_FIRST; j <= WEP_LAST; ++j) { wi = get_weaponinfo(j); diff --git a/qcsrc/server/weapons/common.qc b/qcsrc/server/weapons/common.qc index cf49b54f8..8e19fb53d 100644 --- a/qcsrc/server/weapons/common.qc +++ b/qcsrc/server/weapons/common.qc @@ -28,7 +28,7 @@ void W_GiveWeapon (entity e, float wep) void W_PlayStrengthSound(entity player) // void W_PlayStrengthSound { - if((player.items & IT_STRENGTH) + if((player.items & ITEM_Strength.m_itemid) && ((time > player.prevstrengthsound + autocvar_sv_strengthsound_antispam_time) // prevent insane sound spam || (time > player.prevstrengthsoundattempt + autocvar_sv_strengthsound_antispam_refire_threshold))) { -- 2.39.2