]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/monsters/all.qh
Merge branch '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], monster_info_first, monster_info_last;
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, monsterid, NEW(class))
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 REGISTER_REGISTRY(RegisterMonsters)
28
29 #include "../util.qh"
30
31 // monster requests
32 const int MR_SETUP = 1; // (SERVER) setup monster data
33 const int MR_THINK = 2; // (SERVER) logic to run every frame
34 const int MR_DEATH = 3; // (SERVER) called when monster dies
35 const int MR_PRECACHE = 4; // (BOTH) precaches models/sounds used by this 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
46 // entity properties of monsterinfo:
47 .string netname; // short name
48 .string mdl; // currently a copy of the model
49 .string model; // full name of model
50 .int spawnflags;
51 .vector mins, maxs; // monster hitbox size
52
53 // other useful macros
54 #define MON_ACTION(monstertype,mrequest) (get_monsterinfo(monstertype)).monster_func(mrequest)
55 #define M_NAME(monstertype) (get_monsterinfo(monstertype)).monster_name
56
57 #endif