Added API hook CBasePlayer::HintMessageEx

Bump minor version API
This commit is contained in:
s1lent 2019-06-06 02:57:40 +07:00
parent f09df43ce4
commit 1745de6aca
No known key found for this signature in database
GPG Key ID: 0FE401DC73916B5C
8 changed files with 33 additions and 5 deletions

View File

@ -1,3 +1,3 @@
majorVersion=5
minorVersion=7
minorVersion=9
maintenanceVersion=0

View File

@ -160,6 +160,7 @@ GAMEHOOK_REGISTRY(PlantBomb);
GAMEHOOK_REGISTRY(CBasePlayer_SetSpawnProtection);
GAMEHOOK_REGISTRY(CBasePlayer_RemoveSpawnProtection);
GAMEHOOK_REGISTRY(IsPenetrableEntity);
GAMEHOOK_REGISTRY(CBasePlayer_HintMessageEx);
int CReGameApi::GetMajorVersion() {
return REGAMEDLL_API_VERSION_MAJOR;

View File

@ -533,6 +533,10 @@ typedef IHookChainRegistryClassImpl<void, CBasePlayer> CReGameHookRegistry_CBase
typedef IHookChainImpl<bool, Vector &, Vector &, entvars_t *, edict_t *> CReGameHook_IsPenetrableEntity;
typedef IHookChainRegistryImpl<bool, Vector &, Vector &, entvars_t *, edict_t *> CReGameHookRegistry_IsPenetrableEntity;
// CBasePlayer::HintMessage hook
typedef IHookChainClassImpl<bool, CBasePlayer, const char *, float, bool, bool> CReGameHook_CBasePlayer_HintMessageEx;
typedef IHookChainRegistryClassImpl<bool, CBasePlayer, const char *, float, bool, bool> CReGameHookRegistry_CBasePlayer_HintMessageEx;
class CReGameHookchains: public IReGameHookchains {
public:
// CBasePlayer virtual
@ -640,6 +644,8 @@ public:
CReGameHookRegistry_CBasePlayer_SetSpawnProtection m_CBasePlayer_SetSpawnProtection;
CReGameHookRegistry_CBasePlayer_RemoveSpawnProtection m_CBasePlayer_RemoveSpawnProtection;
CReGameHookRegistry_IsPenetrableEntity m_IsPenetrableEntity;
CReGameHookRegistry_CBasePlayer_HintMessageEx m_CBasePlayer_HintMessageEx;
public:
virtual IReGameHookRegistry_CBasePlayer_Spawn *CBasePlayer_Spawn();
virtual IReGameHookRegistry_CBasePlayer_Precache *CBasePlayer_Precache();
@ -700,7 +706,7 @@ public:
virtual IReGameHookRegistry_BuyGunAmmo *BuyGunAmmo();
virtual IReGameHookRegistry_BuyWeaponByWeaponID *BuyWeaponByWeaponID();
virtual IReGameHookRegistry_InternalCommand *InternalCommand();
virtual IReGameHookRegistry_CSGameRules_FShouldSwitchWeapon *CSGameRules_FShouldSwitchWeapon();
virtual IReGameHookRegistry_CSGameRules_GetNextBestWeapon *CSGameRules_GetNextBestWeapon();
virtual IReGameHookRegistry_CSGameRules_FlPlayerFallDamage *CSGameRules_FlPlayerFallDamage();
@ -745,6 +751,7 @@ public:
virtual IReGameHookRegistry_CBasePlayer_SetSpawnProtection *CBasePlayer_SetSpawnProtection();
virtual IReGameHookRegistry_CBasePlayer_RemoveSpawnProtection *CBasePlayer_RemoveSpawnProtection();
virtual IReGameHookRegistry_IsPenetrableEntity *IsPenetrableEntity();
virtual IReGameHookRegistry_CBasePlayer_HintMessageEx *CBasePlayer_HintMessageEx();
};
extern CReGameHookchains g_ReGameHookchains;

View File

@ -499,3 +499,8 @@ EXT_FUNC void CCSPlayer::RemoveSpawnProtection()
{
BasePlayer()->RemoveSpawnProtection();
}
EXT_FUNC bool CCSPlayer::HintMessageEx(const char *pMessage, float duration, bool bDisplayIfPlayerDead, bool bOverride)
{
return BasePlayer()->HintMessageEx(pMessage, duration, bDisplayIfPlayerDead, bOverride);
}

View File

@ -7184,17 +7184,24 @@ void EXT_FUNC CBasePlayer::__API_HOOK(ResetMaxSpeed)()
pev->maxspeed = speed;
}
bool CBasePlayer::HintMessage(const char *pMessage, BOOL bDisplayIfPlayerDead, BOOL bOverride)
LINK_HOOK_CLASS_CHAIN(bool, CBasePlayer, HintMessageEx, (const char *pMessage, float duration, bool bDisplayIfPlayerDead, bool bOverride), pMessage, duration, bDisplayIfPlayerDead, bOverride)
bool EXT_FUNC CBasePlayer::__API_HOOK(HintMessageEx)(const char *pMessage, float duration, bool bDisplayIfPlayerDead, bool bOverride)
{
if (!bDisplayIfPlayerDead && !IsAlive())
return false;
if (bOverride || m_bShowHints)
return m_hintMessageQueue.AddMessage(pMessage, 6.0, true, nullptr);
return m_hintMessageQueue.AddMessage(pMessage, duration, true, nullptr);
return true;
}
bool EXT_FUNC CBasePlayer::HintMessage(const char *pMessage, BOOL bDisplayIfPlayerDead, BOOL bOverride)
{
return HintMessageEx(pMessage, 6.0f, bDisplayIfPlayerDead, bOverride);
}
Vector CBasePlayer::GetAutoaimVector(float flDelta)
{
Vector vecSrc;

View File

@ -421,6 +421,7 @@ public:
bool CanSwitchTeam_OrigFunc(TeamName teamToSwap);
void SetSpawnProtection_OrigFunc(float flProtectionTime);
void RemoveSpawnProtection_OrigFunc();
bool HintMessageEx_OrigFunc(const char *pMessage, float duration = 6.0f, bool bDisplayIfPlayerDead = false, bool bOverride = false);
CCSPlayer *CSPlayer() const;
#endif // REGAMEDLL_API
@ -510,6 +511,7 @@ public:
CBaseEntity *GiveNamedItemEx(const char *pszName);
void EnableControl(BOOL fControl);
bool HintMessage(const char *pMessage, BOOL bDisplayIfPlayerDead = FALSE, BOOL bOverride = FALSE);
bool HintMessageEx(const char *pMessage, float duration = 6.0f, bool bDisplayIfPlayerDead = false, bool bOverride = false);
void SendAmmoUpdate();
void SendFOV(int fov);
void WaterMove();

View File

@ -82,6 +82,7 @@ public:
virtual bool RemovePlayerItemEx(const char* pszItemName, bool bRemoveAmmo);
virtual void SetSpawnProtection(float flProtectionTime);
virtual void RemoveSpawnProtection();
virtual bool HintMessageEx(const char *pMessage, float duration = 6.0f, bool bDisplayIfPlayerDead = false, bool bOverride = false);
CBasePlayer *BasePlayer() const;

View File

@ -38,7 +38,7 @@
#include <API/CSInterfaces.h>
#define REGAMEDLL_API_VERSION_MAJOR 5
#define REGAMEDLL_API_VERSION_MINOR 8
#define REGAMEDLL_API_VERSION_MINOR 9
// CBasePlayer::Spawn hook
typedef IHookChainClass<void, class CBasePlayer> IReGameHook_CBasePlayer_Spawn;
@ -436,6 +436,10 @@ typedef IHookChainRegistryClass<void, class CBasePlayer> IReGameHookRegistry_CBa
typedef IHookChain<bool, Vector &, Vector &, entvars_t *, edict_t *> IReGameHook_IsPenetrableEntity;
typedef IHookChainRegistry<bool, Vector &, Vector &, entvars_t *, edict_t *> IReGameHookRegistry_IsPenetrableEntity;
// CBasePlayer::HintMessageEx hook
typedef IHookChainClass<bool, class CBasePlayer, const char *, float, bool, bool> IReGameHook_CBasePlayer_HintMessageEx;
typedef IHookChainRegistryClass<bool, class CBasePlayer, const char *, float, bool, bool> IReGameHookRegistry_CBasePlayer_HintMessageEx;
class IReGameHookchains {
public:
virtual ~IReGameHookchains() {}
@ -544,6 +548,7 @@ public:
virtual IReGameHookRegistry_CBasePlayer_RemoveSpawnProtection *CBasePlayer_RemoveSpawnProtection() = 0;
virtual IReGameHookRegistry_CBasePlayer_SetSpawnProtection *CBasePlayer_SetSpawnProtection() = 0;
virtual IReGameHookRegistry_IsPenetrableEntity *IsPenetrableEntity() = 0;
virtual IReGameHookRegistry_CBasePlayer_HintMessageEx *CBasePlayer_HintMessageEx() = 0;
};
struct ReGameFuncs_t {