#pragma once #include REGISTRY(Nades, BITS(4)) REGISTER_REGISTRY(Nades) REGISTRY_CHECK(Nades) #define REGISTER_NADE(id, inst) REGISTER(Nades, NADE_TYPE, id, m_id, inst) CLASS(Nade, Object) ATTRIB(Nade, m_id, int, 0); ATTRIB(Nade, m_color, vector, '0 0 0'); ATTRIB(Nade, m_name, string, _("Grenade")); ATTRIB(Nade, m_icon, string, "nade_normal"); ATTRIB(Nade, m_alpha, float, 1); ATTRIB(Nade, netname, string, "random"); ATTRIB(Nade, impulse, int, 0); // legacy number for selection, do not add to new nade types ATTRIBARRAY(Nade, m_projectile, int, 2); ATTRIBARRAY(Nade, m_trail, entity, 2); #ifndef SVQC METHOD(Nade, display, void(entity this, void(string name, string icon) returns)) { string img = sprintf("/gfx/hud/%s/%s", cvar_string("hud_skin"), this.m_icon); #ifdef CSQC if (precache_pic(img) == "") #endif #ifdef MENUQC if (draw_PreloadPicture(img) == "") #endif img = sprintf("/gfx/hud/default/%s", this.m_icon); returns(this.m_name, img); } #endif ENDCLASS(Nade) REGISTER_NADE(Null, NEW(Nade)); REGISTRY_DEFINE_GET(Nades, NADE_TYPE_Null) // use slots 70-100 const int PROJECTILE_NADE = 71; const int PROJECTILE_NADE_BURN = 72; // the rest of these are defined in their individual files like nade/napalm.qh #ifdef GAMEQC #include "effects.inc" #define NADE_PROJECTILE(i, projectile, trail) MACRO_BEGIN \ this.m_projectile[i] = projectile; \ this.m_trail[i] = trail; \ MACRO_END #endif // GAMEQC Nade Nade_FromProjectile(int proj) { FOREACH(Nades, true, { if (it.m_projectile[0] == proj || it.m_projectile[1] == proj) return it; }); return NADE_TYPE_Null; } #include "all.inc" .float orb_lifetime; .float orb_radius; #ifdef GAMEQC REPLICATE_INIT(string, cvar_cl_nade_type); REPLICATE_INIT(string, cvar_cl_pokenade_type); #endif