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