#pragma once

#ifdef GAMEQC
MODEL(MORTAR_VIEW, W_Model("h_gl.iqm"));
MODEL(MORTAR_WORLD, W_Model("v_gl.md3"));
MODEL(MORTAR_ITEM, W_Model("g_gl.md3"));

SOUND(MORTAR_DET, W_Sound("rocket_det"));
SOUND(MORTAR_FIRE, W_Sound("grenade_fire"));
SOUND(MORTAR_IMPACT, W_Sound("grenade_impact"));
SOUND(MORTAR_STICK, W_Sound("grenade_stick"));
#endif

CLASS(Mortar, Weapon)
#ifdef SVQC
/* spawnfunc */ ATTRIB(Mortar, m_canonical_spawnfunc, string, "weapon_mortar");
/* rating    */ ATTRIB(Mortar, bot_pickupbasevalue, float, 7000);
#endif
/* ammotype  */ ATTRIB(Mortar, ammo_type, Resource, RES_ROCKETS);
/* impulse   */ ATTRIB(Mortar, impulse, int, 4);
/* flags     */ ATTRIB(Mortar, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH | WEP_FLAG_NOTRUEAIM);
/* color     */ ATTRIB(Mortar, m_color, vector, '0.988 0.392 0.314');
#ifdef GAMEQC
/* modelname */ ATTRIB(Mortar, mdl, string, "gl");
/* model     */ ATTRIB(Mortar, m_model, Model, MDL_MORTAR_ITEM);
/* flash mdl */ ATTRIB(Mortar, m_muzzlemodel, Model, MDL_Null);
/* flash eff */ ATTRIB(Mortar, m_muzzleeffect, entity, EFFECT_GRENADE_MUZZLEFLASH);
#endif
#ifdef CSQC
/* crosshair */ ATTRIB(Mortar, w_crosshair, string, "gfx/crosshairgrenadelauncher");
/* crosshair */ ATTRIB(Mortar, w_crosshair_size, float, 0.7);
#endif
/* wepimg    */ ATTRIB(Mortar, model2, string, "weapongrenadelauncher");
/* refname   */ ATTRIB(Mortar, netname, string, "mortar");
/* wepname   */ ATTRIB(Mortar, m_name, string, _("Mortar"));
/* legacy    */ ATTRIB(Mortar, m_deprecated_netname, string, "grenadelauncher");

#define X(BEGIN, P, END, class, prefix) \
	BEGIN(class) \
		P(class, prefix, ammo, float, BOTH) \
		P(class, prefix, animtime, float, BOTH) \
		P(class, prefix, bouncefactor, float, NONE) \
		P(class, prefix, bouncestop, float, NONE) \
		P(class, prefix, damageforcescale, float, BOTH) \
		P(class, prefix, damage, float, BOTH) \
		P(class, prefix, edgedamage, float, BOTH) \
		P(class, prefix, force, float, BOTH) \
		P(class, prefix, health, float, BOTH) \
		P(class, prefix, lifetime, float, BOTH) \
		P(class, prefix, lifetime_bounce, float, SEC) \
		P(class, prefix, lifetime_stick, float, BOTH) \
		P(class, prefix, pickup_ammo, float, NONE) \
		P(class, prefix, radius, float, BOTH) \
		P(class, prefix, refire, float, BOTH) \
		P(class, prefix, reload_ammo, float, NONE) \
		P(class, prefix, reload_time, float, NONE) \
		P(class, prefix, remote_detonateprimary, float, SEC) \
		P(class, prefix, remote_minbouncecnt, float, PRI) \
		P(class, prefix, speed, float, BOTH) \
		P(class, prefix, speed_up, float, BOTH) \
		P(class, prefix, speed_z, float, BOTH) \
		P(class, prefix, spread, float, BOTH) \
		P(class, prefix, switchdelay_drop, float, NONE) \
		P(class, prefix, switchdelay_raise, float, NONE) \
		P(class, prefix, type, float, BOTH) \
		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, Mortar, mortar)
#undef X

ENDCLASS(Mortar)
REGISTER_WEAPON(MORTAR, NEW(Mortar));

SPAWNFUNC_WEAPON(weapon_mortar, WEP_MORTAR)

#ifdef SVQC
.float gl_detonate_later;
.float gl_bouncecnt;
#endif
