From: terencehill Date: Tue, 24 Jul 2018 20:33:49 +0000 (+0200) Subject: Fix #2069 "LMS doesn't remove 25h on some maps (forest2, farewell, probably others)" X-Git-Tag: xonotic-v0.8.5~1949 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=6aa821a0977c60e45cc2d9290c794e88f155b907;p=xonotic%2Fxonotic-data.pk3dir.git Fix #2069 "LMS doesn't remove 25h on some maps (forest2, farewell, probably others)" --- 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)