Implements Observer_Think Hook (#894)

* Observer Think Hook
* Update CAPI_Impl.cpp
* Update CAPI_Impl.h
* Update regamedll_api.h
This commit is contained in:
Ecnologia 2023-11-26 04:27:09 +00:00 committed by GitHub
parent fba9a335da
commit 15bca2eab9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 3 deletions

View File

@ -334,6 +334,7 @@ GAMEHOOK_REGISTRY(CBasePlayerWeapon_SendWeaponAnim);
GAMEHOOK_REGISTRY(CSGameRules_SendDeathMessage); GAMEHOOK_REGISTRY(CSGameRules_SendDeathMessage);
GAMEHOOK_REGISTRY(CBasePlayer_PlayerDeathThink); GAMEHOOK_REGISTRY(CBasePlayer_PlayerDeathThink);
GAMEHOOK_REGISTRY(CBasePlayer_Observer_Think);
int CReGameApi::GetMajorVersion() { int CReGameApi::GetMajorVersion() {
return REGAMEDLL_API_VERSION_MAJOR; return REGAMEDLL_API_VERSION_MAJOR;

View File

@ -741,6 +741,10 @@ typedef IHookChainRegistryClassImpl<void, CBasePlayerWeapon, int, int> CReGameHo
typedef IHookChainClassImpl<void, CBasePlayer> CReGameHook_CBasePlayer_PlayerDeathThink; typedef IHookChainClassImpl<void, CBasePlayer> CReGameHook_CBasePlayer_PlayerDeathThink;
typedef IHookChainRegistryClassImpl<void, CBasePlayer> CReGameHookRegistry_CBasePlayer_PlayerDeathThink; typedef IHookChainRegistryClassImpl<void, CBasePlayer> CReGameHookRegistry_CBasePlayer_PlayerDeathThink;
// CBasePlayer::Observer_Think hook
typedef IHookChainClassImpl<void, CBasePlayer> CReGameHook_CBasePlayer_Observer_Think;
typedef IHookChainRegistryClassImpl<void, CBasePlayer> CReGameHookRegistry_CBasePlayer_Observer_Think;
class CReGameHookchains: public IReGameHookchains { class CReGameHookchains: public IReGameHookchains {
public: public:
// CBasePlayer virtual // CBasePlayer virtual
@ -900,6 +904,7 @@ public:
CReGameHookRegistry_CSGameRules_SendDeathMessage m_CSGameRules_SendDeathMessage; CReGameHookRegistry_CSGameRules_SendDeathMessage m_CSGameRules_SendDeathMessage;
CReGameHookRegistry_CBasePlayer_PlayerDeathThink m_CBasePlayer_PlayerDeathThink; CReGameHookRegistry_CBasePlayer_PlayerDeathThink m_CBasePlayer_PlayerDeathThink;
CReGameHookRegistry_CBasePlayer_Observer_Think m_CBasePlayer_Observer_Think;
public: public:
virtual IReGameHookRegistry_CBasePlayer_Spawn *CBasePlayer_Spawn(); virtual IReGameHookRegistry_CBasePlayer_Spawn *CBasePlayer_Spawn();
@ -1058,6 +1063,7 @@ public:
virtual IReGameHookRegistry_CSGameRules_SendDeathMessage *CSGameRules_SendDeathMessage(); virtual IReGameHookRegistry_CSGameRules_SendDeathMessage *CSGameRules_SendDeathMessage();
virtual IReGameHookRegistry_CBasePlayer_PlayerDeathThink *CBasePlayer_PlayerDeathThink(); virtual IReGameHookRegistry_CBasePlayer_PlayerDeathThink *CBasePlayer_PlayerDeathThink();
virtual IReGameHookRegistry_CBasePlayer_Observer_Think *CBasePlayer_Observer_Think();
}; };
extern CReGameHookchains g_ReGameHookchains; extern CReGameHookchains g_ReGameHookchains;

View File

@ -541,9 +541,11 @@ void EXT_FUNC CBasePlayer::__API_HOOK(Observer_SetMode)(int iMode)
m_bWasFollowing = false; m_bWasFollowing = false;
} }
void CBasePlayer::Observer_Think() LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, Observer_Think)
void EXT_FUNC CBasePlayer::__API_HOOK(Observer_Think)()
{ {
Observer_HandleButtons(); Observer_HandleButtons();
Observer_CheckTarget(); Observer_CheckTarget();
Observer_CheckProperties(); Observer_CheckProperties();
} }

View File

@ -447,7 +447,8 @@ public:
void CheckTimeBasedDamage_OrigFunc(); void CheckTimeBasedDamage_OrigFunc();
edict_t *EntSelectSpawnPoint_OrigFunc(); edict_t *EntSelectSpawnPoint_OrigFunc();
void PlayerDeathThink_OrigFunc(); void PlayerDeathThink_OrigFunc();
void Observer_Think_OrigFunc();
CCSPlayer *CSPlayer() const; CCSPlayer *CSPlayer() const;
#endif // REGAMEDLL_API #endif // REGAMEDLL_API

View File

@ -620,6 +620,10 @@ typedef IHookChainRegistryClass<void, CBasePlayerWeapon, int, int> IReGameHookRe
typedef IHookChainClass<void, class CBasePlayer> IReGameHook_CBasePlayer_PlayerDeathThink; typedef IHookChainClass<void, class CBasePlayer> IReGameHook_CBasePlayer_PlayerDeathThink;
typedef IHookChainRegistryClass<void, class CBasePlayer> IReGameHookRegistry_CBasePlayer_PlayerDeathThink; typedef IHookChainRegistryClass<void, class CBasePlayer> IReGameHookRegistry_CBasePlayer_PlayerDeathThink;
// CBasePlayer::Observer_Think hook
typedef IHookChainClass<void, class CBasePlayer> IReGameHook_CBasePlayer_Observer_Think;
typedef IHookChainRegistryClass<void, class CBasePlayer> IReGameHookRegistry_CBasePlayer_Observer_Think;
class IReGameHookchains { class IReGameHookchains {
public: public:
virtual ~IReGameHookchains() {} virtual ~IReGameHookchains() {}
@ -780,6 +784,7 @@ public:
virtual IReGameHookRegistry_CSGameRules_SendDeathMessage *CSGameRules_SendDeathMessage() = 0; virtual IReGameHookRegistry_CSGameRules_SendDeathMessage *CSGameRules_SendDeathMessage() = 0;
virtual IReGameHookRegistry_CBasePlayer_PlayerDeathThink *CBasePlayer_PlayerDeathThink() = 0; virtual IReGameHookRegistry_CBasePlayer_PlayerDeathThink *CBasePlayer_PlayerDeathThink() = 0;
virtual IReGameHookRegistry_CBasePlayer_Observer_Think *CBasePlayer_Observer_Think() = 0;
}; };
struct ReGameFuncs_t { struct ReGameFuncs_t {