X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fitems%2Fall.qh;h=dc8cf21c020a6d06993f87281cc1dad98f29cbac;hb=228743a67588c5488f678a9d0ead45bf8a50b6c2;hp=e22bcd7477c3e8e2ea534f65deb1c20430c1502f;hpb=17f8cdecf39482eca4a49623d67bfdb5f4477d29;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/items/all.qh b/qcsrc/common/items/all.qh index e22bcd747..dc8cf21c0 100644 --- a/qcsrc/common/items/all.qh +++ b/qcsrc/common/items/all.qh @@ -1,18 +1,34 @@ -#include "../registry.qh" +#pragma once -#ifndef ITEMS_ALL_H -#define ITEMS_ALL_H +#include -void RegisterItems(); -const int MAX_ITEMS = 24; -entity ITEMS[MAX_ITEMS], ITEMS_first, ITEMS_last; -int ITEM_COUNT; -/** If you register a new item, make sure to add it to all.inc */ -#define REGISTER_ITEM(id, class) REGISTER(RegisterItems, ITEM, ITEMS, ITEM_COUNT, id, m_id, NEW(class)) -REGISTER_REGISTRY(RegisterItems) +#include "item.qh" + +REGISTRY(Items, BITS(7)) +#define Items_from(i) _Items_from(i, NULL) +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 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("\nUsage:^3 %s dumpitems", GetProgramCommandPrefix()); + return; + } + } +} -#include "inventory.qh" +#ifdef GAMEQC +string Item_Model(string item_mdl); +#endif