entity ITEMS[MAX_ITEMS], ITEMS_first, ITEMS_last;
int ITEM_COUNT;
/** If you register a new item, make sure to add it to all.inc */
-#define REGISTER_ITEM(id, class) REGISTER(RegisterItems, ITEM, ITEMS, ITEM_COUNT, id, class, m_id)
+#define REGISTER_ITEM(id, class) REGISTER(RegisterItems, ITEM, ITEMS, ITEM_COUNT, id, m_id, NEW(class))
REGISTER_REGISTRY(RegisterItems)
#define ITEMS_FOREACH(pred, body) do { \
ATTRIB(Gametype, gametype_description, string, string_null)
CONSTRUCTOR(Gametype, string hname, string sname, string g_name, bool gteamplay, string defaults, string gdescription)
{
+ CONSTRUCT(Gametype);
this.netname = g_name;
this.mdl = sname;
this.message = hname;
#define REGISTER_GAMETYPE(hname, sname, g_name, NAME, gteamplay, defaults, gdescription) \
int MAPINFO_TYPE_##NAME; \
- REGISTER(RegisterGametypes, MAPINFO_TYPE, MAPINFO_TYPES, MAPINFO_TYPE_COUNT, g_name, Gametype, m_id) { \
- CONSTRUCT(Gametype, hname, #sname, #g_name, gteamplay, defaults, gdescription); \
+ REGISTER(RegisterGametypes, MAPINFO_TYPE, MAPINFO_TYPES, MAPINFO_TYPE_COUNT, g_name, m_id, \
+ NEW(Gametype, hname, #sname, #g_name, gteamplay, defaults, gdescription) \
+ ) { \
/* same as `1 << m_id` */ \
MAPINFO_TYPE_##NAME = MAPINFO_TYPE_ALL + 1; MAPINFO_TYPE_ALL |= MAPINFO_TYPE_##NAME; \
this.items = MAPINFO_TYPE_##NAME; \
const int MON_FIRST = 1;
#define MON_LAST (MON_FIRST + MON_COUNT - 1)
/** If you register a new monster, make sure to add it to all.inc */
-#define REGISTER_MONSTER(id, class) REGISTER(RegisterMonsters, MON, monster_info, MON_COUNT, id, class, monsterid)
+#define REGISTER_MONSTER(id, class) REGISTER(RegisterMonsters, MON, monster_info, MON_COUNT, id, monsterid, NEW(class))
#include "monster.qh"
#define REGISTER_MONSTER_SIMPLE(id, monsterflags, min_s, max_s, modelname, shortname, mname) \
REGISTER_MONSTER(id, Monster) { \
const int NADES_MAX = 8;
entity NADES[NADES_MAX], NADES_first, NADES_last;
int NADES_COUNT;
-#define REGISTER_NADE(id) REGISTER(RegisterNades, NADE_TYPE, NADES, NADES_COUNT, id, Nade, m_id)
+#define REGISTER_NADE(id) REGISTER(RegisterNades, NADE_TYPE, NADES, NADES_COUNT, id, m_id, NEW(Nade))
REGISTER_REGISTRY(RegisterNades)
CLASS(Nade, Object)
#define REGISTER_INIT(ns, id) [[accumulate]] void Register_##ns##_##id##_init(entity this)
-#define REGISTER(initfunc, ns, array, counter, id, class, fld) \
+#define REGISTER(initfunc, ns, array, counter, id, fld, inst) \
entity ns##_##id; \
REGISTER_INIT(ns, id) { } \
.entity enemy; /* internal next pointer */ \
void Register_##ns##_##id() { \
- entity this = NEW(class); \
+ entity this = inst; \
ns##_##id = this; \
this.fld = counter; \
array[counter++] = this; \