#pragma once

#ifdef GAMEQC
MODEL(MACHINEGUN_MUZZLEFLASH, "models/uziflash.md3");
MODEL(MACHINEGUN_VIEW, W_Model("h_uzi.iqm"));
MODEL(MACHINEGUN_WORLD, W_Model("v_uzi.md3"));
MODEL(MACHINEGUN_ITEM, W_Model("g_uzi.md3"));

SOUND(MACHINEGUN_FIRE, W_Sound("uzi_fire"));
#endif

CLASS(MachineGun, Weapon)
#ifdef SVQC
/* spawnfunc */ ATTRIB(MachineGun, m_canonical_spawnfunc, string, "weapon_machinegun");
/* rating    */ ATTRIB(MachineGun, bot_pickupbasevalue, float, 7000);
#endif
/* ammotype  */ ATTRIB(MachineGun, ammo_type, Resource, RES_BULLETS);
/* impulse   */ ATTRIB(MachineGun, impulse, int, 3);
/* flags     */ ATTRIB(MachineGun, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_FLAG_PENETRATEWALLS | WEP_FLAG_BLEED);
/* color     */ ATTRIB(MachineGun, m_color, vector, '0.678 0.886 0.267');
#ifdef GAMEQC
/* modelname */ ATTRIB(MachineGun, mdl, string, "uzi");
/* model     */ ATTRIB(MachineGun, m_model, Model, MDL_MACHINEGUN_ITEM);
/* flash mdl */ ATTRIB(MachineGun, m_muzzlemodel, Model, MDL_MACHINEGUN_MUZZLEFLASH);
/* flash eff */ ATTRIB(MachineGun, m_muzzleeffect, entity, EFFECT_MACHINEGUN_MUZZLEFLASH);
#endif
#ifdef CSQC
/* crosshair */ ATTRIB(MachineGun, w_crosshair, string, "gfx/crosshairuzi");
/* crosshair */ ATTRIB(MachineGun, w_crosshair_size, float, 0.6);
#endif
/* wepimg    */ ATTRIB(MachineGun, model2, string, "weaponuzi");
/* refname   */ ATTRIB(MachineGun, netname, string, "machinegun");
/* wepname   */ ATTRIB(MachineGun, m_name, string, _("MachineGun"));
/* legacy    */ ATTRIB(MachineGun, m_deprecated_netname, string, "uzi");

#define X(BEGIN, P, END, class, prefix) \
	BEGIN(class) \
		P(class, prefix, burst, float, NONE) \
		P(class, prefix, burst_ammo, float, NONE) \
		P(class, prefix, burst_animtime, float, NONE) \
		P(class, prefix, burst_refire2, float, NONE) \
		P(class, prefix, burst_refire, float, NONE) \
		P(class, prefix, burst_spread, float, NONE) \
		P(class, prefix, damagefalloff_forcehalflife, float, NONE) \
		P(class, prefix, damagefalloff_halflife, float, NONE) \
		P(class, prefix, damagefalloff_maxdist, float, NONE) \
		P(class, prefix, damagefalloff_mindist, float, NONE) \
		P(class, prefix, first, float, NONE) \
		P(class, prefix, first_ammo, float, NONE) \
		P(class, prefix, first_damage, float, NONE) \
		P(class, prefix, first_force, float, NONE) \
		P(class, prefix, first_refire, float, NONE) \
		P(class, prefix, first_spread, float, NONE) \
		P(class, prefix, mode, float, NONE) \
		P(class, prefix, pickup_ammo, float, NONE) \
		P(class, prefix, reload_ammo, float, NONE) \
		P(class, prefix, reload_time, float, NONE) \
		P(class, prefix, solidpenetration, float, NONE) \
		P(class, prefix, spread_add, float, NONE) \
		P(class, prefix, spread_crouchmod, float, NONE) \
		P(class, prefix, spread_decay, float, NONE) \
		P(class, prefix, spread_max, float, NONE) \
		P(class, prefix, spread_min, float, NONE) \
		P(class, prefix, spread_cold_damagemultiplier, float, NONE) \
		P(class, prefix, spread_heat_damagemultiplier, float, NONE) \
		P(class, prefix, sustained_ammo, float, NONE) \
		P(class, prefix, sustained_damage, float, NONE) \
		P(class, prefix, sustained_force, float, NONE) \
		P(class, prefix, sustained_refire, float, NONE) \
		P(class, prefix, sustained_spread, float, NONE) \
		P(class, prefix, switchdelay_drop, float, NONE) \
		P(class, prefix, switchdelay_raise, float, NONE) \
		P(class, prefix, weaponreplace, string, NONE) \
		P(class, prefix, weaponstartoverride, float, NONE) \
		P(class, prefix, weaponstart, float, NONE) \
		P(class, prefix, weaponthrowable, float, NONE) \
	END()
	W_PROPS(X, MachineGun, machinegun)
#undef X

ENDCLASS(MachineGun)
REGISTER_WEAPON(MACHINEGUN, NEW(MachineGun));

SPAWNFUNC_WEAPON(weapon_uzi, WEP_MACHINEGUN) // Nexuiz compat
