diff --git a/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc b/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc index d7259ef..deb043a 100644 --- a/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc +++ b/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc @@ -300,7 +300,7 @@ enum GamedllFunc /* * Description: - - * Params: (const ppmove, const server) + * Params: (const playerIndex) */ RG_PM_Move, diff --git a/reapi/src/hook_callback.cpp b/reapi/src/hook_callback.cpp index dfbabfe..cebef0b 100644 --- a/reapi/src/hook_callback.cpp +++ b/reapi/src/hook_callback.cpp @@ -606,15 +606,23 @@ bool RoundEnd(IReGameHook_RoundEnd *chain, int winStatus, ScenarioEventEndRound return callForward(RG_RoundEnd, original, winStatus, event, tmDelay); } -void PM_Move(IReGameHook_PM_Move *chain, playermove_t *ppmove, int server) +void PM_Move_AMXX(Move_t *data, int playerIndex) { - auto original = [chain](playermove_t *_ppmove, int _server) + auto original = [data](int _playerIndex) { - chain->callNext(_ppmove, _server); + data->m_chain->callNext(data->m_args.ppmove, data->m_args.server); }; + callVoidForward(RG_PM_Move, original, playerIndex); +} + +void PM_Move(IReGameHook_PM_Move *chain, playermove_t *ppmove, int server) +{ g_pMove = ppmove; - callVoidForward(RG_PM_Move, original, ppmove, server); + + Move_args_t args(ppmove, server); + Move_t data(chain, args); + PM_Move_AMXX(&data, ppmove->player_index + 1); } void PM_AirMove(IReGameHook_PM_AirMove *chain, int playerIndex) diff --git a/reapi/src/hook_callback.h b/reapi/src/hook_callback.h index 47edb7b..2b98fd1 100644 --- a/reapi/src/hook_callback.h +++ b/reapi/src/hook_callback.h @@ -313,7 +313,19 @@ int GetForceCamera(IReGameHook_GetForceCamera *chain, CBasePlayer *pObserver); void PlayerBlind(IReGameHook_PlayerBlind *chain, CBasePlayer *pPlayer, entvars_t *pevInflictor, entvars_t *pevAttacker, float fadeTime, float fadeHold, int alpha, Vector& color); void RadiusFlash_TraceLine(IReGameHook_RadiusFlash_TraceLine *chain, CBasePlayer *pPlayer, entvars_t *pevInflictor, entvars_t *pevAttacker, Vector& vecSrc, Vector& vecSpot, TraceResult *ptr); bool RoundEnd(IReGameHook_RoundEnd *chain, int winStatus, ScenarioEventEndRound event, float tmDelay); + +struct Move_args_t +{ + Move_args_t(playermove_t *_ppmove, int _server) : ppmove(_ppmove), server(_server) {} + + playermove_t *ppmove; + int server; +}; + +using Move_t = hookdata_t; +void PM_Move_AMXX(Move_t *data, int playerIndex); void PM_Move(IReGameHook_PM_Move *chain, playermove_t *ppmove, int server); + void PM_AirMove(IReGameHook_PM_AirMove *chain, int playerIndex); void HandleMenu_ChooseAppearance(IReGameHook_HandleMenu_ChooseAppearance *chain, CBasePlayer *pPlayer, int slot); BOOL HandleMenu_ChooseTeam(IReGameHook_HandleMenu_ChooseTeam *chain, CBasePlayer *pPlayer, int slot); diff --git a/reapi/src/hook_list.cpp b/reapi/src/hook_list.cpp index 57ed234..b22586c 100644 --- a/reapi/src/hook_list.cpp +++ b/reapi/src/hook_list.cpp @@ -80,13 +80,13 @@ hook_t hooklist_engine[] = { ENG(SV_WriteFullClientUpdate, _AMXX) }; -#define DLL(h) { {}, {}, #h, "ReGameDLL", [](){ return api_cfg.hasReGameDLL(); }, ((!(RG_##h & (MAX_REGION_RANGE - 1)) ? regfunc::current_cell = 1, true : false) || (RG_##h & (MAX_REGION_RANGE - 1)) == regfunc::current_cell++) ? regfunc(h) : regfunc(#h), [](){ g_ReGameHookchains->h()->registerHook(&h); }, [](){ g_ReGameHookchains->h()->unregisterHook(&h); }} +#define DLL(h,...) { {}, {}, #h, "ReGameDLL", [](){ return api_cfg.hasReGameDLL(); }, ((!(RG_##h & (MAX_REGION_RANGE - 1)) ? regfunc::current_cell = 1, true : false) || (RG_##h & (MAX_REGION_RANGE - 1)) == regfunc::current_cell++) ? regfunc(h##__VA_ARGS__) : regfunc(#h#__VA_ARGS__), [](){ g_ReGameHookchains->h()->registerHook(&h); }, [](){ g_ReGameHookchains->h()->unregisterHook(&h); }} hook_t hooklist_gamedll[] = { DLL(GetForceCamera), DLL(PlayerBlind), DLL(RadiusFlash_TraceLine), DLL(RoundEnd), - DLL(PM_Move), + DLL(PM_Move, _AMXX), DLL(PM_AirMove), DLL(HandleMenu_ChooseAppearance), DLL(HandleMenu_ChooseTeam),