4 void RegisterMonsters();
5 const int MON_MAXCOUNT = 24;
6 entity monster_info[MON_MAXCOUNT], monster_info_first, monster_info_last;
7 entity get_monsterinfo(float id);
9 const int MON_FIRST = 1;
10 #define MON_LAST (MON_FIRST + MON_COUNT - 1)
11 /** If you register a new monster, make sure to add it to all.inc */
12 #define REGISTER_MONSTER(id, class) REGISTER(RegisterMonsters, MON, monster_info, MON_COUNT, id, monsterid, NEW(class))
14 #define REGISTER_MONSTER_SIMPLE(id, monsterflags, min_s, max_s, modelname, shortname, mname) \
15 REGISTER_MONSTER(id, Monster) { \
16 this.netname = shortname; \
17 this.monster_name = mname; \
18 this.mdl = modelname; \
19 this.spawnflags = monsterflags; \
22 this.model = strzone(strcat("models/monsters/", modelname)); \
24 REGISTER_INIT(MON, id)
25 REGISTER_REGISTRY(RegisterMonsters)
30 const int MR_SETUP = 1; // (SERVER) setup monster data
31 const int MR_THINK = 2; // (SERVER) logic to run every frame
32 const int MR_DEATH = 3; // (SERVER) called when monster dies
33 const int MR_PRECACHE = 4; // (BOTH) precaches models/sounds used by this monster
34 const int MR_PAIN = 5; // (SERVER) called when monster is damaged
35 const int MR_ANIM = 6; // (BOTH?) sets animations for monster
37 // special spawn flags
38 const int MONSTER_RESPAWN_DEATHPOINT = 16; // re-spawn where we died
39 const int MONSTER_TYPE_FLY = 32;
40 const int MONSTER_TYPE_SWIM = 64;
41 const int MONSTER_SIZE_BROKEN = 128; // TODO: remove when bad models are replaced
42 const int MON_FLAG_SUPERMONSTER = 256; // incredibly powerful monster
43 const int MON_FLAG_RANGED = 512; // monster shoots projectiles
44 const int MON_FLAG_MELEE = 1024;
45 const int MON_FLAG_CRUSH = 2048; // monster can be stomped in special modes
46 const int MON_FLAG_RIDE = 4096; // monster can be ridden in special modes
48 // entity properties of monsterinfo:
49 .string netname; // short name
50 .string mdl; // currently a copy of the model
51 .string model; // full name of model
53 .vector mins, maxs; // monster hitbox size
54 .bool(int) monster_attackfunc;
57 .vector anim_blockend;
58 .vector anim_blockstart;
68 // other useful macros
69 #define MON_ACTION(monstertype,mrequest) (get_monsterinfo(monstertype)).monster_func(mrequest)