]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/monsters/all.qh
Registry: use BITS everywhere
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / monsters / all.qh
index c79a4e656c4033131542558bd4b49ec9a5a56869..72861f9d236eea06b46e4a44879e5598f42f5fd3 100644 (file)
@@ -1,11 +1,26 @@
-// TODO: include once
-//#ifndef MONSTERS_ALL_H
-//#define MONSTERS_ALL_H
+#ifndef MONSTERS_ALL_H
+#define MONSTERS_ALL_H
 
-#include "monster/zombie.qc"
-#include "monster/spider.qc"
-#include "monster/mage.qc"
-#include "monster/wyvern.qc"
-#include "monster/shambler.qc"
+#include "monster.qh"
 
-//#endif
+REGISTRY(Monsters, BITS(4))
+REGISTER_REGISTRY(RegisterMonsters)
+const int MON_FIRST = 1;
+#define MON_LAST (Monsters_COUNT - 1)
+/** If you register a new monster, make sure to add it to all.inc */
+#define REGISTER_MONSTER(id, inst) REGISTER(RegisterMonsters, MON, Monsters, id, monsterid, inst)
+
+REGISTER_MONSTER(Null, NEW(Monster));
+
+Monster get_monsterinfo(int id)
+{
+       if (id >= MON_FIRST && id <= MON_LAST) {
+               Monster m = Monsters[id];
+               if (m) return m;
+       }
+       return MON_Null;
+}
+
+#include "all.inc"
+
+#endif