Add localplayer entity

This commit is contained in:
8dcc 2023-07-20 23:30:44 +02:00
parent e3af8bd39a
commit 8216613d11
3 changed files with 13 additions and 0 deletions

View File

@ -10,6 +10,9 @@ DECL_INTF(cl_enginefunc_t, engine);
DECL_INTF(cl_clientfunc_t, client); DECL_INTF(cl_clientfunc_t, client);
DECL_INTF(playermove_t, pmove); DECL_INTF(playermove_t, pmove);
/* Updated in CL_CreateMove hook */
cl_entity_t* localplayer = NULL;
bool globals_init(void) { bool globals_init(void) {
/* /*
* Get handler for hw.so * Get handler for hw.so

View File

@ -16,5 +16,13 @@ bool hooks_init(void) {
void h_CL_CreateMove(float frametime, usercmd_t* cmd, int active) { void h_CL_CreateMove(float frametime, usercmd_t* cmd, int active) {
ORIGINAL(CL_CreateMove, frametime, cmd, active); ORIGINAL(CL_CreateMove, frametime, cmd, 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); bhop(cmd);
} }

View File

@ -29,6 +29,8 @@ DECL_INTF_EXTERN(cl_enginefunc_t, engine);
DECL_INTF_EXTERN(cl_clientfunc_t, client); DECL_INTF_EXTERN(cl_clientfunc_t, client);
DECL_INTF_EXTERN(playermove_t, pmove); DECL_INTF_EXTERN(playermove_t, pmove);
extern cl_entity_t* localplayer;
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
bool globals_init(void); bool globals_init(void);