mirror of
https://github.com/rehlds/reapi.git
synced 2024-12-29 08:05:36 +03:00
API: Add hooks ED_Alloc()
and ED_Free()
(#227)
Co-authored-by: Sergey Shorokhov <wopox1337@ya.ru>
This commit is contained in:
parent
81ced333ae
commit
866295f111
@ -76,7 +76,20 @@ enum EngineFunc
|
|||||||
* Description: Called when client it's in the scoreboard
|
* Description: Called when client it's in the scoreboard
|
||||||
* Params: (const this)
|
* Params: (const this)
|
||||||
*/
|
*/
|
||||||
RH_SV_EmitPings
|
RH_SV_EmitPings,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Description: Called when an entity is created.
|
||||||
|
* Return type: Edict * (Entity index)
|
||||||
|
* Params: ()
|
||||||
|
*/
|
||||||
|
RH_ED_Alloc,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Description: Called when an entity is removed (freed from server).
|
||||||
|
* Params: (const entity)
|
||||||
|
*/
|
||||||
|
RH_ED_Free,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -338,4 +338,4 @@ public:
|
|||||||
virtual IRehldsFlightRecorder* GetFlightRecorder() = 0;
|
virtual IRehldsFlightRecorder* GetFlightRecorder() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define VREHLDS_HLDS_API_VERSION "VREHLDS_HLDS_API_VERSION001"
|
#define VREHLDS_HLDS_API_VERSION "VREHLDS_HLDS_API_VERSION001"
|
||||||
|
@ -111,6 +111,26 @@ void SV_EmitPings(IRehldsHook_SV_EmitPings *chain, IGameClient *cl, sizebuf_t *m
|
|||||||
SV_EmitPings_AMXX(&data, cl);
|
SV_EmitPings_AMXX(&data, cl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
edict_t *ED_Alloc(IRehldsHook_ED_Alloc* chain)
|
||||||
|
{
|
||||||
|
auto original = [chain]()
|
||||||
|
{
|
||||||
|
return indexOfEdict(chain->callNext());
|
||||||
|
};
|
||||||
|
|
||||||
|
return edictByIndexAmx(callForward<size_t>(RH_ED_Alloc, original));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ED_Free(IRehldsHook_ED_Free* chain, edict_t *entity)
|
||||||
|
{
|
||||||
|
auto original = [chain](int _entity)
|
||||||
|
{
|
||||||
|
chain->callNext(edictByIndexAmx(_entity));
|
||||||
|
};
|
||||||
|
|
||||||
|
callVoidForward(RH_ED_Free, original, indexOfEdict(entity));
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ReGameDLL functions
|
* ReGameDLL functions
|
||||||
*/
|
*/
|
||||||
|
@ -360,6 +360,9 @@ using SV_EmitPings_t = hookdata_t<IRehldsHook_SV_EmitPings *, SV_EmitPings_args_
|
|||||||
void SV_EmitPings_AMXX(SV_EmitPings_t *data, IGameClient *client);
|
void SV_EmitPings_AMXX(SV_EmitPings_t *data, IGameClient *client);
|
||||||
void SV_EmitPings(IRehldsHook_SV_EmitPings *chain, IGameClient *client, sizebuf_t *msg);
|
void SV_EmitPings(IRehldsHook_SV_EmitPings *chain, IGameClient *client, sizebuf_t *msg);
|
||||||
|
|
||||||
|
edict_t *ED_Alloc(IRehldsHook_ED_Alloc* chain);
|
||||||
|
void ED_Free(IRehldsHook_ED_Free* chain, edict_t *entity);
|
||||||
|
|
||||||
// regamedll functions
|
// regamedll functions
|
||||||
int GetForceCamera(IReGameHook_GetForceCamera *chain, CBasePlayer *pObserver);
|
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 PlayerBlind(IReGameHook_PlayerBlind *chain, CBasePlayer *pPlayer, entvars_t *pevInflictor, entvars_t *pevAttacker, float fadeTime, float fadeHold, int alpha, Vector& color);
|
||||||
|
@ -90,7 +90,9 @@ hook_t hooklist_engine[] = {
|
|||||||
ENG(GetEntityInit),
|
ENG(GetEntityInit),
|
||||||
ENG(ClientConnected),
|
ENG(ClientConnected),
|
||||||
ENG(SV_ConnectClient),
|
ENG(SV_ConnectClient),
|
||||||
ENG(SV_EmitPings, _AMXX)
|
ENG(SV_EmitPings, _AMXX),
|
||||||
|
ENG(ED_Alloc),
|
||||||
|
ENG(ED_Free),
|
||||||
};
|
};
|
||||||
|
|
||||||
#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); }, false}
|
#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); }, false}
|
||||||
|
@ -101,7 +101,9 @@ enum EngineFunc
|
|||||||
RH_GetEntityInit,
|
RH_GetEntityInit,
|
||||||
RH_ClientConnected,
|
RH_ClientConnected,
|
||||||
RH_SV_ConnectClient,
|
RH_SV_ConnectClient,
|
||||||
RH_SV_EmitPings
|
RH_SV_EmitPings,
|
||||||
|
RH_ED_Alloc,
|
||||||
|
RH_ED_Free,
|
||||||
|
|
||||||
// [...]
|
// [...]
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user