diff --git a/gradle.properties b/gradle.properties index 1507d1f..6e26c9d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ majorVersion=5 -minorVersion=9 +minorVersion=10 maintenanceVersion=0 diff --git a/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc b/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc index 55a3b05..a233684 100644 --- a/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc +++ b/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc @@ -754,6 +754,13 @@ enum GamedllFunc_CBasePlayer * Params: (const this, const message[], Float:duration, bool:bDisplayIfPlayerDead, bool:bOverride) */ RG_CBasePlayer_HintMessageEx, + + /* + * Description: Called when a player press use and if a suitable candidate is not found. + * Return type: void + * Params: (const this) + */ + RG_CBasePlayer_UseEmpty, }; /** diff --git a/reapi/include/cssdk/dlls/API/CSPlayer.h b/reapi/include/cssdk/dlls/API/CSPlayer.h index debe0bc..4beee57 100644 --- a/reapi/include/cssdk/dlls/API/CSPlayer.h +++ b/reapi/include/cssdk/dlls/API/CSPlayer.h @@ -80,7 +80,7 @@ public: virtual void ResetSequenceInfo(); virtual void StartDeathCam(); virtual bool RemovePlayerItemEx(const char* pszItemName, bool bRemoveAmmo); - virtual void SetSpawnProtection(float flProtectionTime); + virtual void SetSpawnProtection(float flProtectionTime); virtual void RemoveSpawnProtection(); virtual bool HintMessageEx(const char *pMessage, float duration = 6.0f, bool bDisplayIfPlayerDead = false, bool bOverride = false); diff --git a/reapi/include/cssdk/dlls/regamedll_api.h b/reapi/include/cssdk/dlls/regamedll_api.h index cd258ab..2616ef8 100644 --- a/reapi/include/cssdk/dlls/regamedll_api.h +++ b/reapi/include/cssdk/dlls/regamedll_api.h @@ -38,7 +38,7 @@ #include #define REGAMEDLL_API_VERSION_MAJOR 5 -#define REGAMEDLL_API_VERSION_MINOR 9 +#define REGAMEDLL_API_VERSION_MINOR 10 // CBasePlayer::Spawn hook typedef IHookChainClass IReGameHook_CBasePlayer_Spawn; @@ -440,6 +440,10 @@ typedef IHookChainRegistry IRe typedef IHookChainClass IReGameHook_CBasePlayer_HintMessageEx; typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_HintMessageEx; +// CBasePlayer::UseEmpty hook +typedef IHookChainClass IReGameHook_CBasePlayer_UseEmpty; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_UseEmpty; + class IReGameHookchains { public: virtual ~IReGameHookchains() {} @@ -549,6 +553,7 @@ public: virtual IReGameHookRegistry_CBasePlayer_SetSpawnProtection *CBasePlayer_SetSpawnProtection() = 0; virtual IReGameHookRegistry_IsPenetrableEntity *IsPenetrableEntity() = 0; virtual IReGameHookRegistry_CBasePlayer_HintMessageEx *CBasePlayer_HintMessageEx() = 0; + virtual IReGameHookRegistry_CBasePlayer_UseEmpty *CBasePlayer_UseEmpty() = 0; }; struct ReGameFuncs_t { diff --git a/reapi/src/hook_callback.cpp b/reapi/src/hook_callback.cpp index bde510d..dfbabfe 100644 --- a/reapi/src/hook_callback.cpp +++ b/reapi/src/hook_callback.cpp @@ -542,6 +542,16 @@ bool CBasePlayer_HintMessageEx(IReGameHook_CBasePlayer_HintMessageEx *chain, CBa return callForward(RG_CBasePlayer_HintMessageEx, original, indexOfEdict(pthis->pev), pMessage, duration, bDisplayIfPlayerDead, bOverride); } +void CBasePlayer_UseEmpty(IReGameHook_CBasePlayer_UseEmpty *chain, CBasePlayer *pthis) +{ + auto original = [chain](int _pthis) + { + return chain->callNext(getPrivate(_pthis)); + }; + + callVoidForward(RG_CBasePlayer_UseEmpty, original, indexOfEdict(pthis->pev)); +} + void CBaseAnimating_ResetSequenceInfo(IReGameHook_CBaseAnimating_ResetSequenceInfo *chain, CBaseAnimating *pthis) { auto original = [chain](int _pthis) diff --git a/reapi/src/hook_callback.h b/reapi/src/hook_callback.h index 8cdc86f..47edb7b 100644 --- a/reapi/src/hook_callback.h +++ b/reapi/src/hook_callback.h @@ -376,6 +376,7 @@ CGrenade *CBasePlayer_ThrowGrenade(IReGameHook_CBasePlayer_ThrowGrenade *chain, void CBasePlayer_SetSpawnProtection(IReGameHook_CBasePlayer_SetSpawnProtection *chain, CBasePlayer *pthis, float flProtectionTime); void CBasePlayer_RemoveSpawnProtection(IReGameHook_CBasePlayer_RemoveSpawnProtection *chain, CBasePlayer *pthis); bool CBasePlayer_HintMessageEx(IReGameHook_CBasePlayer_HintMessageEx *chain, CBasePlayer *pthis, const char *pMessage, float duration, bool bDisplayIfPlayerDead, bool bOverride); +void CBasePlayer_UseEmpty(IReGameHook_CBasePlayer_UseEmpty *chain, CBasePlayer *pthis); void CBaseAnimating_ResetSequenceInfo(IReGameHook_CBaseAnimating_ResetSequenceInfo *chain, CBaseAnimating *pthis); diff --git a/reapi/src/hook_list.cpp b/reapi/src/hook_list.cpp index 33fcbca..57ed234 100644 --- a/reapi/src/hook_list.cpp +++ b/reapi/src/hook_list.cpp @@ -154,6 +154,7 @@ hook_t hooklist_player[] = { DLL(CBasePlayer_SetSpawnProtection), DLL(CBasePlayer_RemoveSpawnProtection), DLL(CBasePlayer_HintMessageEx), + DLL(CBasePlayer_UseEmpty), }; hook_t hooklist_gamerules[] = { diff --git a/reapi/src/hook_list.h b/reapi/src/hook_list.h index a8b2932..7abcc69 100644 --- a/reapi/src/hook_list.h +++ b/reapi/src/hook_list.h @@ -176,6 +176,7 @@ enum GamedllFunc_CBasePlayer RG_CBasePlayer_SetSpawnProtection, RG_CBasePlayer_RemoveSpawnProtection, RG_CBasePlayer_HintMessageEx, + RG_CBasePlayer_UseEmpty, // [...] };