From f604d84f61f6db78cf9cb7c3cc6b9cfe7f14278f Mon Sep 17 00:00:00 2001 From: TimePath Date: Tue, 12 May 2015 17:02:16 +1000 Subject: [PATCH] Remove SPAWNTIMES enum --- qcsrc/common/items/item/ammo.qc | 14 +++++++------- qcsrc/common/items/item/armor.qc | 16 ++++++++-------- qcsrc/common/items/item/health.qc | 16 ++++++++-------- qcsrc/common/items/item/pickup.qh | 21 +-------------------- qcsrc/server/t_items.qc | 2 +- 5 files changed, 25 insertions(+), 44 deletions(-) diff --git a/qcsrc/common/items/item/ammo.qc b/qcsrc/common/items/item/ammo.qc index 0e389c987..7267f8d07 100644 --- a/qcsrc/common/items/item/ammo.qc +++ b/qcsrc/common/items/item/ammo.qc @@ -3,13 +3,13 @@ #define WITH(it) this.m_##it; #define CONFIGURE(...) MAP(WITH, __VA_ARGS__) -#define DEFINE(id, ...) \ - REGISTER_ITEM(id, Ammo, LAMBDA( \ - IF(SV, CONFIGURE \ - , respawntime = SPAWNTIME_AMMO \ - , respawntimejitter = SPAWNTIME_AMMO \ - ) \ - MAP(IDENTITY, __VA_ARGS__) \ +#define DEFINE(id, ...) \ + REGISTER_ITEM(id, Ammo, LAMBDA( \ + IF(SV, CONFIGURE \ + , respawntime = g_pickup_respawntime_ammo \ + , respawntimejitter = g_pickup_respawntimejitter_ammo \ + ) \ + MAP(IDENTITY, __VA_ARGS__) \ )) DEFINE(Bullets diff --git a/qcsrc/common/items/item/armor.qc b/qcsrc/common/items/item/armor.qc index 159477046..6d9561b15 100644 --- a/qcsrc/common/items/item/armor.qc +++ b/qcsrc/common/items/item/armor.qc @@ -14,8 +14,8 @@ DEFINE(ArmorSmall ) ,IF(SV, CONFIGURE , botvalue = BOT_PICKUP_RATING_LOW - , respawntime = SPAWNTIME_SHORT - , respawntimejitter = SPAWNTIME_SHORT + , respawntime = g_pickup_respawntime_short + , respawntimejitter = g_pickup_respawntimejitter_short ) ) @@ -28,8 +28,8 @@ DEFINE(ArmorMedium ) ,IF(SV, CONFIGURE , botvalue = BOT_PICKUP_RATING_MID - , respawntime = SPAWNTIME_MEDIUM - , respawntimejitter = SPAWNTIME_MEDIUM + , respawntime = g_pickup_respawntime_medium + , respawntimejitter = g_pickup_respawntimejitter_medium ) ) @@ -42,8 +42,8 @@ DEFINE(ArmorBig ) ,IF(SV, CONFIGURE , botvalue = 20000 // FIXME: higher than BOT_PICKUP_RATING_HIGH? - , respawntime = SPAWNTIME_LONG - , respawntimejitter = SPAWNTIME_LONG + , respawntime = g_pickup_respawntime_long + , respawntimejitter = g_pickup_respawntimejitter_long ) ) @@ -56,8 +56,8 @@ DEFINE(ArmorLarge ) ,IF(SV, CONFIGURE , botvalue = BOT_PICKUP_RATING_HIGH - , respawntime = SPAWNTIME_LONG - , respawntimejitter = SPAWNTIME_LONG + , respawntime = g_pickup_respawntime_long + , respawntimejitter = g_pickup_respawntimejitter_long ) ) diff --git a/qcsrc/common/items/item/health.qc b/qcsrc/common/items/item/health.qc index fb2f23f8c..64fdee45b 100644 --- a/qcsrc/common/items/item/health.qc +++ b/qcsrc/common/items/item/health.qc @@ -14,8 +14,8 @@ DEFINE(HealthSmall ) ,IF(SV, CONFIGURE , botvalue = BOT_PICKUP_RATING_LOW - , respawntime = SPAWNTIME_SHORT - , respawntimejitter = SPAWNTIME_SHORT + , respawntime = g_pickup_respawntime_short + , respawntimejitter = g_pickup_respawntimejitter_short ) ) @@ -28,8 +28,8 @@ DEFINE(HealthMedium ) ,IF(SV, CONFIGURE , botvalue = BOT_PICKUP_RATING_MID - , respawntime = SPAWNTIME_SHORT - , respawntimejitter = SPAWNTIME_SHORT + , respawntime = g_pickup_respawntime_short + , respawntimejitter = g_pickup_respawntimejitter_short ) ) @@ -42,8 +42,8 @@ DEFINE(HealthLarge ) ,IF(SV, CONFIGURE , botvalue = BOT_PICKUP_RATING_MID - , respawntime = SPAWNTIME_MEDIUM - , respawntimejitter = SPAWNTIME_MEDIUM + , respawntime = g_pickup_respawntime_medium + , respawntimejitter = g_pickup_respawntimejitter_medium ) ) @@ -56,8 +56,8 @@ DEFINE(HealthMega ) ,IF(SV, CONFIGURE , botvalue = BOT_PICKUP_RATING_HIGH - , respawntime = SPAWNTIME_LONG - , respawntimejitter = SPAWNTIME_LONG + , respawntime = g_pickup_respawntime_long + , respawntimejitter = g_pickup_respawntimejitter_long ) ) diff --git a/qcsrc/common/items/item/pickup.qh b/qcsrc/common/items/item/pickup.qh index 5e0d610fc..67ddcd74e 100644 --- a/qcsrc/common/items/item/pickup.qh +++ b/qcsrc/common/items/item/pickup.qh @@ -14,28 +14,9 @@ CLASS(Pickup, GameItem) #endif ENDCLASS(Pickup) -#define SPAWNTIMES(_) \ - _(WEAPON, weapon) \ - _(AMMO, ammo) \ - _(SHORT, short) \ - _(MEDIUM, medium) \ - _(LONG, long) \ - /**/ - -#define SPAWNTIMES_ENUM(id, idlc) SPAWNTIME_##id , -enum { SPAWNTIMES(SPAWNTIMES_ENUM) }; -#undef SPAWNTIMES_ENUM - #ifdef SVQC +// For g_pickup_respawntime #include "../../../server/defs.qh" - -#define SPAWNTIMES_MAP(id, idlc) i == SPAWNTIME_##id ? g_pickup_respawntime_##idlc : -[[inline]] int spawntime(int i) { return SPAWNTIMES(SPAWNTIMES_MAP) 0; } -#undef SPAWNTIMES_MAP - -#define SPAWNTIMES_MAP(id, idlc) i == SPAWNTIME_##id ? g_pickup_respawntimejitter_##idlc : -[[inline]] int spawntimejitter(int i) { return SPAWNTIMES(SPAWNTIMES_MAP) 0; } -#undef SPAWNTIMES_MAP #endif bool Pickup_respondTo(entity this, int request) diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index be2d5352e..625bdf71d 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -1156,7 +1156,7 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, void StartItemA (entity a) { - StartItem(a.m_model, a.m_sound, spawntime(a.m_respawntime), spawntimejitter(a.m_respawntimejitter), a.m_name, a.m_itemid, 0, 0, commodity_pickupevalfunc, a.m_botvalue); + StartItem(a.m_model, a.m_sound, a.m_respawntime, a.m_respawntimejitter, a.m_name, a.m_itemid, 0, 0, commodity_pickupevalfunc, a.m_botvalue); } void spawnfunc_item_rockets (void) { -- 2.39.2