]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/client/mutators/events.qh
Makefile: use `-I.`
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / mutators / events.qh
1 #ifndef CLIENT_MUTATORS_EVENTS_H
2 #define CLIENT_MUTATORS_EVENTS_H
3
4 #include <common/mutators/base.qh>
5
6 // globals
7
8 string cmd_name;
9 int cmd_argc;
10 string cmd_string;
11
12 /**
13  * Called when a client command is parsed
14  * NOTE: hooks MUST start with if (MUTATOR_RETURNVALUE) return false;
15  * NOTE: return true if you handled the command, return false to continue handling
16  * NOTE: THESE HOOKS MUST NEVER EVER CALL tokenize()
17  * // example:
18  * MUTATOR_HOOKFUNCTION(foo, CSQC_ConsoleCommand) {
19  *     if (MUTATOR_RETURNVALUE) return false; // command was already handled
20  *     if (cmd_name == "echocvar" && cmd_argc >= 2) {
21  *         print(cvar_string(argv(1)), "\n");
22  *         return true;
23  *     }
24  *     if (cmd_name == "echostring" && cmd_argc >= 2) {
25  *         print(substring(cmd_string, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)), "\n");
26  *         return true;
27  *     }
28  *     return false;
29  * }
30  */
31 #define EV_CSQC_ConsoleCommand(i, o) \
32         /** command name */ i(string, cmd_name) \
33         /** also, argv() can be used */ i(int, cmd_argc) \
34         /** whole command, use only if you really have to */ i(string, cmd_string) \
35         /**/
36 MUTATOR_HOOKABLE(CSQC_ConsoleCommand, EV_CSQC_ConsoleCommand);
37
38 /* Called when the crosshair is being updated */
39 MUTATOR_HOOKABLE(UpdateCrosshair, EV_NO_ARGS);
40
41 /** Called when a projectile is linked with CSQC */
42 #define EV_Ent_Projectile(i, o) \
43         /** entity id */ i(entity, __self) \
44         /**/
45 MUTATOR_HOOKABLE(Ent_Projectile, EV_Ent_Projectile);
46
47 /** Called when a projectile's properties are being modified */
48 #define EV_EditProjectile(i, o) \
49         /** entity id */ i(entity, __self) \
50         /**/
51 MUTATOR_HOOKABLE(EditProjectile, EV_EditProjectile);
52
53 /* Called when projectiles are precached */
54 MUTATOR_HOOKABLE(PrecacheProjectiles, EV_NO_ARGS);
55
56 /** Called when updating the attached tags index */
57 #define EV_TagIndex_Update(i, o) \
58         /** entity id */ i(entity, __self) \
59         /**/
60 MUTATOR_HOOKABLE(TagIndex_Update, EV_TagIndex_Update);
61
62 /** Called when setting the attached tags */
63 #define EV_TagIndex_Apply(i, o) \
64         /** entity id */ i(entity, __self) \
65         /**/
66 MUTATOR_HOOKABLE(TagIndex_Apply, EV_TagIndex_Apply);
67
68 /** Called when setting up skeleton bones */
69 #define EV_Skeleton_CheckBones(i, o) \
70         /** entity id */ i(entity, __self) \
71         /**/
72 MUTATOR_HOOKABLE(Skeleton_CheckBones, EV_Skeleton_CheckBones);
73
74 /** Called when setting up bones from the loaded model */
75 #define EV_Skeleton_CheckModel(i, o) \
76         /** entity id */ i(entity, __self) \
77         /**/
78 MUTATOR_HOOKABLE(Skeleton_CheckModel, EV_Skeleton_CheckModel);
79
80 /** Called when clearing the global parameters for a model */
81 MUTATOR_HOOKABLE(ClearModelParams, EV_NO_ARGS);
82
83 /** Called when getting the global parameters for a model */
84 #define EV_GetModelParams(i, o) \
85         /** entity id */ i(string, checkmodel_input) \
86         /** entity id */ i(string, checkmodel_command) \
87         /**/
88 string checkmodel_input, checkmodel_command;
89 MUTATOR_HOOKABLE(GetModelParams, EV_GetModelParams);
90
91 /** Called checking if 3rd person mode should be forced on */
92 #define EV_WantEventchase(i, o) \
93         /** entity id */ i(entity, __self) \
94         /**/
95 MUTATOR_HOOKABLE(WantEventchase, EV_WantEventchase);
96
97 #define EV_AnnouncerOption(i, o) \
98         /**/ i(string, ret_string) \
99         /**/ o(string, ret_string) \
100         /**/
101 MUTATOR_HOOKABLE(AnnouncerOption, EV_AnnouncerOption);
102
103 MUTATOR_HOOKABLE(Ent_Init, EV_NO_ARGS);
104
105 #define EV_HUD_Draw_overlay(i, o) \
106         /**/ o(vector, MUTATOR_ARGV_0_vector) \
107         /**/ o(float, MUTATOR_ARGV_0_float) \
108         /**/
109 MUTATOR_HOOKABLE(HUD_Draw_overlay, EV_HUD_Draw_overlay);
110
111 MUTATOR_HOOKABLE(HUD_Powerups_add, EV_NO_ARGS);
112
113 /** Return true to not draw any vortex beam */
114 #define EV_Particles_VortexBeam(i, o) \
115         /**/ i(vector, vbeam_shotorg) \
116         /**/ i(vector, vbeam_endpos) \
117         /**/
118 vector vbeam_shotorg;
119 vector vbeam_endpos;
120 MUTATOR_HOOKABLE(Particles_VortexBeam, EV_Particles_VortexBeam);
121
122 /** Return true to not draw any impact effect */
123 #define EV_Weapon_ImpactEffect(i, o) \
124         /**/ i(entity, w_hitwep) \
125         /**/
126 entity w_hitwep;
127 MUTATOR_HOOKABLE(Weapon_ImpactEffect, EV_Weapon_ImpactEffect);
128
129 /* NOTE: hooks MUST start with if (MUTATOR_RETURNVALUE) return false;
130 */
131 #define EV_HUD_Command(i, o) \
132         /** also, argv() can be used */ i(int, cmd_argc) \
133         /**/
134 MUTATOR_HOOKABLE(HUD_Command, EV_HUD_Command);
135
136 #endif