1 #ifndef CLIENT_MUTATORS_EVENTS_H
2 #define CLIENT_MUTATORS_EVENTS_H
4 #include "../../common/mutators/base.qh"
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()
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");
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");
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) \
36 MUTATOR_HOOKABLE(CSQC_ConsoleCommand, EV_CSQC_ConsoleCommand);
38 /* Called when the crosshair is being updated */
39 MUTATOR_HOOKABLE(UpdateCrosshair, EV_NO_ARGS);
41 /** Called when a projectile is linked with CSQC */
42 #define EV_Ent_Projectile(i, o) \
43 /** entity id */ i(entity, __self) \
45 MUTATOR_HOOKABLE(Ent_Projectile, EV_Ent_Projectile);
47 /** Called when a projectile's properties are being modified */
48 #define EV_EditProjectile(i, o) \
49 /** entity id */ i(entity, __self) \
51 MUTATOR_HOOKABLE(EditProjectile, EV_EditProjectile);
53 /* Called when projectiles are precached */
54 MUTATOR_HOOKABLE(PrecacheProjectiles, EV_NO_ARGS);
56 /** Called when updating the attached tags index */
57 #define EV_TagIndex_Update(i, o) \
58 /** entity id */ i(entity, __self) \
60 MUTATOR_HOOKABLE(TagIndex_Update, EV_TagIndex_Update);
62 /** Called when setting the attached tags */
63 #define EV_TagIndex_Apply(i, o) \
64 /** entity id */ i(entity, __self) \
66 MUTATOR_HOOKABLE(TagIndex_Apply, EV_TagIndex_Apply);
68 /** Called when setting up skeleton bones */
69 #define EV_Skeleton_CheckBones(i, o) \
70 /** entity id */ i(entity, __self) \
72 MUTATOR_HOOKABLE(Skeleton_CheckBones, EV_Skeleton_CheckBones);
74 /** Called when setting up bones from the loaded model */
75 #define EV_Skeleton_CheckModel(i, o) \
76 /** entity id */ i(entity, __self) \
78 MUTATOR_HOOKABLE(Skeleton_CheckModel, EV_Skeleton_CheckModel);
80 /** Called when clearing the global parameters for a model */
81 MUTATOR_HOOKABLE(ClearModelParams, EV_NO_ARGS);
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) \
88 string checkmodel_input, checkmodel_command;
89 MUTATOR_HOOKABLE(GetModelParams, EV_GetModelParams);
91 /** Called checking if 3rd person mode should be forced on */
92 #define EV_WantEventchase(i, o) \
93 /** entity id */ i(entity, __self) \
95 MUTATOR_HOOKABLE(WantEventchase, EV_WantEventchase);
97 #define EV_AnnouncerOption(i, o) \
98 /**/ i(string, ret_string) \
99 /**/ o(string, ret_string) \
101 MUTATOR_HOOKABLE(AnnouncerOption, EV_AnnouncerOption);
103 MUTATOR_HOOKABLE(Ent_Init, EV_NO_ARGS);
105 #define EV_HUD_Draw_overlay(i, o) \
106 /**/ o(vector, MUTATOR_ARGV_0_vector) \
107 /**/ o(float, MUTATOR_ARGV_0_float) \
109 MUTATOR_HOOKABLE(HUD_Draw_overlay, EV_HUD_Draw_overlay);
111 MUTATOR_HOOKABLE(HUD_Powerups_add, EV_NO_ARGS);
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) \
118 vector vbeam_shotorg;
120 MUTATOR_HOOKABLE(Particles_VortexBeam, EV_Particles_VortexBeam);
122 /** Return true to not draw any impact effect */
123 #define EV_Weapon_ImpactEffect(i, o) \
124 /**/ i(entity, w_hitwep) \
127 MUTATOR_HOOKABLE(Weapon_ImpactEffect, EV_Weapon_ImpactEffect);