-#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"
+
+// NOTE: 24 is the limit for the .items field
+REGISTRY(Items, 32)
+#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)
+
+REGISTRY_DEFINE_GET(Items, NULL)
+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", false) {
+ switch (request) {
+ case CMD_REQUEST_COMMAND: {
+ Dump_Items();
+ return;
+ }
+ default:
+ case CMD_REQUEST_USAGE: {
+ LOG_HELPF("Usage:^3 %s dumpitems", GetProgramCommandPrefix());
+ return;
+ }
+ }
+}
-#include "inventory.qh"
+#ifdef GAMEQC
+string Item_Model(string item_mdl);
+#endif