Implement CBasePlayer::Observer_FindNextPlayer() hook (#667)

* Implement Observer_FindNextPlayer hook

Co-authored-by: Sergey Shorokhov <wopox1337@ya.ru>
This commit is contained in:
Sergey Shorokhov 2021-08-31 22:04:32 +03:00
parent 983500c9bd
commit 7e2279f8c5
5 changed files with 16 additions and 1 deletions

View File

@ -198,6 +198,7 @@ GAMEHOOK_REGISTRY(CBaseEntity_FireBuckshots);
GAMEHOOK_REGISTRY(CBaseEntity_FireBullets3);
GAMEHOOK_REGISTRY(CBasePlayer_Observer_SetMode);
GAMEHOOK_REGISTRY(CBasePlayer_Observer_FindNextPlayer);
GAMEHOOK_REGISTRY(CBasePlayer_Pain);
GAMEHOOK_REGISTRY(CBasePlayer_DeathSound);

View File

@ -625,6 +625,10 @@ typedef IHookChainRegistryClassImpl<Vector &, class CBaseEntity, Vector &, Vecto
typedef IHookChainClassImpl<void, CBasePlayer, int> CReGameHook_CBasePlayer_Observer_SetMode;
typedef IHookChainRegistryClassImpl<void, CBasePlayer, int> CReGameHookRegistry_CBasePlayer_Observer_SetMode;
// CBasePlayer::Observer_FindNextPlayer hook
typedef IHookChainClassImpl<void, CBasePlayer, bool, const char *> CReGameHook_CBasePlayer_Observer_FindNextPlayer;
typedef IHookChainRegistryClassImpl<void, CBasePlayer, bool, const char *> CReGameHookRegistry_CBasePlayer_Observer_FindNextPlayer;
// CBasePlayer::Pain hook
typedef IHookChainClassImpl<void, CBasePlayer, int, bool> CReGameHook_CBasePlayer_Pain;
typedef IHookChainRegistryClassImpl<void, CBasePlayer, int, bool> CReGameHookRegistry_CBasePlayer_Pain;
@ -764,6 +768,7 @@ public:
CReGameHookRegistry_CBaseEntity_FireBullets3 m_CBaseEntity_FireBullets3;
CReGameHookRegistry_CBasePlayer_Observer_SetMode m_CBasePlayer_Observer_SetMode;
CReGameHookRegistry_CBasePlayer_Observer_FindNextPlayer m_CBasePlayer_Observer_FindNextPlayer;
CReGameHookRegistry_CBasePlayer_Pain m_CBasePlayer_Pain;
CReGameHookRegistry_CBasePlayer_DeathSound m_CBasePlayer_DeathSound;
@ -894,6 +899,7 @@ public:
virtual IReGameHookRegistry_CBaseEntity_FireBullets3 *CBaseEntity_FireBullets3();
virtual IReGameHookRegistry_CBasePlayer_Observer_SetMode *CBasePlayer_Observer_SetMode();
virtual IReGameHookRegistry_CBasePlayer_Observer_FindNextPlayer *CBasePlayer_Observer_FindNextPlayer();
virtual IReGameHookRegistry_CBasePlayer_Pain *CBasePlayer_Pain();
virtual IReGameHookRegistry_CBasePlayer_DeathSound *CBasePlayer_DeathSound();

View File

@ -137,8 +137,10 @@ void UpdateClientEffects(CBasePlayer *pObserver, int oldMode)
}
}
LINK_HOOK_CLASS_VOID_CHAIN(CBasePlayer, Observer_FindNextPlayer, (bool bReverse, const char *name), bReverse, name)
// Find the next client in the game for this player to spectate
void CBasePlayer::Observer_FindNextPlayer(bool bReverse, const char *name)
void CBasePlayer::__API_HOOK(Observer_FindNextPlayer)(bool bReverse, const char *name)
{
int iStart;
int iCurrent;

View File

@ -440,6 +440,7 @@ public:
void UseEmpty_OrigFunc();
void DropIdlePlayer_OrigFunc(const char *reason);
void Observer_SetMode_OrigFunc(int iMode);
EXT_FUNC void Observer_FindNextPlayer_OrigFunc(bool bReverse, const char* name = nullptr);
void Pain_OrigFunc(int iLastHitGroup, bool bHasArmour);
void DeathSound_OrigFunc();
void JoiningThink_OrigFunc();

View File

@ -504,6 +504,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;
@ -644,6 +648,7 @@ 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;