]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/monsters/monster.qh
Whitespace police
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / monsters / monster.qh
index ee1ff994a70174ac61dcec4885f44707e68cfa45..b8781cbf95651393dbd5da8c92dcb852f9bb5302 100644 (file)
@@ -1,44 +1,73 @@
 #ifndef MONSTER_H
 #define MONSTER_H
 
-bool m_null(entity thismon, int) { return false; }
-bool m_new(entity thismon, int);
+#ifdef SVQC
+#include "sv_monsters.qh"
+#include "../../server/g_damage.qh"
+#include "../../server/bot/bot.qh"
+#include "../../server/weapons/common.qh"
+#include "../../server/weapons/tracing.qh"
+#include "../../server/weapons/weaponsystem.qh"
+#include "../mutators/mutator/waypoints/waypointsprites.qh"
+#include "../../lib/warpzone/server.qh"
+#endif
+
+// special spawn flags
+const int MONSTER_RESPAWN_DEATHPOINT = 16; // re-spawn where we died
+const int MONSTER_TYPE_FLY = 32;
+const int MONSTER_TYPE_SWIM = 64;
+const int MONSTER_SIZE_BROKEN = 128; // TODO: remove when bad models are replaced
+const int MON_FLAG_SUPERMONSTER = 256; // incredibly powerful monster
+const int MON_FLAG_RANGED = 512; // monster shoots projectiles
+const int MON_FLAG_MELEE = 1024;
+const int MON_FLAG_CRUSH = 2048; // monster can be stomped in special modes
+const int MON_FLAG_RIDE = 4096; // monster can be ridden in special modes
+const int MONSTER_SIZE_QUAKE = 8192;
+
+// entity properties of monsterinfo:
+.bool(int, entity targ) monster_attackfunc;
+
+// animations
+.vector anim_blockend;
+.vector anim_blockstart;
+.vector anim_melee1;
+.vector anim_melee2;
+.vector anim_melee3;
+.vector anim_pain3;
+.vector anim_pain4;
+.vector anim_pain5;
+.vector anim_walk;
+.vector anim_spawn;
 
 /** If you register a new monster, make sure to add it to all.inc */
 CLASS(Monster, Object)
     ATTRIB(Monster, monsterid, int, 0)
-    ATTRIB(Monster, classname, string, "monster_info")
+    /** attributes */
+    ATTRIB(Monster, spawnflags, int, 0)
     /** human readable name */
-    ATTRIB(Monster, monster_name, string, string_null)
-    ATTRIB(Monster, monster_func, bool(Monster, int), m_new)
-ENDCLASS(Monster)
+    ATTRIB(Monster, monster_name, string, "Monster")
+    /** short name */
+    ATTRIB(Monster, netname, string, "")
+    /** model */
+    ATTRIB(Monster, m_model, entity, NULL)
+    /** hitbox size */
+    ATTRIB(Monster, mins, vector, '-0 -0 -0')
+    /** hitbox size */
+    ATTRIB(Monster, maxs, vector, '0 0 0')
+
+    /** (SERVER) setup monster data */
+    METHOD(Monster, mr_setup, bool(Monster this)) { return false; }
+    /** (SERVER) logic to run every frame */
+    METHOD(Monster, mr_think, bool(Monster this)) { return false; }
+    /** (SERVER) called when monster dies */
+    METHOD(Monster, mr_death, bool(Monster this)) { return false; }
+    /** (BOTH) precaches models/sounds used by this monster */
+    METHOD(Monster, mr_precache, bool(Monster this)) { return false; }
+    /** (SERVER) called when monster is damaged */
+    METHOD(Monster, mr_pain, bool(Monster this)) { return false; }
+    /** (BOTH?) sets animations for monster */
+    METHOD(Monster, mr_anim, bool(Monster this)) { return false; }
 
-// monster requests
-const int MR_SETUP = 1; // (SERVER) setup monster data
-.bool(Monster this) mr_setup;
-const int MR_THINK = 2; // (SERVER) logic to run every frame
-.bool(Monster this) mr_think;
-const int MR_DEATH = 3; // (SERVER) called when monster dies
-.bool(Monster this) mr_death;
-const int MR_PRECACHE = 4; // (BOTH) precaches models/sounds used by this monster
-.bool(Monster this) mr_precache;
-const int MR_PAIN = 5; // (SERVER) called when monster is damaged
-.bool(Monster this) mr_pain;
-const int MR_ANIM = 6; // (BOTH?) sets animations for monster
-.bool(Monster this) mr_anim;
-
-// other useful macros
-#define MON_ACTION(mon,mrequest) mon.monster_func(mon, mrequest)
-#define _MON_ACTION(mon,mrequest) MON_ACTION(get_monsterinfo(mon), mrequest)
-
-bool m_new(entity this, int req) {
-    if (req == MR_SETUP) return this.mr_setup ? this.mr_setup(this) : false;
-    if (req == MR_THINK) return this.mr_think ? this.mr_think(this) : false;
-    if (req == MR_DEATH) return this.mr_death ? this.mr_death(this) : false;
-    if (req == MR_PRECACHE) return this.mr_precache ? this.mr_precache(this) : false;
-    if (req == MR_PAIN) return this.mr_pain ? this.mr_pain(this) : false;
-    if (req == MR_ANIM) return this.mr_anim ? this.mr_anim(this) : false;
-    return false;
-}
+ENDCLASS(Monster)
 
 #endif