]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/monsters/monsters.qh
#include this
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / monsters / monsters.qh
1 #ifndef MONSTERS_H
2 #define MONSTERS_H
3
4 #if defined(CSQC)
5         #include "../util-pre.qh"
6         #include "../../client/sys-pre.qh"
7         #include "../../dpdefs/csprogsdefs.qc"
8         #include "../../client/sys-post.qh"
9         #include "../../client/Defs.qc"
10         #include "../../dpdefs/keycodes.qc"
11         #include "../constants.qh"
12         #include "../stats.qh"
13         #include "../../warpzonelib/anglestransform.qh"
14         #include "../../warpzonelib/mathlib.qh"
15         #include "../../warpzonelib/common.qh"
16         #include "../../warpzonelib/client.qh"
17         #include "../playerstats.qh"
18         #include "../teams.qh"
19         #include "../util.qh"
20         #include "../nades.qh"
21         #include "../buffs.qh"
22         #include "../test.qh"
23         #include "../counting.qh"
24         #include "../weapons/weapons.qh"
25         #include "../mapinfo.qh"
26         #include "../command/markup.qh"
27         #include "../command/rpn.qh"
28         #include "../command/generic.qh"
29         #include "../command/shared_defs.qh"
30         #include "../urllib.qh"
31         #include "../animdecide.qh"
32         #include "../../client/command/cl_cmd.qh"
33 #elif defined(MENUQC)
34         #include "../util-pre.qh"
35     #include "../../menu/sys-pre.qh"
36     #include "../../dpdefs/menudefs.qc"
37     #include "../../dpdefs/keycodes.qc"
38     #include "../../menu/sys-post.qh"
39     #include "../../menu/config.qh"
40     #include "../../warpzonelib/mathlib.qh"
41     #include "../util.qh"
42     #include "../test.qh"
43     #include "../../menu/oo/base.qh"
44     #include "../playerstats.qh"
45     #include "../teams.qh"
46     #include "../constants.qh"
47     #include "../mapinfo.qh"
48     #include "../campaign_common.qh"
49     #include "../weapons/weapons.qh"
50     #include "../counting.qh"
51     #include "../command/markup.qh"
52     #include "../command/rpn.qh"
53     #include "../command/generic.qh"
54     #include "../command/shared_defs.qh"
55     #include "../urllib.qh"
56 #elif defined(SVQC)
57         #include "../util-pre.qh"
58     #include "../../server/sys-pre.qh"
59     #include "../../dpdefs/progsdefs.qc"
60     #include "../../dpdefs/dpextensions.qc"
61     #include "../../server/sys-post.qh"
62     #include "../../warpzonelib/anglestransform.qh"
63     #include "../../warpzonelib/mathlib.qh"
64     #include "../../warpzonelib/common.qh"
65     #include "../../warpzonelib/util_server.qh"
66     #include "../../warpzonelib/server.qh"
67     #include "../constants.qh"
68     #include "../stats.qh"
69     #include "../teams.qh"
70     #include "../util.qh"
71     #include "../nades.qh"
72     #include "../buffs.qh"
73     #include "../test.qh"
74     #include "../counting.qh"
75     #include "../urllib.qh"
76     #include "../command/markup.qh"
77     #include "../command/rpn.qh"
78     #include "../command/generic.qh"
79     #include "../command/shared_defs.qh"
80     #include "../net_notice.qh"
81     #include "../animdecide.qh"
82 #endif
83
84 // monster requests
85 const int MR_SETUP = 1; // (SERVER) setup monster data
86 const int MR_THINK = 2; // (SERVER) logic to run every frame
87 const int MR_DEATH = 3; // (SERVER) called when monster dies
88 const int MR_PRECACHE = 4; // (BOTH) precaches models/sounds used by this monster
89
90 // functions:
91 entity get_monsterinfo(float id);
92
93 // special spawn flags
94 const int MONSTER_RESPAWN_DEATHPOINT = 16; // re-spawn where we died
95 const int MONSTER_TYPE_FLY = 32;
96 const int MONSTER_TYPE_SWIM = 64;
97 const int MONSTER_SIZE_BROKEN = 128; // TODO: remove when bad models are replaced
98 const int MON_FLAG_SUPERMONSTER = 256; // incredibly powerful monster
99 const int MON_FLAG_RANGED = 512; // monster shoots projectiles
100 const int MON_FLAG_MELEE = 1024;
101
102 // entity properties of monsterinfo:
103 .float monsterid; // MON_...
104 .string netname; // short name
105 .string monster_name; // human readable name
106 .float(float) monster_func; // m_...
107 .string mdl; // currently a copy of the model
108 .string model; // full name of model
109 .int spawnflags;
110 .vector mins, maxs; // monster hitbox size
111
112 // other useful macros
113 #define MON_ACTION(monstertype,mrequest) (get_monsterinfo(monstertype)).monster_func(mrequest)
114 #define M_NAME(monstertype) (get_monsterinfo(monstertype)).monster_name
115
116 // =====================
117 //      Monster Registration
118 // =====================
119
120 float m_null(float dummy);
121 void register_monster(float id, float(float) func, float monsterflags, vector min_s, vector max_s, string modelname, string shortname, string mname);
122 void register_monsters_done();
123
124 const int MON_MAXCOUNT = 24;
125 const int MON_FIRST = 1;
126 int MON_COUNT;
127 int MON_LAST;
128
129 #define REGISTER_MONSTER_2(id,func,monsterflags,min_s,max_s,modelname,shortname,mname) \
130         int id; \
131         float func(float); \
132         void RegisterMonsters_##id() \
133         { \
134                 MON_LAST = (id = MON_FIRST + MON_COUNT); \
135                 ++MON_COUNT; \
136                 register_monster(id,func,monsterflags,min_s,max_s,modelname,shortname,mname); \
137         } \
138         ACCUMULATE_FUNCTION(RegisterMonsters, RegisterMonsters_##id)
139 #ifdef MENUQC
140 #define REGISTER_MONSTER(id,func,monsterflags,min_s,max_s,modelname,shortname,mname) \
141         REGISTER_MONSTER_2(MON_##id,m_null,monsterflags,min_s,max_s,modelname,shortname,mname)
142 #else
143 #define REGISTER_MONSTER(id,func,monsterflags,min_s,max_s,modelname,shortname,mname) \
144         REGISTER_MONSTER_2(MON_##id,func,monsterflags,min_s,max_s,modelname,shortname,mname)
145 #endif
146
147 #include "all.qh"
148
149 #undef REGISTER_MONSTER
150 ACCUMULATE_FUNCTION(RegisterMonsters, register_monsters_done);
151 #endif