]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/items/all.qh
Restore initial _entcs_send calls with MSG_ONE as they are needed, but call them...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / items / all.qh
index 1786b4261131d020fa92996027dee78c44c25a8d..623f71b3904ab7654d9e9e88e23291c45d84bb09 100644 (file)
@@ -1,19 +1,37 @@
-#ifndef ALL_H
-#define ALL_H
+#pragma once
 
-const int MAX_ITEMS = 24;
-entity ITEMS[MAX_ITEMS];
+#include <common/command/_mod.qh>
 
-#define ITEMS_FOREACH(pred, body) do {      \
-    for (int i = 0; i < ITEM_COUNT; i++) {  \
-        const noref entity it = ITEMS[i];   \
-        if (pred) { body }                  \
-    }                                       \
-} while(0)
+#include "item.qh"
+
+REGISTRY(Items, BITS(7))
+#define Items_from(i) _Items_from(i, NULL)
+#ifdef GAMEQC
+REGISTRY_DEPENDS(Items, Models)
+#endif
+REGISTER_REGISTRY(Items)
+#define REGISTER_ITEM(id, class) REGISTER(Items, ITEM, id, m_id, NEW(class))
+
+REGISTRY_SORT(Items)
+REGISTRY_CHECK(Items)
+STATIC_INIT(Items) { FOREACH(Items, true, it.m_id = i); }
 
-void RegisterItems();
 void Dump_Items();
 
-#endif
+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("Usage:^3 %s dumpitems", GetProgramCommandPrefix());
+            return;
+        }
+    }
+}
 
-#include "inventory.qh"
+#ifdef GAMEQC
+string Item_Model(string item_mdl);
+#endif