.float strength_finished; // NOTE: this field is used only by map entities, it does not directly apply the strength stat
.float invincible_finished; // ditto
-#define spawnfunc_body(item) \
- if (!(item) || !Item_IsDefinitionAllowed(item)) \
+#define SPAWNFUNC_BODY(item) \
+ if (item && Item_IsDefinitionAllowed(item)) \
+ StartItem(this, item); \
+ else \
{ \
startitem_failed = true; \
delete(this); \
- return; \
- } \
- StartItem(this, item)
+ }
#define SPAWNFUNC_ITEM(name, item) \
spawnfunc(name) \
{ \
- spawnfunc_body(item); \
+ SPAWNFUNC_BODY(item) \
}
#define SPAWNFUNC_ITEM_COND(name, cond, item1, item2) \
- spawnfunc(name) \
- { \
- entity item = (cond) ? item1 : item2; \
- spawnfunc_body(item); \
- }
+ SPAWNFUNC_ITEM(name, (cond ? item1 : item2))
#else
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); \
- }
+ SPAWNFUNC_WEAPON(name, (cond ? wep1 : wep2))
#else
// BFG -> Crylink || Fireball
SPAWNFUNC_Q3_COND(weapon_bfg, ammo_bfg, cvar_string("g_mod_balance") == "XDF", WEP_CRYLINK, WEP_FIREBALL)
- // FIXME: WEP_FIREBALL has no ammo_type field so ammo_bfg is deleted by spawnfunc_body
+ // FIXME: WEP_FIREBALL has no ammo_type field so ammo_bfg is deleted by SPAWNFUNC_BODY
// grappling hook -> hook
SPAWNFUNC_WEAPON(weapon_grapplinghook, WEP_HOOK)
.int fragsfilter_cnt;
-// The ammo spawnfunc knows which weapon will use the ammo so it can look up the type
-// and calculate the amount required for the number of shots in the count field.
-#define _SPAWNFUNC_Q3AMMO(ammo_classname, xonwep) \
- if(this.count && xonwep.ammo_type) \
- SetResource(this, xonwep.ammo_type, this.count * GetAmmoConsumptionPrimary(xonwep.netname)); \
- spawnfunc_body(GetAmmoItem(xonwep.ammo_type));
-
+/* We tell the ammo spawnfunc which weapon will use the ammo so it can
+ * calculate the amount required for the number of shots in the count field,
+ * and so the type can be looked up rather than specified in quake3.qc
+ */
// Ammo only, unconditional
#define SPAWNFUNC_Q3AMMO(ammo_classname, xonwep) \
spawnfunc(ammo_classname) \
{ \
- _SPAWNFUNC_Q3AMMO(ammo_classname, xonwep) \
+ if(this.count && xonwep.ammo_type) \
+ SetResource(this, xonwep.ammo_type, this.count * GetAmmoConsumptionPrimary(xonwep.netname)); \
+ SPAWNFUNC_BODY(GetAmmoItem(xonwep.ammo_type)) \
}
// Ammo only, conditional
#define SPAWNFUNC_Q3AMMO_COND(ammo_classname, cond, xonwep1, xonwep0) \
- spawnfunc(ammo_classname) \
- { \
- entity xonwep = (cond) ? xonwep1 : xonwep0; \
- _SPAWNFUNC_Q3AMMO(ammo_classname, xonwep) \
- }
+ SPAWNFUNC_Q3AMMO(ammo_classname, (cond ? xonwep1 : xonwep0))
// Weapon & ammo, unconditional
#define SPAWNFUNC_Q3(weapon_classname, ammo_classname, xonwep) \