Add HUD_Redraw hook

This commit is contained in:
8dcc 2023-07-21 15:42:01 +02:00
parent 01312cb4b6
commit 77a8a97a0f
2 changed files with 13 additions and 5 deletions

View File

@ -6,9 +6,11 @@
#include "features/include/movement.h" #include "features/include/movement.h"
DECL_HOOK(CL_CreateMove); DECL_HOOK(CL_CreateMove);
DECL_HOOK(HUD_Redraw);
bool hooks_init(void) { bool hooks_init(void) {
HOOK(i_client, CL_CreateMove); HOOK(i_client, CL_CreateMove);
HOOK(i_client, HUD_Redraw);
return true; return true;
} }
@ -19,10 +21,15 @@ void h_CL_CreateMove(float frametime, usercmd_t* cmd, int active) {
/* Declared in globals.c */ /* Declared in globals.c */
localplayer = i_engine->GetLocalPlayer(); localplayer = i_engine->GetLocalPlayer();
#ifdef DEBUG
printf("x: %f, y: %f, z: %f\n", localplayer->origin[0],
localplayer->origin[1], localplayer->origin[2]);
#endif
bhop(cmd); bhop(cmd);
} }
int h_HUD_Redraw(float time, int intermission) {
int ret = ORIGINAL(HUD_Redraw, time, intermission);
/* Watermark */
i_engine->pfnDrawSetTextColor(1, 1, 1);
i_engine->pfnDrawConsoleString(5, 5, "8dcc/hl-cheat");
return ret;
}

View File

@ -61,5 +61,6 @@
bool hooks_init(void); bool hooks_init(void);
DECL_HOOK_EXTERN(void, CL_CreateMove, float, usercmd_t*, int); DECL_HOOK_EXTERN(void, CL_CreateMove, float, usercmd_t*, int);
DECL_HOOK_EXTERN(int, HUD_Redraw, float, int);
#endif /* _HOOKS_H */ #endif /* _HOOKS_H */