From 6aa821a0977c60e45cc2d9290c794e88f155b907 Mon Sep 17 00:00:00 2001 From: terencehill Date: Tue, 24 Jul 2018 22:33:49 +0200 Subject: [PATCH] Fix #2069 "LMS doesn't remove 25h on some maps (forest2, farewell, probably others)" --- qcsrc/common/items/item.qh | 28 +++++++++++++++++++--------- qcsrc/server/compat/quake.qc | 2 +- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/qcsrc/common/items/item.qh b/qcsrc/common/items/item.qh index 3109e7c92..030b4db1c 100644 --- a/qcsrc/common/items/item.qh +++ b/qcsrc/common/items/item.qh @@ -51,16 +51,26 @@ const int IT_PICKUPMASK = IT_UNLIMITED_AMMO | IT_JETPACK | IT_FU .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 @@ -73,7 +83,7 @@ enum { 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__) diff --git a/qcsrc/server/compat/quake.qc b/qcsrc/server/compat/quake.qc index e830fe6c4..c80da0af3 100644 --- a/qcsrc/server/compat/quake.qc +++ b/qcsrc/server/compat/quake.qc @@ -15,4 +15,4 @@ SPAWNFUNC_ITEM(item_spikes, ITEM_Bullets) //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) -- 2.39.2