#include "monster.qh"
-void RegisterMonsters();
-const int MON_MAXCOUNT = 24;
-entity monster_info[MON_MAXCOUNT], monster_info_first, monster_info_last;
-entity get_monsterinfo(float id);
-int MON_COUNT;
+REGISTRY(Monsters, 24)
+REGISTER_REGISTRY(RegisterMonsters)
const int MON_FIRST = 1;
-#define MON_LAST (MON_FIRST + MON_COUNT - 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, monster_info, MON_COUNT, id, monsterid, inst)
-REGISTER_REGISTRY(RegisterMonsters)
-
-entity get_monsterinfo(int id);
+#define REGISTER_MONSTER(id, inst) REGISTER(RegisterMonsters, MON, Monsters, Monsters_COUNT, 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