]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add SPAWNFUNC_WEAPON_COND macro for game compatibility (matches SPAWNFUNC_ITEM_COND)
authorMario <mario.mario@y7mail.com>
Fri, 10 Jul 2020 14:37:58 +0000 (00:37 +1000)
committerMario <mario.mario@y7mail.com>
Fri, 10 Jul 2020 14:37:58 +0000 (00:37 +1000)
qcsrc/common/weapons/weapon.qh

index 02fbdb536c283c669714f2ac754df048f3bacd9f..38134fa3d68cb66bef6ed9ef5a111b07ce5a88f7 100644 (file)
@@ -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 <common/items/_mod.qh>