/** If you register a new item, make sure to add it to all.inc */
#define REGISTER_ITEM(id, class, body) \
entity ITEM_##id; \
+ void RegisterItems_init_##id(entity this) { body } \
void RegisterItems_##id() { \
- const entity this = NEW(class); \
+ entity this = NEW(class); \
ITEM_##id = this; \
this.m_id = ITEM_COUNT; \
ITEMS[ITEM_COUNT++] = this; \
- body \
+ RegisterItems_init_##id(this); \
} \
- ACCUMULATE_FUNCTION(RegisterItems, RegisterItems_##id)
-
+ ACCUMULATE_FUNCTION(RegisterItems, RegisterItems_##id) \
+ [[accumulate]] void RegisterItems_init_##id(entity this)
#endif
#define WITH(it) this.m_##it;
#define CONFIGURE(...) MAP(WITH, __VA_ARGS__)
-#define DEFINE(id, ...) \
+#define DEFINE(id) \
REGISTER_ITEM(id, Ammo, LAMBDA( \
IF(SV, CONFIGURE \
, respawntime = GET(g_pickup_respawntime_ammo) \
, respawntimejitter = GET(g_pickup_respawntimejitter_ammo) \
) \
- UNWORDS(__VA_ARGS__) \
))
-DEFINE(Bullets
- ,APPLY(CONFIGURE
+DEFINE(Bullets) {
+ APPLY(CONFIGURE
, model = "models/items/a_bullets.mdl"
, name = "bullets"
)
- ,IF(SV, CONFIGURE
+ IF(SV, CONFIGURE
, botvalue = 2000
, itemid = IT_NAILS
)
-)
-DEFINE(Cells
- ,APPLY(CONFIGURE
+}
+DEFINE(Cells) {
+ APPLY(CONFIGURE
, model = "models/items/a_cells.md3"
, name = "cells"
)
- ,IF(SV, CONFIGURE
+ IF(SV, CONFIGURE
, botvalue = 2000
, itemid = IT_CELLS
)
-)
-DEFINE(Plasma
- ,APPLY(CONFIGURE
+}
+DEFINE(Plasma) {
+ APPLY(CONFIGURE
, model = "models/items/a_cells.md3"
, name = "plasma"
)
- ,IF(SV, CONFIGURE
+ IF(SV, CONFIGURE
, botvalue = 2000
, itemid = IT_PLASMA
)
-)
-DEFINE(Rockets
- ,APPLY(CONFIGURE
+}
+DEFINE(Rockets) {
+ APPLY(CONFIGURE
, model = "models/items/a_rockets.md3"
, name = "rockets"
)
- ,IF(SV, CONFIGURE
+ IF(SV, CONFIGURE
, botvalue = 3000
, itemid = IT_ROCKETS
)
-)
-DEFINE(Shells
- ,APPLY(CONFIGURE
+}
+DEFINE(Shells) {
+ APPLY(CONFIGURE
, model = "models/items/a_shells.md3"
, name = "shells"
)
- ,IF(SV, CONFIGURE
+ IF(SV, CONFIGURE
, botvalue = 500
, itemid = IT_SHELLS
)
-)
+}
#undef WITH
#undef CONFIGURE
#define WITH(it) this.m_##it;
#define CONFIGURE(...) MAP(WITH, __VA_ARGS__)
-#define DEFINE(id, ...) REGISTER_ITEM(id, Armor, UNWORDS(__VA_ARGS__))
+#define DEFINE(id) REGISTER_ITEM(id, Armor, )
-DEFINE(ArmorSmall
- ,APPLY(CONFIGURE
+DEFINE(ArmorSmall) {
+ APPLY(CONFIGURE
, model = "models/items/item_armor_small.md3"
, sound = "misc/armor1.wav"
, name = "5 Armor"
)
- ,IF(SV, CONFIGURE
+ IF(SV, CONFIGURE
, botvalue = BOT_PICKUP_RATING_LOW
, itemid = IT_ARMOR_SHARD
, respawntime = GET(g_pickup_respawntime_short)
, respawntimejitter = GET(g_pickup_respawntimejitter_short)
)
-)
+}
-DEFINE(ArmorMedium
- ,APPLY(CONFIGURE
+DEFINE(ArmorMedium) {
+ APPLY(CONFIGURE
, model = "models/items/item_armor_medium.md3"
, sound = "misc/armor10.wav"
, name = "25 Armor"
)
- ,IF(SV, CONFIGURE
+ IF(SV, CONFIGURE
, botvalue = BOT_PICKUP_RATING_MID
, itemid = IT_ARMOR
, respawntime = GET(g_pickup_respawntime_medium)
, respawntimejitter = GET(g_pickup_respawntimejitter_medium)
)
-)
+}
-DEFINE(ArmorBig
- ,APPLY(CONFIGURE
+DEFINE(ArmorBig) {
+ APPLY(CONFIGURE
, model = "models/items/item_armor_big.md3"
, sound = "misc/armor17_5.wav"
, name = "50 Armor"
)
- ,IF(SV, CONFIGURE
+ IF(SV, CONFIGURE
, botvalue = 20000 // FIXME: higher than BOT_PICKUP_RATING_HIGH?
, itemid = IT_ARMOR
, respawntime = GET(g_pickup_respawntime_long)
, respawntimejitter = GET(g_pickup_respawntimejitter_long)
)
-)
+}
-DEFINE(ArmorLarge
- ,APPLY(CONFIGURE
+DEFINE(ArmorLarge) {
+ APPLY(CONFIGURE
, model = "models/items/item_armor_large.md3"
, sound = "misc/armor25.wav"
, name = "100 Armor"
)
- ,IF(SV, CONFIGURE
+ IF(SV, CONFIGURE
, botvalue = BOT_PICKUP_RATING_HIGH
, itemid = IT_ARMOR
, respawntime = GET(g_pickup_respawntime_long)
, respawntimejitter = GET(g_pickup_respawntimejitter_long)
)
-)
+}
#undef WITH
#undef CONFIGURE
#include "buff.qh"
-REGISTER_ITEM(DefaultBuff, Buff, LAMBDA())
+REGISTER_ITEM(DefaultBuff, Buff, );
#define WITH(it) this.m_##it;
#define CONFIGURE(...) MAP(WITH, __VA_ARGS__)
-#define DEFINE(id, ...) REGISTER_ITEM(id, Health, UNWORDS(__VA_ARGS__))
+#define DEFINE(id) REGISTER_ITEM(id, Health, )
-DEFINE(HealthSmall
- ,APPLY(CONFIGURE
+DEFINE(HealthSmall) {
+ APPLY(CONFIGURE
, model = "models/items/g_h1.md3"
, sound = "misc/minihealth.wav"
, name = "5 Health"
)
- ,IF(SV, CONFIGURE
+ 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
+DEFINE(HealthMedium) {
+ APPLY(CONFIGURE
, model = "models/items/g_h25.md3"
, sound = "misc/mediumhealth.wav"
, name = "25 Health"
)
- ,IF(SV, CONFIGURE
+ IF(SV, CONFIGURE
, botvalue = BOT_PICKUP_RATING_MID
, itemid = IT_25HP
, respawntime = GET(g_pickup_respawntime_short)
, respawntimejitter = GET(g_pickup_respawntimejitter_short)
)
-)
+}
-DEFINE(HealthLarge
- ,APPLY(CONFIGURE
+DEFINE(HealthLarge) {
+ APPLY(CONFIGURE
, model = "models/items/g_h50.md3"
, sound = "misc/mediumhealth.wav"
, name = "50 Health"
)
- ,IF(SV, CONFIGURE
+ IF(SV, CONFIGURE
, botvalue = BOT_PICKUP_RATING_MID
, itemid = IT_25HP
, respawntime = GET(g_pickup_respawntime_medium)
, respawntimejitter = GET(g_pickup_respawntimejitter_medium)
)
-)
+}
-DEFINE(HealthMega
- ,APPLY(CONFIGURE
+DEFINE(HealthMega) {
+ APPLY(CONFIGURE
, model = "models/items/g_h100.md3"
, sound = "misc/megahealth.wav"
, name = "100 Health"
)
- ,IF(SV, CONFIGURE
+ IF(SV, CONFIGURE
, botvalue = BOT_PICKUP_RATING_HIGH
, itemid = IT_HEALTH
, respawntime = GET(g_pickup_respawntime_long)
, respawntimejitter = GET(g_pickup_respawntimejitter_long)
)
-)
+}
#undef WITH
#undef CONFIGURE
#define WITH(it) this.m_##it;
#define CONFIGURE(...) MAP(WITH, __VA_ARGS__)
-#define DEFINE(id, ...) REGISTER_ITEM(id, Pickup, UNWORDS(__VA_ARGS__))
+#define DEFINE(id) REGISTER_ITEM(id, Pickup, )
-DEFINE(Jetpack
- ,APPLY(CONFIGURE
+DEFINE(Jetpack) {
+ APPLY(CONFIGURE
, model = "models/items/g_jetpack.md3"
, name = "Jet pack"
)
- ,IF(SV, CONFIGURE
+ IF(SV, CONFIGURE
, botvalue = BOT_PICKUP_RATING_LOW
, itemflags = FL_POWERUP
, itemid = IT_JETPACK
, respawntime = GET(g_pickup_respawntime_powerup)
, respawntimejitter = GET(g_pickup_respawntimejitter_powerup)
)
-)
+}
-DEFINE(JetpackFuel
- ,APPLY(CONFIGURE
+DEFINE(JetpackFuel) {
+ APPLY(CONFIGURE
, model = "models/items/g_fuel.md3"
, name = "Fuel"
)
- ,IF(SV, CONFIGURE
+ IF(SV, CONFIGURE
, botvalue = BOT_PICKUP_RATING_LOW
, itemid = IT_FUEL
, pickupevalfunc = commodity_pickupevalfunc
, respawntime = GET(g_pickup_respawntime_ammo)
, respawntimejitter = GET(g_pickup_respawntimejitter_ammo)
)
-)
+}
-DEFINE(JetpackRegen
- ,APPLY(CONFIGURE
+DEFINE(JetpackRegen) {
+ APPLY(CONFIGURE
, model = "models/items/g_fuelregen.md3"
, name = "Fuel regenerator"
)
- ,IF(SV, CONFIGURE
+ IF(SV, CONFIGURE
, botvalue = BOT_PICKUP_RATING_LOW
, itemflags = FL_POWERUP
, itemid = IT_FUEL_REGEN
, respawntime = GET(g_pickup_respawntime_powerup)
, respawntimejitter = GET(g_pickup_respawntimejitter_powerup)
)
-)
+}
#undef WITH
#undef CONFIGURE
#define WITH(it) this.m_##it;
#define CONFIGURE(...) MAP(WITH, __VA_ARGS__)
-#define DEFINE(id, ...) \
+#define DEFINE(id) \
REGISTER_ITEM(id, Ammo, LAMBDA( \
IF(SV, CONFIGURE \
, botvalue = 100000 \
, respawntime = GET(g_pickup_respawntime_powerup) \
, respawntimejitter = GET(g_pickup_respawntimejitter_powerup) \
) \
- UNWORDS(__VA_ARGS__) \
))
-DEFINE(Strength
- ,APPLY(CONFIGURE
+DEFINE(Strength) {
+ APPLY(CONFIGURE
, model = "models/items/g_strength.md3"
, sound = "misc/powerup.wav"
, name = "Strength Powerup"
)
- ,IF(SV, CONFIGURE
+ IF(SV, CONFIGURE
, itemid = IT_STRENGTH
)
-)
-DEFINE(Shield
- ,APPLY(CONFIGURE
+}
+DEFINE(Shield) {
+ APPLY(CONFIGURE
, model = "models/items/g_invincible.md3"
, sound = "misc/powerup_shield.wav"
, name = "Shield"
)
- ,IF(SV, CONFIGURE
+ IF(SV, CONFIGURE
, itemid = IT_INVINCIBLE
)
-)
+}
#undef WITH
#undef CONFIGURE
GETTER(float, instagib_respawntime_ammo)
GETTER(float, instagib_respawntimejitter_ammo)
-REGISTER_ITEM(VaporizerCells, Pickup, APPLY(UNWORDS
- ,APPLY(CONFIGURE
+REGISTER_ITEM(VaporizerCells, Pickup, ) {
+ APPLY(CONFIGURE
, model = "models/items/a_cells.md3"
, sound = "misc/itempickup.wav"
, name = "Vaporizer Ammo"
)
- ,IF(SV, CONFIGURE
+ IF(SV, CONFIGURE
, botvalue = 100
, itemid = IT_CELLS
, respawntime = GET(instagib_respawntime_ammo)
, respawntimejitter = GET(instagib_respawntimejitter_ammo)
)
-))
+}
-REGISTER_ITEM(ExtraLife, Pickup, APPLY(UNWORDS
- ,APPLY(CONFIGURE
+REGISTER_ITEM(ExtraLife, Pickup, ) {
+ APPLY(CONFIGURE
, model = "models/items/g_h100.md3"
, sound = "misc/megahealth.wav"
, name = "Extralife"
)
- ,IF(SV, CONFIGURE
+ IF(SV, CONFIGURE
, botvalue = BOT_PICKUP_RATING_HIGH
, itemflags = FL_POWERUP
, itemid = IT_NAILS
, respawntime = GET(g_pickup_respawntime_powerup)
, respawntimejitter = GET(g_pickup_respawntimejitter_powerup)
)
-))
+}
#undef WITH
#undef CONFIGURE