mirror of
https://github.com/rehlds/reapi.git
synced 2024-12-27 23:25:30 +03:00
Rework hookchain RG_PM_Move
This commit is contained in:
parent
6068d4e6ff
commit
bba0631fbe
@ -300,7 +300,7 @@ enum GamedllFunc
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Params: (const ppmove, const server)
|
||||
* Params: (const playerIndex)
|
||||
*/
|
||||
RG_PM_Move,
|
||||
|
||||
|
@ -606,15 +606,23 @@ bool RoundEnd(IReGameHook_RoundEnd *chain, int winStatus, ScenarioEventEndRound
|
||||
return callForward<bool>(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)
|
||||
|
@ -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<IReGameHook_PM_Move *, Move_args_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);
|
||||
|
@ -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),
|
||||
|
Loading…
Reference in New Issue
Block a user