]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/items/all.qh
common: move instagib and nexball as they add custom items and weapons
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / items / all.qh
index 74ca110ef114b0371539d28331bf2d51fa16ebda..a825b4ed16fbfb58a8718ce4ca5cd86d2e9c97cb 100644 (file)
@@ -1,38 +1,38 @@
-#ifndef ALL_H
-#define ALL_H
-
-const int MAX_ITEMS = 23;
-entity ITEMS[MAX_ITEMS];
-
-#define ITEMS_FOREACH(pred, body) do {      \
-    for (int i = 0; i < ITEM_COUNT; i++) {  \
-        const entity it = ITEMS[i];         \
-        if (pred) { body }                  \
-    }                                       \
-} while(0)
-
-void RegisterItems();
-void ItemTest();
-
-#ifdef CSQC
-void ReadItems()
-{
-/*
-    const int flags = read();
-    for (int i = 0; i < MAX_ITEMS; i++) {
-        if (flags & BIT(i)) {
-            self.items[i] = read();
+#ifndef ITEMS_ALL_H
+#define ITEMS_ALL_H
+
+#include "../command/all.qh"
+
+#include "item.qh"
+
+REGISTRY(Items, BIT(5))
+REGISTER_REGISTRY(RegisterItems)
+/** If you register a new item, make sure to add it to all.inc */
+#define REGISTER_ITEM(id, class) REGISTER(RegisterItems, ITEM, Items, id, m_id, NEW(class))
+
+REGISTRY_SORT(Items, m_name, 0)
+STATIC_INIT(Items) { FOREACH(Items, true, LAMBDA(it.m_id = i)); }
+
+void Dump_Items();
+
+GENERIC_COMMAND(dumpitems, "Dump all items to the console") {
+    switch (request) {
+        case CMD_REQUEST_COMMAND: {
+            Dump_Items();
+            return;
+        }
+        default:
+        case CMD_REQUEST_USAGE: {
+            LOG_INFOF("\nUsage:^3 %s dumpitems", GetProgramCommandPrefix());
+            return;
         }
     }
-*/
 }
-#endif
-
-#ifdef SVQC
-void WriteItems()
-{
 
-}
+#ifndef MENUQC
+string Item_Model(string item_mdl);
 #endif
 
 #endif
+
+#include "inventory.qh"