]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/monsters/all.qh
Merge branch 'Mario/trailparticles' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / monsters / all.qh
1 #ifndef MONSTERS_ALL_H
2 #define MONSTERS_ALL_H
3
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);
8 int MON_COUNT;
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))
13 #include "monster.qh"
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;                                 \
20         this.mins = min_s;                                              \
21         this.maxs = max_s;                                              \
22         this.model = strzone(strcat("models/monsters/", modelname));    \
23     }                                                                   \
24     REGISTER_INIT(MON, id)
25 REGISTER_REGISTRY(RegisterMonsters)
26
27 #include "../util.qh"
28
29 // monster requests
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
36
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
47
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
52 .int spawnflags;
53 .vector mins, maxs; // monster hitbox size
54 .bool(int) monster_attackfunc;
55
56 // animations
57 .vector anim_blockend;
58 .vector anim_blockstart;
59 .vector anim_melee1;
60 .vector anim_melee2;
61 .vector anim_melee3;
62 .vector anim_pain3;
63 .vector anim_pain4;
64 .vector anim_pain5;
65 .vector anim_walk;
66 .vector anim_spawn;
67
68 // other useful macros
69 #define MON_ACTION(monstertype,mrequest) (get_monsterinfo(monstertype)).monster_func(mrequest)
70
71 #endif