Hook HUD_PostRunCmd and store NextAttacks
This commit is contained in:
parent
3d3ebd7c5a
commit
cd3fde56a3
19
src/hooks.c
19
src/hooks.c
|
@ -12,6 +12,7 @@ DECL_HOOK(CL_CreateMove);
|
|||
DECL_HOOK(HUD_Redraw);
|
||||
DECL_HOOK(StudioRenderModel);
|
||||
DECL_HOOK(CalcRefdef);
|
||||
DECL_HOOK(HUD_PostRunCmd);
|
||||
|
||||
/* OpenGL hooks */
|
||||
DECL_HOOK(glColor4f);
|
||||
|
@ -29,6 +30,7 @@ bool hooks_init(void) {
|
|||
HOOK(i_client, HUD_Redraw);
|
||||
HOOK(i_studiomodelrenderer, StudioRenderModel);
|
||||
HOOK(i_client, CalcRefdef);
|
||||
HOOK(i_client, HUD_PostRunCmd);
|
||||
|
||||
/* OpenGL hooks */
|
||||
GL_HOOK(glColor4f);
|
||||
|
@ -87,6 +89,8 @@ void h_StudioRenderModel(void* this_ptr) {
|
|||
ORIGINAL(StudioRenderModel, this_ptr);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
void h_CalcRefdef(ref_params_t* params) {
|
||||
/* Store punch angles for CreateMove */
|
||||
vec_copy(g_punchAngles, params->punchangle);
|
||||
|
@ -96,6 +100,21 @@ void h_CalcRefdef(ref_params_t* params) {
|
|||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
void h_HUD_PostRunCmd(struct local_state_s* from, struct local_state_s* to,
|
||||
struct usercmd_s* cmd, int runfuncs, double time,
|
||||
unsigned int random_seed) {
|
||||
ORIGINAL(HUD_PostRunCmd, from, to, cmd, runfuncs, time, random_seed);
|
||||
|
||||
/* Store attack information to check if we can shoot */
|
||||
if (runfuncs) {
|
||||
g_flNextAttack = to->client.m_flNextAttack;
|
||||
g_flNextPrimaryAttack =
|
||||
to->weapondata[to->client.m_iId].m_flNextPrimaryAttack;
|
||||
}
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
void h_glColor4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a) {
|
||||
/* This visible_mode variable is changed inside the chams() function, which
|
||||
* is called from the StudioRenderModel hook.
|
||||
|
|
|
@ -96,6 +96,9 @@ DECL_HOOK_EXTERN(void, CL_CreateMove, float, usercmd_t*, int);
|
|||
DECL_HOOK_EXTERN(int, HUD_Redraw, float, int);
|
||||
DECL_HOOK_EXTERN(void, StudioRenderModel, void*);
|
||||
DECL_HOOK_EXTERN(void, CalcRefdef, ref_params_t*);
|
||||
DECL_HOOK_EXTERN(void, HUD_PostRunCmd, struct local_state_s*,
|
||||
struct local_state_s*, struct usercmd_s*, int, double,
|
||||
unsigned int);
|
||||
|
||||
/* OpenGL hooks */
|
||||
DECL_HOOK_EXTERN(void, glColor4f, GLfloat, GLfloat, GLfloat, GLfloat);
|
||||
|
|
Loading…
Reference in New Issue