mirror of
https://github.com/rehlds/reapi.git
synced 2025-01-16 00:28:17 +03:00
Implement RG_CBasePlayer_Observer_FindNextPlayer
hook (#210)
* Implement Observer_FindNextPlayer Hook * Update regamedll_api.h * fix order for Vfuncs * Add description in reapi_gamedll_const.inc * add macro for suppress warning: 200 on amxmodx 1.8.2 * Add return type for hook description Co-authored-by: Sergey Shorokhov <wopox1337@ya.ru>
This commit is contained in:
parent
2c415638ce
commit
5fbe531bc7
@ -38,6 +38,7 @@
|
||||
#define RG_CBasePlayerWeapon_DefaultReload RG_CBaseWeapon_DefReload
|
||||
#define RG_CBasePlayerWeapon_DefaultShotgunReload RG_CBaseWeapon_DefShotgunReload
|
||||
#define RG_CBasePlayer_Observer_SetMode RG_CBasePlayer_Observer_SetMod
|
||||
#define RG_CBasePlayer_Observer_FindNextPlayer RG_CBasePlayer_Observer_FindNxt
|
||||
#endif
|
||||
|
||||
/**
|
||||
@ -791,7 +792,14 @@ enum GamedllFunc_CBasePlayer
|
||||
* Params: (const this, iMode)
|
||||
*/
|
||||
RG_CBasePlayer_Observer_SetMode,
|
||||
|
||||
|
||||
/*
|
||||
* Description: Called when a client attempt to find the next observer.
|
||||
* Return type: void
|
||||
* Params: (const this, bool bReverse, name[])
|
||||
*/
|
||||
RG_CBasePlayer_Observer_FindNextPlayer,
|
||||
|
||||
/*
|
||||
* Description: Called when a client emits a "pain sound" after received damage.
|
||||
* Return type: void
|
||||
|
@ -505,6 +505,10 @@ typedef IHookChainRegistryClass<Vector &, class CBaseEntity, Vector &, Vector &,
|
||||
typedef IHookChainClass<void, class CBasePlayer, int> IReGameHook_CBasePlayer_Observer_SetMode;
|
||||
typedef IHookChainRegistryClass<void, class CBasePlayer, int> IReGameHookRegistry_CBasePlayer_Observer_SetMode;
|
||||
|
||||
// CBasePlayer::Observer_FindNextPlayer hook
|
||||
typedef IHookChainClass<void, class CBasePlayer, bool, const char *> IReGameHook_CBasePlayer_Observer_FindNextPlayer;
|
||||
typedef IHookChainRegistryClass<void, class CBasePlayer, bool, const char *> IReGameHookRegistry_CBasePlayer_Observer_FindNextPlayer;
|
||||
|
||||
// CBasePlayer::Pain hook
|
||||
typedef IHookChainClass<void, class CBasePlayer, int, bool> IReGameHook_CBasePlayer_Pain;
|
||||
typedef IHookChainRegistryClass<void, class CBasePlayer, int, bool> IReGameHookRegistry_CBasePlayer_Pain;
|
||||
@ -645,7 +649,8 @@ public:
|
||||
virtual IReGameHookRegistry_CBaseEntity_FireBullets3 *CBaseEntity_FireBullets3() = 0;
|
||||
|
||||
virtual IReGameHookRegistry_CBasePlayer_Observer_SetMode *CBasePlayer_Observer_SetMode() = 0;
|
||||
|
||||
virtual IReGameHookRegistry_CBasePlayer_Observer_FindNextPlayer *CBasePlayer_Observer_FindNextPlayer() = 0;
|
||||
|
||||
virtual IReGameHookRegistry_CBasePlayer_Pain *CBasePlayer_Pain() = 0;
|
||||
virtual IReGameHookRegistry_CBasePlayer_DeathSound *CBasePlayer_DeathSound() = 0;
|
||||
virtual IReGameHookRegistry_CBasePlayer_JoiningThink *CBasePlayer_JoiningThink() = 0;
|
||||
|
@ -298,6 +298,16 @@ CBasePlayer *CBasePlayer_Observer_IsValidTarget(IReGameHook_CBasePlayer_Observer
|
||||
return getPrivate<CBasePlayer>(callForward<size_t>(RG_CBasePlayer_Observer_IsValidTarget, original, indexOfEdict(pthis->pev), iPlayerIndex, bSameTeam));
|
||||
}
|
||||
|
||||
void CBasePlayer_Observer_FindNextPlayer(IReGameHook_CBasePlayer_Observer_FindNextPlayer *chain, CBasePlayer *pthis, bool bReverse, const char *name)
|
||||
{
|
||||
auto original = [chain](int _pthis, bool _bReverse, const char *_name)
|
||||
{
|
||||
chain->callNext(getPrivate<CBasePlayer>(_pthis), _bReverse, _name);
|
||||
};
|
||||
|
||||
callVoidForward(RG_CBasePlayer_Observer_FindNextPlayer, original, indexOfEdict(pthis->pev), bReverse, name);
|
||||
}
|
||||
|
||||
void CBasePlayer_SetAnimation(IReGameHook_CBasePlayer_SetAnimation *chain, CBasePlayer *pthis, PLAYER_ANIM playerAnim)
|
||||
{
|
||||
auto original = [chain](int _pthis, PLAYER_ANIM _playerAnim)
|
||||
|
@ -402,6 +402,7 @@ void CBasePlayer_RoundRespawn(IReGameHook_CBasePlayer_RoundRespawn *chain, CBase
|
||||
void CBasePlayer_Blind(IReGameHook_CBasePlayer_Blind *chain, CBasePlayer *pthis, float flUntilTime, float flHoldTime, float flFadeTime, int iAlpha);
|
||||
|
||||
CBasePlayer *CBasePlayer_Observer_IsValidTarget(IReGameHook_CBasePlayer_Observer_IsValidTarget *chain, CBasePlayer *pthis, int iPlayerIndex, bool bSameTeam);
|
||||
void CBasePlayer_Observer_FindNextPlayer(IReGameHook_CBasePlayer_Observer_FindNextPlayer *chain, CBasePlayer *pthis, bool bReverse, const char *name);
|
||||
void CBasePlayer_SetAnimation(IReGameHook_CBasePlayer_SetAnimation *chain, CBasePlayer *pthis, PLAYER_ANIM playerAnim);
|
||||
void CBasePlayer_GiveDefaultItems(IReGameHook_CBasePlayer_GiveDefaultItems *chain, CBasePlayer *pthis);
|
||||
CBaseEntity *CBasePlayer_GiveNamedItem(IReGameHook_CBasePlayer_GiveNamedItem *chain, CBasePlayer *pthis, const char *pszName);
|
||||
|
@ -169,6 +169,7 @@ hook_t hooklist_player[] = {
|
||||
DLL(CBasePlayer_DropIdlePlayer),
|
||||
|
||||
DLL(CBasePlayer_Observer_SetMode),
|
||||
DLL(CBasePlayer_Observer_FindNextPlayer),
|
||||
|
||||
DLL(CBasePlayer_Pain),
|
||||
DLL(CBasePlayer_DeathSound),
|
||||
|
@ -194,6 +194,7 @@ enum GamedllFunc_CBasePlayer
|
||||
RG_CBasePlayer_DropIdlePlayer,
|
||||
|
||||
RG_CBasePlayer_Observer_SetMode,
|
||||
RG_CBasePlayer_Observer_FindNextPlayer,
|
||||
|
||||
RG_CBasePlayer_Pain,
|
||||
RG_CBasePlayer_DeathSound,
|
||||
|
Loading…
x
Reference in New Issue
Block a user