]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/items/item/health.qc
Backport icon handling from TimePath/guide
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / items / item / health.qc
index 08b422de1efdfddcaef9badd716264813774bca5..dded21951f8b255c312bc74897405b7603a99848 100644 (file)
@@ -3,66 +3,54 @@
     #include "../../../server/t_items.qh"
 #endif
 
-#define WITH(it) this.m_##it;
-#define CONFIGURE(...) MAP(WITH, __VA_ARGS__)
-#define DEFINE(id, ...) REGISTER_ITEM(id, Health, UNWORDS(__VA_ARGS__))
-
-DEFINE(HealthSmall
-    ,APPLY(CONFIGURE
-    ,   model               =   "models/items/g_h1.md3"
-    ,   sound               =   "misc/minihealth.wav"
-    ,   name                =   "5 Health"
-    )
-    ,IF(SV, CONFIGURE
-    ,   botvalue            =   BOT_PICKUP_RATING_LOW
-    ,   itemid              =   IT_5HP
-    ,   respawntime         =         GET(g_pickup_respawntime_short)
-    ,   respawntimejitter   =   GET(g_pickup_respawntimejitter_short)
-    )
-)
-
-DEFINE(HealthMedium
-    ,APPLY(CONFIGURE
-    ,   model               =   "models/items/g_h25.md3"
-    ,   sound               =   "misc/mediumhealth.wav"
-    ,   name                =   "25 Health"
-    )
-    ,IF(SV, CONFIGURE
-    ,   botvalue            =   BOT_PICKUP_RATING_MID
-    ,   itemid              =   IT_25HP
-    ,   respawntime         =         GET(g_pickup_respawntime_short)
-    ,   respawntimejitter   =   GET(g_pickup_respawntimejitter_short)
-    )
-)
+REGISTER_ITEM(HealthSmall, Health) {
+    this.m_model                =   "models/items/g_h1.md3";
+    this.m_sound                =   "misc/minihealth.wav";
+    this.m_name                 =   "5 Health";
+    this.m_icon                 =   "health";
+#ifdef SVQC
+    this.m_botvalue             =   BOT_PICKUP_RATING_LOW;
+    this.m_itemid               =   IT_5HP;
+    this.m_respawntime          =   GET(g_pickup_respawntime_short);
+    this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_short);
+#endif
+}
 
-DEFINE(HealthLarge
-    ,APPLY(CONFIGURE
-    ,   model               =   "models/items/g_h50.md3"
-    ,   sound               =   "misc/mediumhealth.wav"
-    ,   name                =   "50 Health"
-    )
-    ,IF(SV, CONFIGURE
-    ,   botvalue            =   BOT_PICKUP_RATING_MID
-    ,   itemid              =   IT_25HP
-    ,   respawntime         =         GET(g_pickup_respawntime_medium)
-    ,   respawntimejitter   =   GET(g_pickup_respawntimejitter_medium)
-    )
-)
+REGISTER_ITEM(HealthMedium, Health) {
+    this.m_model                =   "models/items/g_h25.md3";
+    this.m_sound                =   "misc/mediumhealth.wav";
+    this.m_name                 =   "25 Health";
+    this.m_icon                 =   "health";
+#ifdef SVQC
+    this.m_botvalue             =   BOT_PICKUP_RATING_MID;
+    this.m_itemid               =   IT_25HP;
+    this.m_respawntime          =   GET(g_pickup_respawntime_short);
+    this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_short);
+#endif
+}
 
-DEFINE(HealthMega
-    ,APPLY(CONFIGURE
-    ,   model               =   "models/items/g_h100.md3"
-    ,   sound               =   "misc/megahealth.wav"
-    ,   name                =   "100 Health"
-    )
-    ,IF(SV, CONFIGURE
-    ,   botvalue            =   BOT_PICKUP_RATING_HIGH
-    ,   itemid              =   IT_HEALTH
-    ,   respawntime         =         GET(g_pickup_respawntime_long)
-    ,   respawntimejitter   =   GET(g_pickup_respawntimejitter_long)
-    )
-)
+REGISTER_ITEM(HealthLarge, Health) {
+    this.m_model                =   "models/items/g_h50.md3";
+    this.m_sound                =   "misc/mediumhealth.wav";
+    this.m_name                 =   "50 Health";
+    this.m_icon                 =   "health";
+#ifdef SVQC
+    this.m_botvalue             =   BOT_PICKUP_RATING_MID;
+    this.m_itemid               =   IT_25HP;
+    this.m_respawntime          =   GET(g_pickup_respawntime_medium);
+    this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_medium);
+#endif
+}
 
-#undef WITH
-#undef CONFIGURE
-#undef DEFINE
+REGISTER_ITEM(HealthMega, Health) {
+    this.m_model                =   "models/items/g_h100.md3";
+    this.m_sound                =   "misc/megahealth.wav";
+    this.m_name                 =   "100 Health";
+    this.m_icon                 =   "item_mega_health";
+#ifdef SVQC
+    this.m_botvalue             =   BOT_PICKUP_RATING_HIGH;
+    this.m_itemid               =   IT_HEALTH;
+    this.m_respawntime          =   GET(g_pickup_respawntime_long);
+    this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_long);
+#endif
+}