]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/monsters/all.qh
Merge branch 'maint' of https://gitlab.com/xonotic/xonotic-data.pk3dir into maint
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / monsters / all.qh
1 #include "../registry.qh"
2
3 #ifndef MONSTERS_ALL_H
4 #define MONSTERS_ALL_H
5
6 void RegisterMonsters();
7 const int MON_MAXCOUNT = 24;
8 entity monster_info[MON_MAXCOUNT];
9 entity get_monsterinfo(float id);
10 int MON_COUNT;
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)
15 #include "monster.qh"
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;                                 \
22         this.mins = min_s;                                              \
23         this.maxs = max_s;                                              \
24         this.model = strzone(strcat("models/monsters/", modelname));    \
25     }                                                                   \
26     REGISTER_INIT(MON, id)
27
28 #include "../util.qh"
29
30 // monster requests
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
35
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;
44
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
49 .int spawnflags;
50 .vector mins, maxs; // monster hitbox size
51
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
55
56 #endif