X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fitems%2Fall.qh;h=a825b4ed16fbfb58a8718ce4ca5cd86d2e9c97cb;hb=f9e4718d229df569d7878259d3db2bd2df1e7b91;hp=2e33119fb089920e71c69ccf07051223dc945496;hpb=c89dfaa4d0342b98c320621557973a65114fbdf4;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/items/all.qh b/qcsrc/common/items/all.qh index 2e33119fb..a825b4ed1 100644 --- a/qcsrc/common/items/all.qh +++ b/qcsrc/common/items/all.qh @@ -1,16 +1,38 @@ #ifndef ITEMS_ALL_H #define ITEMS_ALL_H -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)) +#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; + } + } +} + +#ifndef MENUQC +string Item_Model(string item_mdl); +#endif + #endif #include "inventory.qh"