]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/guide/tab.qh
Hide null and hidden entries from the guide menu
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / guide / tab.qh
index ad791856c256aa1b2751747b718591eb45545d34..d2603fa2fb1b725872acb7aabd035eeeba6791b0 100644 (file)
@@ -1,5 +1,7 @@
 #pragma once
 
+#include <common/items/item.qh>
+#include <menu/anim/animhost.qh>
 #include <menu/xonotic/datasource.qh>
 
 #define TOPICS(X) \
@@ -78,13 +80,23 @@ CLASS(DebugSource, DataSource)
 ENDCLASS(DebugSource)
 
 #define REGISTRY_SOURCE(id, arr) \
+ArrayList arr##_MENU; \
+int arr##_MENU_COUNT; \
+STATIC_INIT_LATE(arr##_MENU) \
+{ \
+    AL_NEW(arr##_MENU, arr##_MAX, NULL, e); \
+    FOREACH(arr, !it.m_hidden, { \
+        AL_sete(arr##_MENU, arr##_MENU_COUNT, it); \
+        arr##_MENU_COUNT++; \
+    }); \
+} \
 CLASS(id, DataSource) \
     METHOD(id, getEntry, entity(id this, int i, void(string, string) returns)) { \
-        entity e = _R_GET(_##arr, i); \
+        entity e = AL_gete(arr##_MENU, i); \
         if (returns) e.display(e, returns); \
         return e; \
     } \
-    METHOD(id, reload, int(id this, string filter)) { return arr##_COUNT; } \
+    METHOD(id, reload, int(id this, string filter)) { return arr##_MENU_COUNT; } \
 ENDCLASS(id)
 
 #include "pages.qh"
@@ -97,7 +109,7 @@ REGISTRY_SOURCE(GametypeSource, Gametypes)
 REGISTRY_SOURCE(ItemSource, Items)
 
 #include <common/mutators/mutator/buffs/buffs.qh>
-REGISTRY_SOURCE(BuffSource, Buffs)
+REGISTRY_SOURCE(BuffSource, StatusEffect)
 
 #include <common/mutators/mutator/nades/nades.qh>
 REGISTRY_SOURCE(NadeSource, Nades)
@@ -150,6 +162,7 @@ CLASS(XonoticGuideTab, XonoticTab)
     METHOD(XonoticGuideTab, topicChangeNotify, void(entity, entity));
     METHOD(XonoticGuideTab, entryChangeNotify, void(entity, entity));
 
+    ATTRIB(XonoticGuideTab, controlledTextbox, entity);
     ATTRIB(XonoticGuideTab, topicList, entity, NEW(XonoticTopicList, NEW(TopicSource)));
     ATTRIB(XonoticGuideTab, entryList, entity, NEW(XonoticEntryList, NULL));
     ATTRIB(XonoticGuideTab, descriptionPane, entity, NEW(XonoticGuideDescription));