]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/mutators/events.qh
Kill the ret_string global
[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     /**/ i(entity, __self) \
78     /**/
79 MUTATOR_HOOKABLE(PlayerPhysics, EV_PlayerPhysics);
80
81 /** called when a player presses the jump key */
82 #define EV_PlayerJump(i, o) \
83     /**/ i(entity, __self) \
84     /**/ i(float, player_multijump) \
85     /**/ i(float, player_jumpheight) \
86     /**/ o(float, player_multijump) \
87     /**/ o(float, player_jumpheight) \
88     /**/
89 float player_multijump;
90 float player_jumpheight;
91 MUTATOR_HOOKABLE(PlayerJump, EV_PlayerJump);
92
93 /** called during player physics, allows adjusting the movement type used */
94 #define EV_PM_Physics(i, o) \
95     /**/ i(entity, __self) \
96     /**/ i(float, pm_maxspeed_mod) \
97     /**/
98 float pm_maxspeed_mod;
99 MUTATOR_HOOKABLE(PM_Physics, EV_PM_Physics);
100
101 /** called when a weapon model is about to be set, allows custom paths etc. */
102 #define EV_WeaponModel(i, o) \
103     /**/ i(string, weapon_model) \
104     /**/ i(string, weapon_model_output) \
105     /**/ o(string, weapon_model_output) \
106     /**/
107 string weapon_model;
108 string weapon_model_output;
109 MUTATOR_HOOKABLE(WeaponModel, EV_WeaponModel);
110
111 #endif