]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Monsters: rename registry globals
authorTimePath <andrew.hardaker1995@gmail.com>
Tue, 6 Oct 2015 10:04:49 +0000 (21:04 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Tue, 6 Oct 2015 10:04:49 +0000 (21:04 +1100)
qcsrc/common/monsters/all.qc
qcsrc/common/monsters/all.qh

index 232441e57370613861292c8b5f0b5ca5f4c7b80e..f4b2a4bf0bbb5ac7892ccc1f3ec60497bbbf8503 100644 (file)
@@ -3,15 +3,6 @@
 
 #include "all.qh"
 
-entity get_monsterinfo(int id)
-{
-       if (id >= MON_FIRST && id <= MON_LAST) {
-               entity m = monster_info[id];
-               if (m) return m;
-       }
-       return MON_Null;
-}
-
 #define IMPLEMENTATION
 #include "all.inc"
 #undef IMPLEMENTATION
index 7c2f13ddf6967414a0b56d1e73953f6e6ec6a44e..f31e976d69441411b6a2701a058022b996121500 100644 (file)
@@ -3,21 +3,24 @@
 
 #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