From be3764e4ac79e07f5dba788f7e994923a3638deb Mon Sep 17 00:00:00 2001 From: TimePath Date: Mon, 17 Aug 2015 17:21:38 +1000 Subject: [PATCH] Add nades topic --- qcsrc/common/nades.qh | 11 +++++++++++ qcsrc/menu/xonotic/dialog_media_guide.qc | 13 +++++++++++++ 2 files changed, 24 insertions(+) diff --git a/qcsrc/common/nades.qh b/qcsrc/common/nades.qh index 01eb7fff2c..b876c86c9c 100644 --- a/qcsrc/common/nades.qh +++ b/qcsrc/common/nades.qh @@ -33,9 +33,14 @@ REGISTER_REGISTRY(RegisterNades) 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") ATTRIBARRAY(Nade, m_projectile, int, 2) ATTRIBARRAY(Nade, m_trail, string, 2) + METHOD(Nade, display, void(entity this, void(string name, string icon) returns)) + void Nade_display(entity this, void(string name, string icon) returns) { + returns(this.m_name, sprintf("/gfx/hud/%s/%s", cvar_string("menu_skin"), this.m_icon)); + } ENDCLASS(Nade) REGISTER_NADE(NULL); @@ -53,6 +58,7 @@ REGISTER_NADE(NORMAL) { REGISTER_NADE(NAPALM) { this.m_color = '2 0.5 0'; + this.m_name = _("Napalm grenade"); this.m_icon = "nade_napalm"; NADE_PROJECTILE(0, PROJECTILE_NADE_NAPALM, "TR_ROCKET"); NADE_PROJECTILE(1, PROJECTILE_NADE_NAPALM_BURN, "spiderbot_rocket_thrust"); @@ -60,6 +66,7 @@ REGISTER_NADE(NAPALM) { REGISTER_NADE(ICE) { this.m_color = '0 0.5 2'; + this.m_name = _("Ice grenade"); this.m_icon = "nade_ice"; NADE_PROJECTILE(0, PROJECTILE_NADE_ICE, "TR_NEXUIZPLASMA"); NADE_PROJECTILE(1, PROJECTILE_NADE_ICE_BURN, "wakizashi_rocket_thrust"); @@ -67,6 +74,7 @@ REGISTER_NADE(ICE) { REGISTER_NADE(TRANSLOCATE) { this.m_color = '1 0 1'; + this.m_name = _("Translocate grenade"); this.m_icon = "nade_translocate"; NADE_PROJECTILE(0, PROJECTILE_NADE_TRANSLOCATE, "TR_CRYLINKPLASMA"); NADE_PROJECTILE(1, PROJECTILE_NADE_TRANSLOCATE, "TR_CRYLINKPLASMA"); @@ -74,6 +82,7 @@ REGISTER_NADE(TRANSLOCATE) { REGISTER_NADE(SPAWN) { this.m_color = '1 0.9 0'; + this.m_name = _("Spawn grenade"); this.m_icon = "nade_spawn"; NADE_PROJECTILE(0, PROJECTILE_NADE_SPAWN, "nade_yellow"); NADE_PROJECTILE(1, PROJECTILE_NADE_SPAWN, "nade_yellow"); @@ -81,6 +90,7 @@ REGISTER_NADE(SPAWN) { REGISTER_NADE(HEAL) { this.m_color = '1 0 0'; + this.m_name = _("Heal grenade"); this.m_icon = "nade_heal"; NADE_PROJECTILE(0, PROJECTILE_NADE_HEAL, "nade_red"); NADE_PROJECTILE(1, PROJECTILE_NADE_HEAL_BURN, "nade_red_burn"); @@ -88,6 +98,7 @@ REGISTER_NADE(HEAL) { REGISTER_NADE(MONSTER) { this.m_color = '0.25 0.75 0'; + this.m_name = _("Monster grenade"); this.m_icon = "nade_monster"; NADE_PROJECTILE(0, PROJECTILE_NADE_MONSTER, "nade_red"); NADE_PROJECTILE(1, PROJECTILE_NADE_MONSTER_BURN, "nade_red_burn"); diff --git a/qcsrc/menu/xonotic/dialog_media_guide.qc b/qcsrc/menu/xonotic/dialog_media_guide.qc index 3c9939e318..d2d49f1d1d 100644 --- a/qcsrc/menu/xonotic/dialog_media_guide.qc +++ b/qcsrc/menu/xonotic/dialog_media_guide.qc @@ -6,6 +6,7 @@ X(NEW(GametypeSource), _("Gametypes"), "gametype_dm") \ X(NEW(ItemSource), _("Items"), "gametype_kh") \ X(NEW(BuffSource), _("Buffs"), "gametype_dom") \ + X(NEW(NadeSource), _("Nades"), "gametype_ft") \ X(NEW(MapSource), _("Maps"), "gametype_ctf") \ if (cvar("developer")) X(NEW(DebugSource), _("Debug"), "gametype_ons") \ /**/ @@ -108,6 +109,18 @@ CLASS(BuffSource, DataSource) int BuffSource_reload(string filter) { return BUFFS_COUNT; } ENDCLASS(BuffSource) +#include "../../common/nades.qh" +CLASS(NadeSource, DataSource) + METHOD(NadeSource, getEntry, entity(int, void(string, string))) + entity NadeSource_getEntry(int i, void(string, string) returns) { + entity e = NADES[i]; + if (returns) e.display(e, returns); + return e; + } + METHOD(NadeSource, reload, int(string)) + int NadeSource_reload(string filter) { return NADES_COUNT; } +ENDCLASS(NadeSource) + CLASS(MapSource, DataSource) METHOD(MapSource, getEntry, entity(int, void(string, string))) entity MapSource_getEntry(int i, void(string, string) returns) -- 2.39.2