From 77a8a97a0faad1f9cea2e60729fb175a4d09c9f3 Mon Sep 17 00:00:00 2001 From: 8dcc <8dcc.git@gmail.com> Date: Fri, 21 Jul 2023 15:42:01 +0200 Subject: [PATCH] Add HUD_Redraw hook --- src/hooks.c | 17 ++++++++++++----- src/include/hooks.h | 1 + 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/hooks.c b/src/hooks.c index 3cb14b6..50da349 100644 --- a/src/hooks.c +++ b/src/hooks.c @@ -6,9 +6,11 @@ #include "features/include/movement.h" DECL_HOOK(CL_CreateMove); +DECL_HOOK(HUD_Redraw); bool hooks_init(void) { HOOK(i_client, CL_CreateMove); + HOOK(i_client, HUD_Redraw); return true; } @@ -19,10 +21,15 @@ void h_CL_CreateMove(float frametime, usercmd_t* cmd, int active) { /* Declared in globals.c */ 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); } + +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; +} diff --git a/src/include/hooks.h b/src/include/hooks.h index 8933f89..5e4aeb1 100644 --- a/src/include/hooks.h +++ b/src/include/hooks.h @@ -61,5 +61,6 @@ bool hooks_init(void); DECL_HOOK_EXTERN(void, CL_CreateMove, float, usercmd_t*, int); +DECL_HOOK_EXTERN(int, HUD_Redraw, float, int); #endif /* _HOOKS_H */