#pragma once

int q3compat = 0;
#define Q3COMPAT_ARENA BIT(0)
#define Q3COMPAT_DEFI BIT(1)

bool autocvar_sv_q3compat_changehitbox;

bool DoesQ3ARemoveThisEntity(entity this);

.int fragsfilter_cnt;

/* 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 (based on SPAWNFUNC_ITEM)
#define SPAWNFUNC_Q3AMMO(classname, xonwep, ...) \
	spawnfunc(classname) \
	{ \
		__VA_OPT__(this.count *= (__VA_ARGS__);) \
		if(this.count && (xonwep).ammo_type != RES_NONE) \
			SetResource(this, (xonwep).ammo_type, rint(this.count * GetAmmoConsumption(xonwep))); \
		SPAWNFUNC_BODY(GetAmmoItem((xonwep).ammo_type)) \
	}

// Weapon only (based on SPAWNFUNC_WEAPON)
#define SPAWNFUNC_Q3WEAPON(classname, xonwep, ...) \
	spawnfunc(classname) \
	{ \
		__VA_OPT__(this.count *= (__VA_ARGS__);) \
		weapon_defaultspawnfunc(this, xonwep); \
	}

// Weapon & ammo
#define SPAWNFUNC_Q3(weapon_classname, ammo_classname, xonwep, ...) \
	SPAWNFUNC_Q3WEAPON(weapon_classname, xonwep, __VA_ARGS__) \
	SPAWNFUNC_Q3AMMO(ammo_classname, xonwep, __VA_ARGS__)

