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