Commit d954d042 authored by Dmitry's avatar Dmitry Committed by Dmitry Novikov

Implement RG_CBasePlayer_DropIdlePlayer hook (#148)

* Implement RG_CBasePlayer_DropIdlePlayer hook
parent 98748209
......@@ -761,6 +761,13 @@ enum GamedllFunc_CBasePlayer
* Params: (const this)
*/
RG_CBasePlayer_UseEmpty,
/*
* Description: Called when a idle player is removed from server.
* Return type: void
* Params: (const this, const reason[])
*/
RG_CBasePlayer_DropIdlePlayer,
};
/**
......
......@@ -460,6 +460,10 @@ typedef IHookChainRegistryClass<int, class CBasePlayerWeapon, int, int, float> I
typedef IHookChainClass<bool, class CBasePlayerWeapon, int, int, float, float, const char *, const char *> IReGameHook_CBasePlayerWeapon_DefaultShotgunReload;
typedef IHookChainRegistryClass<bool, class CBasePlayerWeapon, int, int, float, float, const char *, const char *> IReGameHookRegistry_CBasePlayerWeapon_DefaultShotgunReload;
// CBasePlayer::DropIdlePlayer hook
typedef IHookChainClass<void, class CBasePlayer, const char *> IReGameHook_CBasePlayer_DropIdlePlayer;
typedef IHookChainRegistryClass<void, class CBasePlayer, const char *> IReGameHookRegistry_CBasePlayer_DropIdlePlayer;
class IReGameHookchains {
public:
virtual ~IReGameHookchains() {}
......@@ -574,6 +578,7 @@ public:
virtual IReGameHookRegistry_CBasePlayerWeapon_DefaultDeploy *CBasePlayerWeapon_DefaultDeploy() = 0;
virtual IReGameHookRegistry_CBasePlayerWeapon_DefaultReload *CBasePlayerWeapon_DefaultReload() = 0;
virtual IReGameHookRegistry_CBasePlayerWeapon_DefaultShotgunReload *CBasePlayerWeapon_DefaultShotgunReload() = 0;
virtual IReGameHookRegistry_CBasePlayer_DropIdlePlayer *CBasePlayer_DropIdlePlayer() = 0;
};
struct ReGameFuncs_t {
......
......@@ -552,6 +552,16 @@ void CBasePlayer_UseEmpty(IReGameHook_CBasePlayer_UseEmpty *chain, CBasePlayer *
callVoidForward(RG_CBasePlayer_UseEmpty, original, indexOfEdict(pthis->pev));
}
void CBasePlayer_DropIdlePlayer(IReGameHook_CBasePlayer_DropIdlePlayer *chain, CBasePlayer *pthis, const char *reason)
{
auto original = [chain](int _pthis, const char *_reason)
{
return chain->callNext(getPrivate<CBasePlayer>(_pthis), _reason);
};
callVoidForward(RG_CBasePlayer_DropIdlePlayer, original, indexOfEdict(pthis->pev), reason);
}
void CBaseAnimating_ResetSequenceInfo(IReGameHook_CBaseAnimating_ResetSequenceInfo *chain, CBaseAnimating *pthis)
{
auto original = [chain](int _pthis)
......
......@@ -389,6 +389,7 @@ void CBasePlayer_SetSpawnProtection(IReGameHook_CBasePlayer_SetSpawnProtection *
void CBasePlayer_RemoveSpawnProtection(IReGameHook_CBasePlayer_RemoveSpawnProtection *chain, CBasePlayer *pthis);
bool CBasePlayer_HintMessageEx(IReGameHook_CBasePlayer_HintMessageEx *chain, CBasePlayer *pthis, const char *pMessage, float duration, bool bDisplayIfPlayerDead, bool bOverride);
void CBasePlayer_UseEmpty(IReGameHook_CBasePlayer_UseEmpty *chain, CBasePlayer *pthis);
void CBasePlayer_DropIdlePlayer(IReGameHook_CBasePlayer_DropIdlePlayer *chain, CBasePlayer *pthis, const char *reason);
void CBaseAnimating_ResetSequenceInfo(IReGameHook_CBaseAnimating_ResetSequenceInfo *chain, CBaseAnimating *pthis);
......
......@@ -155,6 +155,7 @@ hook_t hooklist_player[] = {
DLL(CBasePlayer_RemoveSpawnProtection),
DLL(CBasePlayer_HintMessageEx),
DLL(CBasePlayer_UseEmpty),
DLL(CBasePlayer_DropIdlePlayer),
};
hook_t hooklist_gamerules[] = {
......
......@@ -180,6 +180,7 @@ enum GamedllFunc_CBasePlayer
RG_CBasePlayer_RemoveSpawnProtection,
RG_CBasePlayer_HintMessageEx,
RG_CBasePlayer_UseEmpty,
RG_CBasePlayer_DropIdlePlayer,
// [...]
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment