From: Mario Date: Fri, 10 Jul 2020 14:37:58 +0000 (+1000) Subject: Add SPAWNFUNC_WEAPON_COND macro for game compatibility (matches SPAWNFUNC_ITEM_COND) X-Git-Tag: xonotic-v0.8.5~888 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e803bfadf535fcf97a3ff2edb8af35a6835b63b3;p=xonotic%2Fxonotic-data.pk3dir.git Add SPAWNFUNC_WEAPON_COND macro for game compatibility (matches SPAWNFUNC_ITEM_COND) --- diff --git a/qcsrc/common/weapons/weapon.qh b/qcsrc/common/weapons/weapon.qh index 02fbdb536..38134fa3d 100644 --- a/qcsrc/common/weapons/weapon.qh +++ b/qcsrc/common/weapons/weapon.qh @@ -129,10 +129,19 @@ void weapon_defaultspawnfunc(entity this, Weapon e); #define SPAWNFUNC_WEAPON(name, weapon) \ spawnfunc(name) { weapon_defaultspawnfunc(this, weapon); } +#define SPAWNFUNC_WEAPON_COND(name, cond, wep1, wep2) \ + spawnfunc(name) \ + { \ + entity wep = (cond) ? wep1 : wep2; \ + weapon_defaultspawnfunc(this, wep); \ + } + #else #define SPAWNFUNC_WEAPON(name, weapon) +#define SPAWNFUNC_WEAPON_COND(name, weapon) + #endif #include