]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add a debug menu
authorTimePath <andrew.hardaker1995@gmail.com>
Sun, 16 Aug 2015 10:29:17 +0000 (20:29 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Sun, 16 Aug 2015 10:29:17 +0000 (20:29 +1000)
qcsrc/menu/xonotic/dialog_media_guide.qc

index 929cc20151fccd4ecc7dd7ba8afb1b1ad79b091e..8ea4214fbf534b8f2ccbe8afa4a285c73a97aa80 100644 (file)
@@ -5,6 +5,7 @@
 #define TOPICS(X) \
     X(NEW(GametypeSource),  _("Gametypes"), "gametype_dm") \
     X(NEW(MapSource),       _("Maps"),      "gametype_ctf") \
+    if (cvar("developer")) X(NEW(DebugSource), _("Debug"), "gametype_ons") \
     /**/
 CLASS(TopicSource, DataSource)
     .string icon, name;
@@ -32,6 +33,39 @@ CLASS(TopicSource, DataSource)
     }
 ENDCLASS(TopicSource)
 
+CLASS(DebugSource, DataSource)
+    .string name, icon;
+    ATTRIB(DebugSource, entryName, .string, name)
+    ATTRIB(DebugSource, entryIcon, .string, icon)
+    .entity chain;
+    METHOD(DebugSource, getEntry, entity(int))
+    entity DebugSource_getEntry(int i) {
+        int idx = 0;
+        entity e;
+        for (e = findchainfloat(instanceOfObject, true); e; e = e.chain) {
+            if (e.classname == "vtbl") continue;
+            if (e.instanceOfItem) continue;
+            if (idx++ == i) break;
+        }
+        static entity entry;
+        if (!entry) entry = new(entry);
+        entry.name = sprintf("entity %i", e);
+        entry.icon = "";
+        return entry;
+    }
+    METHOD(DebugSource, reload, int(string))
+    int DebugSource_reload(string filter) {
+        int idx = 0;
+        entity e;
+        for (e = findchainfloat(instanceOfObject, true); e; e = e.chain) {
+            if (e.classname == "vtbl") continue;
+            if (e.instanceOfItem) continue;
+            idx++;
+        }
+        return idx;
+    }
+ENDCLASS(DebugSource)
+
 #include "../../common/mapinfo.qh"
 CLASS(GametypeSource, DataSource)
     .string mdl, message;