]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/monsters/all.qh
Merge branch 'packer-/impure_team_cvars' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / monsters / all.qh
1 #ifndef MONSTERS_ALL_H
2 #define MONSTERS_ALL_H
3
4 #include "../util.qh"
5
6 // monster requests
7 const int MR_SETUP = 1; // (SERVER) setup monster data
8 const int MR_THINK = 2; // (SERVER) logic to run every frame
9 const int MR_DEATH = 3; // (SERVER) called when monster dies
10 const int MR_PRECACHE = 4; // (BOTH) precaches models/sounds used by this monster
11
12 // functions:
13 entity get_monsterinfo(float id);
14
15 // special spawn flags
16 const int MONSTER_RESPAWN_DEATHPOINT = 16; // re-spawn where we died
17 const int MONSTER_TYPE_FLY = 32;
18 const int MONSTER_TYPE_SWIM = 64;
19 const int MONSTER_SIZE_BROKEN = 128; // TODO: remove when bad models are replaced
20 const int MON_FLAG_SUPERMONSTER = 256; // incredibly powerful monster
21 const int MON_FLAG_RANGED = 512; // monster shoots projectiles
22 const int MON_FLAG_MELEE = 1024;
23
24 // entity properties of monsterinfo:
25 .float monsterid; // MON_...
26 .string netname; // short name
27 .string monster_name; // human readable name
28 .float(float) monster_func; // m_...
29 .string mdl; // currently a copy of the model
30 .string model; // full name of model
31 .int spawnflags;
32 .vector mins, maxs; // monster hitbox size
33
34 // other useful macros
35 #define MON_ACTION(monstertype,mrequest) (get_monsterinfo(monstertype)).monster_func(mrequest)
36 #define M_NAME(monstertype) (get_monsterinfo(monstertype)).monster_name
37
38 // =====================
39 //      Monster Registration
40 // =====================
41
42 float m_null(float dummy);
43 void register_monster(float id, float(float) func, float monsterflags, vector min_s, vector max_s, string modelname, string shortname, string mname);
44 void register_monsters_done();
45
46 const int MON_MAXCOUNT = 24;
47 const int MON_FIRST = 1;
48 int MON_COUNT;
49 int MON_LAST;
50
51 #define REGISTER_MONSTER_2(id,func,monsterflags,min_s,max_s,modelname,shortname,mname) \
52         int id; \
53         float func(float); \
54         void RegisterMonsters_##id() \
55         { \
56                 MON_LAST = (id = MON_FIRST + MON_COUNT); \
57                 ++MON_COUNT; \
58                 register_monster(id,func,monsterflags,min_s,max_s,modelname,shortname,mname); \
59         } \
60         ACCUMULATE_FUNCTION(RegisterMonsters, RegisterMonsters_##id)
61 #ifdef MENUQC
62 #define REGISTER_MONSTER(id,func,monsterflags,min_s,max_s,modelname,shortname,mname) \
63         REGISTER_MONSTER_2(MON_##id,m_null,monsterflags,min_s,max_s,modelname,shortname,mname)
64 #else
65 #define REGISTER_MONSTER(id,func,monsterflags,min_s,max_s,modelname,shortname,mname) \
66         REGISTER_MONSTER_2(MON_##id,func,monsterflags,min_s,max_s,modelname,shortname,mname)
67 #endif
68
69 #include "all.inc"
70
71 #undef REGISTER_MONSTER
72 ACCUMULATE_FUNCTION(RegisterMonsters, register_monsters_done);
73 #endif