]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/mutators/events.qh
Fix up even more mutators
[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 MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 9)
32 MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 10)
33
34 #undef MUTATOR_TYPES
35 #undef MUTATOR_NEWGLOBAL
36
37 #pragma noref 0
38
39 /** appends ":mutatorname" to ret_string for logging */
40 #define EV_BuildMutatorsString(i, o) \
41     /**/ i(string, ret_string) \
42     /**/ o(string, ret_string) \
43     /**/
44 MUTATOR_HOOKABLE(BuildMutatorsString, EV_BuildMutatorsString);
45
46 /** appends ", Mutator name" to ret_string for display */
47 #define EV_BuildMutatorsPrettyString(i, o) \
48     /**/ i(string, ret_string) \
49     /**/ o(string, ret_string) \
50     /**/
51 MUTATOR_HOOKABLE(BuildMutatorsPrettyString, EV_BuildMutatorsPrettyString);
52
53 /** appends mutator string for displaying extra gameplay tips */
54 #define EV_BuildGameplayTipsString(i, o) \
55     /**/ i(string, ret_string) \
56     /**/ o(string, ret_string) \
57     /**/
58 MUTATOR_HOOKABLE(BuildGameplayTipsString, EV_BuildGameplayTipsString);
59
60 #define EV_IsFlying(i, o) \
61         /**/ i(entity, MUTATOR_ARGV_0_entity) \
62         /**/
63 MUTATOR_HOOKABLE(IsFlying, EV_IsFlying);
64
65 #define EV_WP_Format(i, o) \
66     /**/ i(entity, MUTATOR_ARGV_0_entity) \
67     /**/ i(string, MUTATOR_ARGV_1_string) \
68     /**/ o(vector, MUTATOR_ARGV_2_vector) \
69     /**/ o(string, MUTATOR_ARGV_3_string) \
70     /**/
71 MUTATOR_HOOKABLE(WP_Format, EV_WP_Format);
72
73 /**
74  * called before any player physics, may adjust variables for movement,
75  * is run AFTER bot code and idle checking on the server
76  */
77 #define EV_PlayerPhysics(i, o) \
78     /**/ i(entity, __self) \
79     /**/
80 MUTATOR_HOOKABLE(PlayerPhysics, EV_PlayerPhysics);
81
82 /** called when a player presses the jump key */
83 #define EV_PlayerJump(i, o) \
84     /**/ i(entity, __self) \
85     /**/ i(float, player_multijump) \
86     /**/ i(float, player_jumpheight) \
87     /**/ o(float, player_multijump) \
88     /**/ o(float, player_jumpheight) \
89     /**/
90 float player_multijump;
91 float player_jumpheight;
92 MUTATOR_HOOKABLE(PlayerJump, EV_PlayerJump);
93
94 /** called during player physics, allows adjusting the movement type used */
95 #define EV_PM_Physics(i, o) \
96     /**/ i(entity, __self) \
97     /**/ i(float, pm_maxspeed_mod) \
98     /**/
99 float pm_maxspeed_mod;
100 MUTATOR_HOOKABLE(PM_Physics, EV_PM_Physics);
101
102 /** called when a weapon model is about to be set, allows custom paths etc. */
103 #define EV_WeaponModel(i, o) \
104     /**/ i(string, weapon_model) \
105     /**/ i(string, weapon_model_output) \
106     /**/ o(string, weapon_model_output) \
107     /**/
108 string weapon_model;
109 string weapon_model_output;
110 MUTATOR_HOOKABLE(WeaponModel, EV_WeaponModel);
111
112 #endif