]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/mutators/events.qh
take3: format 903 files
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / events.qh
1 #pragma once
2
3 #define EV_NO_ARGS(i, o)
4
5 #pragma noref 1
6
7 #define MUTATOR_TYPES(_, x) \
8         _(x, bool) \
9         _(x, int) \
10         _(x, entity) \
11         _(x, float) \
12         _(x, vector) \
13         _(x, string) \
14         /**/
15
16 // TODO: migrate to arrays some day when no other globals are used
17 #define M_ARGV(x, type) MUTATOR_ARGV_##x##_##type
18 #define MUTATOR_NEWGLOBAL(x, type) type MUTATOR_ARGV_##x##_##type;
19
20 MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 0)
21 MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 1)
22 MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 2)
23 MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 3)
24 MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 4)
25 MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 5)
26 MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 6)
27 MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 7)
28 MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 8)
29 MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 9)
30 MUTATOR_TYPES(MUTATOR_NEWGLOBAL, 10)
31
32 #undef MUTATOR_TYPES
33 #undef MUTATOR_NEWGLOBAL
34
35 #pragma noref 0
36
37 /** appends ":mutatorname" to argument for logging */
38 #define EV_BuildMutatorsString(i, o) \
39         /** mutator string */ i(string, MUTATOR_ARGV_0_string) \
40         /**/ o(string, MUTATOR_ARGV_0_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         /** mutator string */ i(string, MUTATOR_ARGV_0_string) \
47         /**/ o(string, MUTATOR_ARGV_0_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         /** tips string */ i(string, MUTATOR_ARGV_0_string) \
54         /**/ o(string, MUTATOR_ARGV_0_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         /** player */ i(entity, MUTATOR_ARGV_0_entity) \
77         /** ticrate*/ i(float, MUTATOR_ARGV_1_float) \
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         /** tick rate */ i(float, MUTATOR_ARGV_2_float) \
96         /**/
97 MUTATOR_HOOKABLE(PM_Physics, EV_PM_Physics);
98
99 /** called when a weapon sound is about to be played, allows custom paths etc. */
100 #define EV_WeaponSound(i, o) \
101         /** sound       */ i(string, MUTATOR_ARGV_0_string) \
102         /** output      */ i(string, MUTATOR_ARGV_1_string) \
103         /**/ o(string, MUTATOR_ARGV_1_string) \
104         /**/
105 MUTATOR_HOOKABLE(WeaponSound, EV_WeaponSound);
106
107 /** called when a weapon model is about to be set, allows custom paths etc. */
108 #define EV_WeaponModel(i, o) \
109         /** model */ i(string, MUTATOR_ARGV_0_string) \
110         /** output */ i(string, MUTATOR_ARGV_1_string) \
111         /**/ o(string, MUTATOR_ARGV_1_string) \
112         /**/
113 MUTATOR_HOOKABLE(WeaponModel, EV_WeaponModel);