X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Fitems%2Fitem.qh;h=cf4e288ba6cd1769c127ef9ca27ab16ca8411579;hp=31b8f43cb17fe6041ec7c6155278db7aaad5823c;hb=8d21c71d2a5d6eb9a30b2e981a216382eef4ce59;hpb=ec98f5c9d50f267779fed871c9eb094a52064219 diff --git a/qcsrc/common/items/item.qh b/qcsrc/common/items/item.qh index 31b8f43cb1..cf4e288ba6 100644 --- a/qcsrc/common/items/item.qh +++ b/qcsrc/common/items/item.qh @@ -48,19 +48,29 @@ const int IT_UNLIMITED_AMMO = IT_UNLIMITED_WEAPON_AMMO | IT_UNLIMITE const int IT_PICKUPMASK = IT_UNLIMITED_AMMO | IT_JETPACK | IT_FUEL_REGEN; // strength and invincible are handled separately #ifdef SVQC -.float strength_finished = _STAT(STRENGTH_FINISHED); -.float invincible_finished = _STAT(INVINCIBLE_FINISHED); +const .float strength_finished = _STAT(STRENGTH_FINISHED); +const .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 @@ -72,7 +82,8 @@ const int IT_PICKUPMASK = IT_UNLIMITED_AMMO | IT_JETPACK | IT_FU enum { ITEM_FLAG_NORMAL = BIT(0), ///< Item is usable during normal gameplay. - ITEM_FLAG_MUTATORBLOCKED = BIT(1) + ITEM_FLAG_MUTATORBLOCKED = BIT(1), + ITEM_FLAG_RESOURCE = BIT(2) ///< Item is is a resource, not a held item. }; #define ITEM_HANDLE(signal, ...) __Item_Send_##signal(__VA_ARGS__)