]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/mutators/events.qh
Merge branch 'master' into Mario/fullbright_skins
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / events.qh
1 #ifndef COMMON_MUTATORS_EVENTS_H
2 #define COMMON_MUTATORS_EVENTS_H
3
4 #define EV_NO_ARGS(i, o)
5
6 #pragma noref 1
7
8 #define MUTATOR_TYPES(_, x) \
9     _(x, bool) \
10     _(x, int) \
11     _(x, entity) \
12     _(x, float) \
13     _(x, vector) \
14     _(x, string) \
15     /**/
16
17 // TODO: migrate to arrays some day when no other globals are used
18 #define M_ARGV(x, type) MUTATOR_ARGV_##x##_##type
19 #define MUTATOR_NEWGLOBAL(x, type) type MUTATOR_ARGV_##x##_##type;
20
21 MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 0)
22 MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 1)
23 MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 2)
24 MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 3)
25 MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 4)
26 MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 5)
27 MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 6)
28 MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 7)
29 MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 8)
30 MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 9)
31 MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 10)
32
33 #undef MUTATOR_TYPES
34 #undef MUTATOR_NEWGLOBAL
35
36 #pragma noref 0
37
38 /** appends ":mutatorname" to argument for logging */
39 #define EV_BuildMutatorsString(i, o) \
40     /** mutator string */ i(string, MUTATOR_ARGV_0_string) \
41     /**/                  o(string, MUTATOR_ARGV_0_string) \
42     /**/
43 MUTATOR_HOOKABLE(BuildMutatorsString, EV_BuildMutatorsString);
44
45 /** appends ", Mutator name" to ret_string for display */
46 #define EV_BuildMutatorsPrettyString(i, o) \
47     /** mutator string */ i(string, MUTATOR_ARGV_0_string) \
48     /**/                  o(string, MUTATOR_ARGV_0_string) \
49     /**/
50 MUTATOR_HOOKABLE(BuildMutatorsPrettyString, EV_BuildMutatorsPrettyString);
51
52 /** appends mutator string for displaying extra gameplay tips */
53 #define EV_BuildGameplayTipsString(i, o) \
54     /** tips string */    i(string, MUTATOR_ARGV_0_string) \
55     /**/                  o(string, MUTATOR_ARGV_0_string) \
56     /**/
57 MUTATOR_HOOKABLE(BuildGameplayTipsString, EV_BuildGameplayTipsString);
58
59 #define EV_IsFlying(i, o) \
60         /**/ i(entity, MUTATOR_ARGV_0_entity) \
61         /**/
62 MUTATOR_HOOKABLE(IsFlying, EV_IsFlying);
63
64 #define EV_WP_Format(i, o) \
65     /**/ i(entity, MUTATOR_ARGV_0_entity) \
66     /**/ i(string, MUTATOR_ARGV_1_string) \
67     /**/ o(vector, MUTATOR_ARGV_2_vector) \
68     /**/ o(string, MUTATOR_ARGV_3_string) \
69     /**/
70 MUTATOR_HOOKABLE(WP_Format, EV_WP_Format);
71
72 /**
73  * called before any player physics, may adjust variables for movement,
74  * is run AFTER bot code and idle checking on the server
75  */
76 #define EV_PlayerPhysics(i, o) \
77     /** player */ i(entity, MUTATOR_ARGV_0_entity) \
78     /**/
79 MUTATOR_HOOKABLE(PlayerPhysics, EV_PlayerPhysics);
80
81 /** called when a player presses the jump key */
82 #define EV_PlayerJump(i, o) \
83     /** player */      i(entity, MUTATOR_ARGV_0_entity) \
84     /** jump height */ i(float, MUTATOR_ARGV_1_float) \
85     /**/               o(float, MUTATOR_ARGV_1_float) \
86     /** multijump */   i(bool, MUTATOR_ARGV_2_bool) \
87     /**/               o(bool, MUTATOR_ARGV_2_bool) \
88     /**/
89 MUTATOR_HOOKABLE(PlayerJump, EV_PlayerJump);
90
91 /** called during player physics, allows adjusting the movement type used */
92 #define EV_PM_Physics(i, o) \
93     /** player */       i(entity, MUTATOR_ARGV_0_entity) \
94     /** maxspeed_mod */ i(float, MUTATOR_ARGV_1_float) \
95     /**/
96 MUTATOR_HOOKABLE(PM_Physics, EV_PM_Physics);
97
98 /** called when a weapon model is about to be set, allows custom paths etc. */
99 #define EV_WeaponModel(i, o) \
100     /** model */  i(string, MUTATOR_ARGV_0_string) \
101     /** output */ i(string, MUTATOR_ARGV_1_string) \
102     /**/          o(string, MUTATOR_ARGV_1_string) \
103     /**/
104 MUTATOR_HOOKABLE(WeaponModel, EV_WeaponModel);
105
106 #endif