]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/monsters/all.qc
Monsters: upgrade mage
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / monsters / all.qc
index 37dbcb325867662132853feb7f890b4915d01cb9..f0c5214fcc55b9087e9103932fb288a650b89163 100644 (file)
@@ -1,47 +1,27 @@
+#ifndef MONSTERS_ALL_C
+#define MONSTERS_ALL_C
 #include "all.qh"
 
-#include "all.inc"
+REGISTER_MONSTER(Null, NEW(Monster)) {
+       this.netname = "";
+       this.monster_name = "Monster";
+       this.monster_func = m_null;
+       this.mdl = "";
+       this.mins = '-0 -0 -0';
+       this.maxs = '0 0 0';
+       this.model = "";
+}
 
-// MONSTER PLUGIN SYSTEM
-entity monster_info[MON_MAXCOUNT];
-entity dummy_monster_info;
+#include "all.inc"
 
-void register_monster(int id, float(float) func, int monsterflags, vector min_s, vector max_s, string modelname, string shortname, string mname)
-{
-       entity e;
-       monster_info[id - 1] = e = spawn();
-       e.classname = "monster_info";
-       e.monsterid = id;
-       e.netname = shortname;
-       e.monster_name = mname;
-       e.monster_func = func;
-       e.mdl = modelname;
-       e.spawnflags = monsterflags;
-       e.mins = min_s;
-       e.maxs = max_s;
-       e.model = strzone(strcat("models/monsters/", modelname));
-}
-float m_null(float dummy) { return 0; }
-void register_monsters_done()
-{
-       dummy_monster_info = spawn();
-       dummy_monster_info.classname = "monster_info";
-       dummy_monster_info.monsterid = 0; // you can recognize dummies by this
-       dummy_monster_info.netname = "";
-       dummy_monster_info.monster_name = "Monster";
-       dummy_monster_info.monster_func = m_null;
-       dummy_monster_info.mdl = "";
-       dummy_monster_info.mins = '-0 -0 -0';
-       dummy_monster_info.maxs = '0 0 0';
-       dummy_monster_info.model = "";
-}
 entity get_monsterinfo(int id)
 {
-       entity m;
-       if(id < MON_FIRST || id > MON_LAST)
-               return dummy_monster_info;
-       m = monster_info[id - 1];
-       if(m)
-               return m;
-       return dummy_monster_info;
+       if (id >= MON_FIRST && id <= MON_LAST)
+       {
+               entity m = monster_info[id];
+               if (m) return m;
+       }
+       return MON_Null;
 }
+
+#endif