.float strength_finished = _STAT(STRENGTH_FINISHED);
.float invincible_finished = _STAT(INVINCIBLE_FINISHED);
+#define spawnfunc_body(item) \
+ if (!Item_IsDefinitionAllowed(item)) \
+ { \
+ startitem_failed = true; \
+ delete(this); \
+ return; \
+ } \
+ StartItem(this, item)
+
#define SPAWNFUNC_ITEM(name, item) \
- spawnfunc(name) \
+ spawnfunc(name) \
+ { \
+ spawnfunc_body(item); \
+ }
+
+#define SPAWNFUNC_ITEM_COND(name, cond, item1, item2) \
+ spawnfunc(name) \
{ \
- if (!Item_IsDefinitionAllowed(item)) \
- { \
- startitem_failed = true; \
- delete(this); \
- return; \
- } \
- StartItem(this, item); \
+ entity item = (cond) ? item1 : item2; \
+ spawnfunc_body(item); \
}
#else
{
ITEM_FLAG_NORMAL = BIT(0), ///< Item is usable during normal gameplay.
ITEM_FLAG_MUTATORBLOCKED = BIT(1),
- ITEM_FLAG_RESOURCE = BIT(2) ///< Item is is a resource, not a held item.
+ ITEM_FLAG_RESOURCE = BIT(2) ///< Item is is a resource, not a held item.
};
#define ITEM_HANDLE(signal, ...) __Item_Send_##signal(__VA_ARGS__)
//spawnfunc(item_armor1) {spawnfunc_item_armor_medium(this);} // FIXME: in Quake this is green armor, in Xonotic maps it is an armor shard
SPAWNFUNC_ITEM(item_armor2, ITEM_ArmorMega)
SPAWNFUNC_ITEM(item_armorInv, ITEM_ArmorMega) // TODO: make sure we actually want this
-spawnfunc(item_health) {if (this.spawnflags & 2) StartItem(this, ITEM_HealthMega);else StartItem(this, ITEM_HealthMedium);}
+SPAWNFUNC_ITEM_COND(item_health, (this.spawnflags & 2), ITEM_HealthMega, ITEM_HealthMedium)