]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Remove SPAWNTIMES enum
authorTimePath <andrew.hardaker1995@gmail.com>
Tue, 12 May 2015 07:02:16 +0000 (17:02 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Tue, 12 May 2015 07:02:16 +0000 (17:02 +1000)
qcsrc/common/items/item/ammo.qc
qcsrc/common/items/item/armor.qc
qcsrc/common/items/item/health.qc
qcsrc/common/items/item/pickup.qh
qcsrc/server/t_items.qc

index 0e389c9872e5b134a9a3c2f5755be1b644d36471..7267f8d07288729a89d3c60429334372e62094f5 100644 (file)
@@ -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
index 15947704643ba22f278a93355846473a27ebc209..6d9561b1591166df405f185ff93c86e1dcfe7551 100644 (file)
@@ -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
     )
 )
 
index fb2f23f8c3601a382e6085a7fe051935d0fd9a4c..64fdee45ba703949959545075759a1e2a34356bc 100644 (file)
@@ -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
     )
 )
 
index 5e0d610fccde091117a9c4154ee96cedcf3d27bc..67ddcd74ed3f815ef312033be6043422338882e5 100644 (file)
@@ -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)
index be2d5352e2f3dd6f6cfbc2f67262b22975f9bbc7..625bdf71dddc6cc5ca28ddcb72632ba0387dded1 100644 (file)
@@ -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) {