From: TimePath Date: Mon, 17 Aug 2015 07:18:00 +0000 (+1000) Subject: Add buffs topic X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=61c7b7d2a9a2c79b11067cf3f5e571d82042a406;p=xonotic%2Fxonotic-data.pk3dir.git Add buffs topic --- diff --git a/qcsrc/common/buffs.qh b/qcsrc/common/buffs.qh index db57943241..87dff12a0c 100644 --- a/qcsrc/common/buffs.qh +++ b/qcsrc/common/buffs.qh @@ -33,6 +33,10 @@ CLASS(Buff, Pickup) ATTRIB(Buff, m_prettyName, string, "Buff") ATTRIB(Buff, m_skin, int, 0) ATTRIB(Buff, m_sprite, string, "") + METHOD(Buff, display, void(entity this, void(string name, string icon) returns)) + void Buff_display(entity this, void(string name, string icon) returns) { + returns(this.m_prettyName, sprintf("/gfx/hud/%s/buff_%s", cvar_string("menu_skin"), this.m_name)); + } #ifdef SVQC METHOD(Buff, m_time, float(entity)) float Buff_m_time(entity this) { return cvar(strcat("g_buffs_", this.netname, "_time")); } diff --git a/qcsrc/menu/xonotic/dialog_media_guide.qc b/qcsrc/menu/xonotic/dialog_media_guide.qc index 33a06ace75..3c9939e318 100644 --- a/qcsrc/menu/xonotic/dialog_media_guide.qc +++ b/qcsrc/menu/xonotic/dialog_media_guide.qc @@ -5,6 +5,7 @@ #define TOPICS(X) \ X(NEW(GametypeSource), _("Gametypes"), "gametype_dm") \ X(NEW(ItemSource), _("Items"), "gametype_kh") \ + X(NEW(BuffSource), _("Buffs"), "gametype_dom") \ X(NEW(MapSource), _("Maps"), "gametype_ctf") \ if (cvar("developer")) X(NEW(DebugSource), _("Debug"), "gametype_ons") \ /**/ @@ -95,6 +96,18 @@ CLASS(ItemSource, DataSource) int ItemSource_reload(string filter) { return ITEM_COUNT; } ENDCLASS(ItemSource) +#include "../../common/buffs.qh" +CLASS(BuffSource, DataSource) + METHOD(BuffSource, getEntry, entity(int, void(string, string))) + entity BuffSource_getEntry(int i, void(string, string) returns) { + entity e = BUFFS[i]; + if (returns) e.display(e, returns); + return e; + } + METHOD(BuffSource, reload, int(string)) + int BuffSource_reload(string filter) { return BUFFS_COUNT; } +ENDCLASS(BuffSource) + CLASS(MapSource, DataSource) METHOD(MapSource, getEntry, entity(int, void(string, string))) entity MapSource_getEntry(int i, void(string, string) returns)