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