Implement CBasePlayer::Observer_SetMode hook (#663)

Co-authored-by: Sergey Shorokhov <wopox1337@ya.ru>
This commit is contained in:
Lopol2010 2021-08-31 15:07:21 +03:00 committed by GitHub
parent 67cc153f5d
commit f1b253e5b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 4 deletions

View File

@ -186,6 +186,8 @@ GAMEHOOK_REGISTRY(CBaseEntity_FireBullets);
GAMEHOOK_REGISTRY(CBaseEntity_FireBuckshots);
GAMEHOOK_REGISTRY(CBaseEntity_FireBullets3);
GAMEHOOK_REGISTRY(CBasePlayer_Observer_SetMode);
GAMEHOOK_REGISTRY(CBasePlayer_Pain);
GAMEHOOK_REGISTRY(CBasePlayer_DeathSound);
GAMEHOOK_REGISTRY(CBasePlayer_JoiningThink);

View File

@ -621,6 +621,10 @@ typedef IHookChainRegistryClassImpl<void, class CBaseEntity, ULONG, Vector &, Ve
typedef IHookChainClassImpl<Vector &, class CBaseEntity, Vector &, Vector &, float, float, int, int, int, float, entvars_t *, bool, int> CReGameHook_CBaseEntity_FireBullets3;
typedef IHookChainRegistryClassImpl<Vector &, class CBaseEntity, Vector &, Vector &, float, float, int, int, int, float, entvars_t *, bool, int> CReGameHookRegistry_CBaseEntity_FireBullets3;
// CBasePlayer::Observer_SetMode hook
typedef IHookChainClassImpl<void, CBasePlayer, int> CReGameHook_CBasePlayer_Observer_SetMode;
typedef IHookChainRegistryClassImpl<void, CBasePlayer, int> CReGameHookRegistry_CBasePlayer_Observer_SetMode;
// CBasePlayer::Pain hook
typedef IHookChainClassImpl<void, CBasePlayer, int, bool> CReGameHook_CBasePlayer_Pain;
typedef IHookChainRegistryClassImpl<void, CBasePlayer, int, bool> CReGameHookRegistry_CBasePlayer_Pain;
@ -759,6 +763,8 @@ public:
CReGameHookRegistry_CBaseEntity_FireBuckshots m_CBaseEntity_FireBuckshots;
CReGameHookRegistry_CBaseEntity_FireBullets3 m_CBaseEntity_FireBullets3;
CReGameHookRegistry_CBasePlayer_Observer_SetMode m_CBasePlayer_Observer_SetMode;
CReGameHookRegistry_CBasePlayer_Pain m_CBasePlayer_Pain;
CReGameHookRegistry_CBasePlayer_DeathSound m_CBasePlayer_DeathSound;
CReGameHookRegistry_CBasePlayer_JoiningThink m_CBasePlayer_JoiningThink;
@ -887,6 +893,8 @@ public:
virtual IReGameHookRegistry_CBaseEntity_FireBuckshots *CBaseEntity_FireBuckshots();
virtual IReGameHookRegistry_CBaseEntity_FireBullets3 *CBaseEntity_FireBullets3();
virtual IReGameHookRegistry_CBasePlayer_Observer_SetMode *CBasePlayer_Observer_SetMode();
virtual IReGameHookRegistry_CBasePlayer_Pain *CBasePlayer_Pain();
virtual IReGameHookRegistry_CBasePlayer_DeathSound *CBasePlayer_DeathSound();
virtual IReGameHookRegistry_CBasePlayer_JoiningThink *CBasePlayer_JoiningThink();

View File

@ -443,7 +443,9 @@ void CBasePlayer::Observer_CheckProperties()
}
// Attempt to change the observer mode
void CBasePlayer::Observer_SetMode(int iMode)
LINK_HOOK_CLASS_VOID_CHAIN(CBasePlayer, Observer_SetMode, (int iMode), iMode)
void EXT_FUNC CBasePlayer::__API_HOOK(Observer_SetMode)(int iMode)
{
int forcecamera;
int oldMode;

View File

@ -439,6 +439,7 @@ public:
bool HintMessageEx_OrigFunc(const char *pMessage, float duration = 6.0f, bool bDisplayIfPlayerDead = false, bool bOverride = false);
void UseEmpty_OrigFunc();
void DropIdlePlayer_OrigFunc(const char *reason);
void Observer_SetMode_OrigFunc(int iMode);
void Pain_OrigFunc(int iLastHitGroup, bool bHasArmour);
void DeathSound_OrigFunc();
void JoiningThink_OrigFunc();

View File

@ -500,6 +500,10 @@ typedef IHookChainRegistryClass<void, class CBaseEntity, ULONG, Vector &, Vector
typedef IHookChainClass<Vector &, class CBaseEntity, Vector &, Vector &, float, float, int, int, int, float, entvars_t *, bool, int> IReGameHook_CBaseEntity_FireBullets3;
typedef IHookChainRegistryClass<Vector &, class CBaseEntity, Vector &, Vector &, float, float, int, int, int, float, entvars_t *, bool, int> IReGameHookRegistry_CBaseEntity_FireBullets3;
// CBasePlayer::Observer_SetMode hook
typedef IHookChainClass<void, class CBasePlayer, int> IReGameHook_CBasePlayer_Observer_SetMode;
typedef IHookChainRegistryClass<void, class CBasePlayer, int> IReGameHookRegistry_CBasePlayer_Observer_SetMode;
// CBasePlayer::Pain hook
typedef IHookChainClass<void, class CBasePlayer, int, bool> IReGameHook_CBasePlayer_Pain;
typedef IHookChainRegistryClass<void, class CBasePlayer, int, bool> IReGameHookRegistry_CBasePlayer_Pain;
@ -639,6 +643,8 @@ public:
virtual IReGameHookRegistry_CBaseEntity_FireBuckshots *CBaseEntity_FireBuckshots() = 0;
virtual IReGameHookRegistry_CBaseEntity_FireBullets3 *CBaseEntity_FireBullets3() = 0;
virtual IReGameHookRegistry_CBasePlayer_Observer_SetMode *CBasePlayer_Observer_SetMode() = 0;
virtual IReGameHookRegistry_CBasePlayer_Pain *CBasePlayer_Pain() = 0;
virtual IReGameHookRegistry_CBasePlayer_DeathSound *CBasePlayer_DeathSound() = 0;
virtual IReGameHookRegistry_CBasePlayer_JoiningThink *CBasePlayer_JoiningThink() = 0;