1 #include "../registry.qh"
6 void RegisterMonsters();
7 const int MON_MAXCOUNT = 24;
8 entity monster_info[MON_MAXCOUNT];
9 entity get_monsterinfo(float id);
11 const int MON_FIRST = 1;
12 #define MON_LAST (MON_FIRST + MON_COUNT - 1)
13 /** If you register a new monster, make sure to add it to all.inc */
14 #define REGISTER_MONSTER(id, class) REGISTER(RegisterMonsters, MON, monster_info, MON_COUNT, id, class, monsterid)
16 #define REGISTER_MONSTER_SIMPLE(id, monsterflags, min_s, max_s, modelname, shortname, mname) \
17 REGISTER_MONSTER(id, Monster) { \
18 this.netname = shortname; \
19 this.monster_name = mname; \
20 this.mdl = modelname; \
21 this.spawnflags = monsterflags; \
24 this.model = strzone(strcat("models/monsters/", modelname)); \
26 REGISTER_INIT(MON, id)
31 const int MR_SETUP = 1; // (SERVER) setup monster data
32 const int MR_THINK = 2; // (SERVER) logic to run every frame
33 const int MR_DEATH = 3; // (SERVER) called when monster dies
34 const int MR_PRECACHE = 4; // (BOTH) precaches models/sounds used by this monster
36 // special spawn flags
37 const int MONSTER_RESPAWN_DEATHPOINT = 16; // re-spawn where we died
38 const int MONSTER_TYPE_FLY = 32;
39 const int MONSTER_TYPE_SWIM = 64;
40 const int MONSTER_SIZE_BROKEN = 128; // TODO: remove when bad models are replaced
41 const int MON_FLAG_SUPERMONSTER = 256; // incredibly powerful monster
42 const int MON_FLAG_RANGED = 512; // monster shoots projectiles
43 const int MON_FLAG_MELEE = 1024;
45 // entity properties of monsterinfo:
46 .string netname; // short name
47 .string mdl; // currently a copy of the model
48 .string model; // full name of model
50 .vector mins, maxs; // monster hitbox size
52 // other useful macros
53 #define MON_ACTION(monstertype,mrequest) (get_monsterinfo(monstertype)).monster_func(mrequest)
54 #define M_NAME(monstertype) (get_monsterinfo(monstertype)).monster_name