2
0
mirror of https://github.com/rehlds/reapi.git synced 2024-12-29 08:05:36 +03:00

Implement RG_CBasePlayer_RemoveAllItems hook (#310)

* Implement RG_CBasePlayer_RemoveAllItems hook
This commit is contained in:
Javekson 2024-05-08 12:48:03 +04:00 committed by GitHub
parent a7043d1103
commit 1dcc1ca3fb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 27 additions and 4 deletions

View File

@ -934,6 +934,12 @@ enum GamedllFunc_CBasePlayer
* Params: (const this) * Params: (const this)
*/ */
RG_CBasePlayer_Observer_Think, RG_CBasePlayer_Observer_Think,
/*
* Description: -
* Params: (const this, bool:removeSuit)
*/
RG_CBasePlayer_RemoveAllItems,
}; };
/** /**

View File

@ -40,7 +40,7 @@
#include <API/CSInterfaces.h> #include <API/CSInterfaces.h>
#define REGAMEDLL_API_VERSION_MAJOR 5 #define REGAMEDLL_API_VERSION_MAJOR 5
#define REGAMEDLL_API_VERSION_MINOR 22 #define REGAMEDLL_API_VERSION_MINOR 27
// CBasePlayer::Spawn hook // CBasePlayer::Spawn hook
typedef IHookChainClass<void, class CBasePlayer> IReGameHook_CBasePlayer_Spawn; typedef IHookChainClass<void, class CBasePlayer> IReGameHook_CBasePlayer_Spawn;
@ -626,6 +626,10 @@ typedef IHookChainRegistryClass<void, class CBasePlayer> IReGameHookRegistry_CBa
typedef IHookChainClass<void, class CBasePlayer> IReGameHook_CBasePlayer_Observer_Think; typedef IHookChainClass<void, class CBasePlayer> IReGameHook_CBasePlayer_Observer_Think;
typedef IHookChainRegistryClass<void, class CBasePlayer> IReGameHookRegistry_CBasePlayer_Observer_Think; typedef IHookChainRegistryClass<void, class CBasePlayer> IReGameHookRegistry_CBasePlayer_Observer_Think;
// CBasePlayer::RemoveAllItems hook
typedef IHookChainClass<void, class CBasePlayer, BOOL> IReGameHook_CBasePlayer_RemoveAllItems;
typedef IHookChainRegistryClass<void, class CBasePlayer, BOOL> IReGameHookRegistry_CBasePlayer_RemoveAllItems;
class IReGameHookchains { class IReGameHookchains {
public: public:
virtual ~IReGameHookchains() {} virtual ~IReGameHookchains() {}
@ -787,7 +791,7 @@ public:
virtual IReGameHookRegistry_CBasePlayer_PlayerDeathThink *CBasePlayer_PlayerDeathThink() = 0; virtual IReGameHookRegistry_CBasePlayer_PlayerDeathThink *CBasePlayer_PlayerDeathThink() = 0;
virtual IReGameHookRegistry_CBasePlayer_Observer_Think *CBasePlayer_Observer_Think() = 0; virtual IReGameHookRegistry_CBasePlayer_Observer_Think *CBasePlayer_Observer_Think() = 0;
virtual IReGameHookRegistry_CBasePlayer_RemoveAllItems *CBasePlayer_RemoveAllItems() = 0;
}; };
struct ReGameFuncs_t { struct ReGameFuncs_t {

View File

@ -1730,6 +1730,16 @@ void CBasePlayer_Observer_Think(IReGameHook_CBasePlayer_Observer_Think *chain, C
callVoidForward(RG_CBasePlayer_Observer_Think, original, indexOfEdict(pthis->pev)); callVoidForward(RG_CBasePlayer_Observer_Think, original, indexOfEdict(pthis->pev));
} }
void CBasePlayer_RemoveAllItems(IReGameHook_CBasePlayer_RemoveAllItems *chain, CBasePlayer *pthis, BOOL removeSuit)
{
auto original = [chain](int _pthis, BOOL _removeSuit)
{
chain->callNext(getPrivate<CBasePlayer>(_pthis), _removeSuit);
};
callVoidForward(RG_CBasePlayer_RemoveAllItems, original, indexOfEdict(pthis->pev), removeSuit);
}
/* /*
* VTC functions * VTC functions
*/ */

View File

@ -560,6 +560,7 @@ void CBasePlayerWeapon_KickBack(IReGameHook_CBasePlayerWeapon_KickBack *chain, C
void CBasePlayerWeapon_SendWeaponAnim(IReGameHook_CBasePlayerWeapon_SendWeaponAnim *chain, CBasePlayerWeapon *pthis, int iAnim, int skiplocal); void CBasePlayerWeapon_SendWeaponAnim(IReGameHook_CBasePlayerWeapon_SendWeaponAnim *chain, CBasePlayerWeapon *pthis, int iAnim, int skiplocal);
void CBasePlayer_PlayerDeathThink(IReGameHook_CBasePlayer_PlayerDeathThink *chain, CBasePlayer *pthis); void CBasePlayer_PlayerDeathThink(IReGameHook_CBasePlayer_PlayerDeathThink *chain, CBasePlayer *pthis);
void CBasePlayer_Observer_Think(IReGameHook_CBasePlayer_Observer_Think *chain, CBasePlayer *pthis); void CBasePlayer_Observer_Think(IReGameHook_CBasePlayer_Observer_Think *chain, CBasePlayer *pthis);
void CBasePlayer_RemoveAllItems(IReGameHook_CBasePlayer_RemoveAllItems *chain, CBasePlayer *pthis, BOOL removeSuit);
/* /*
* VTC functions * VTC functions

View File

@ -215,6 +215,7 @@ hook_t hooklist_player[] = {
DLL(CBasePlayer_PlayerDeathThink), DLL(CBasePlayer_PlayerDeathThink),
DLL(CBasePlayer_Observer_Think), DLL(CBasePlayer_Observer_Think),
DLL(CBasePlayer_RemoveAllItems),
}; };
hook_t hooklist_gamerules[] = { hook_t hooklist_gamerules[] = {

View File

@ -238,6 +238,7 @@ enum GamedllFunc_CBasePlayer
RG_CBasePlayer_PlayerDeathThink, RG_CBasePlayer_PlayerDeathThink,
RG_CBasePlayer_Observer_Think, RG_CBasePlayer_Observer_Think,
RG_CBasePlayer_RemoveAllItems,
// [...] // [...]
}; };

View File

@ -6,5 +6,5 @@
#pragma once #pragma once
#define VERSION_MAJOR 5 #define VERSION_MAJOR 5
#define VERSION_MINOR 24 #define VERSION_MINOR 25
#define VERSION_MAINTENANCE 0 #define VERSION_MAINTENANCE 0