]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add weapons
authorTimePath <andrew.hardaker1995@gmail.com>
Fri, 21 Aug 2015 09:12:48 +0000 (19:12 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Fri, 21 Aug 2015 09:12:48 +0000 (19:12 +1000)
qcsrc/common/weapons/all.qh
qcsrc/menu/xonotic/dialog_media_guide.qc

index ac839a53a047f6006d5b16e9f41403fb61199033..e1ff03941c6453c9b8b684dbd4b8d1e94b0fc564 100644 (file)
@@ -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,
index d2d49f1d1d5c19340e17c484032d3d8db1568ab8..e16a48780bcfd6118103155e79be1c523ec27df0 100644 (file)
@@ -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)