From e803bfadf535fcf97a3ff2edb8af35a6835b63b3 Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 11 Jul 2020 00:37:58 +1000 Subject: [PATCH] Add SPAWNFUNC_WEAPON_COND macro for game compatibility (matches SPAWNFUNC_ITEM_COND) --- qcsrc/common/weapons/weapon.qh | 9 +++++++++ 1 file changed, 9 insertions(+) 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 -- 2.39.5