From: TimePath Date: Fri, 21 Aug 2015 09:12:48 +0000 (+1000) Subject: Add weapons X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=27809ca88ef9b689b6c7575af54fa222ca20a1cb;p=xonotic%2Fxonotic-data.pk3dir.git Add weapons --- diff --git a/qcsrc/common/weapons/all.qh b/qcsrc/common/weapons/all.qh index ac839a53a0..e1ff03941c 100644 --- a/qcsrc/common/weapons/all.qh +++ b/qcsrc/common/weapons/all.qh @@ -183,6 +183,11 @@ CLASS(Weapon, Object) /** M: wepname : human readable name */ ATTRIB(Weapon, message, string, "AOL CD Thrower"); + METHOD(Weapon, display, void(entity this, void(string name, string icon) returns)) + void Weapon_display(entity this, void(string name, string icon) returns) { + returns(this.message, this.model2 ? sprintf("/gfx/hud/%s/%s", cvar_string("menu_skin"), this.model2) : string_null); + } + CONSTRUCTOR(Weapon, bool(int) function, .int ammotype, diff --git a/qcsrc/menu/xonotic/dialog_media_guide.qc b/qcsrc/menu/xonotic/dialog_media_guide.qc index d2d49f1d1d..e16a48780b 100644 --- a/qcsrc/menu/xonotic/dialog_media_guide.qc +++ b/qcsrc/menu/xonotic/dialog_media_guide.qc @@ -4,6 +4,7 @@ #define TOPICS(X) \ X(NEW(GametypeSource), _("Gametypes"), "gametype_dm") \ + X(NEW(WeaponSource), _("Weapons"), "gametype_ka") \ X(NEW(ItemSource), _("Items"), "gametype_kh") \ X(NEW(BuffSource), _("Buffs"), "gametype_dom") \ X(NEW(NadeSource), _("Nades"), "gametype_ft") \ @@ -121,6 +122,18 @@ CLASS(NadeSource, DataSource) int NadeSource_reload(string filter) { return NADES_COUNT; } ENDCLASS(NadeSource) +#include "../../common/weapons/all.qh" +CLASS(WeaponSource, DataSource) + METHOD(WeaponSource, getEntry, entity(int, void(string, string))) + entity WeaponSource_getEntry(int i, void(string, string) returns) { + entity e = weapon_info[i]; + if (returns) e.display(e, returns); + return e; + } + METHOD(WeaponSource, reload, int(string)) + int WeaponSource_reload(string filter) { return WEP_COUNT; } +ENDCLASS(WeaponSource) + CLASS(MapSource, DataSource) METHOD(MapSource, getEntry, entity(int, void(string, string))) entity MapSource_getEntry(int i, void(string, string) returns)