2
0
mirror of https://github.com/rehlds/reapi.git synced 2025-01-29 23:17:57 +03:00

Add new natives RG_CBasePlayerItem_Materialize, RG_CBasePlayerItem_CheckRespawn

This commit is contained in:
Celio Lozatto 2024-08-15 12:42:13 -03:00
parent 8f9e7c16cb
commit 25bdd34b95
7 changed files with 79 additions and 1 deletions

View File

@ -26,7 +26,8 @@ enum hooks_tables_e
ht_weapon, ht_weapon,
ht_gib, ht_gib,
ht_cbaseentity, ht_cbaseentity,
ht_botmanager ht_botmanager,
ht_cbaseplayeritem
}; };
enum members_tables_e enum members_tables_e

View File

@ -942,6 +942,24 @@ enum GamedllFunc_CBasePlayer
RG_CBasePlayer_RemoveAllItems, RG_CBasePlayer_RemoveAllItems,
}; };
/**
* GamedllFunc CBasePlayerItem
*/
enum GamedllFunc_CBasePlayerItem
{
/*
* Description: -
* Params: (const this)
*/
RG_CBasePlayerItem_Materialize = BEGIN_FUNC_REGION(cbaseplayeritem),
/*
* Description: -
* Params: (const this)
*/
RG_CBasePlayerItem_CheckRespawn,
}
/** /**
* GamedllFunc CBasePlayer * GamedllFunc CBasePlayer
*/ */

View File

@ -630,6 +630,15 @@ typedef IHookChainRegistryClass<void, class CBasePlayer> IReGameHookRegistry_CBa
typedef IHookChainClass<void, class CBasePlayer, BOOL> IReGameHook_CBasePlayer_RemoveAllItems; typedef IHookChainClass<void, class CBasePlayer, BOOL> IReGameHook_CBasePlayer_RemoveAllItems;
typedef IHookChainRegistryClass<void, class CBasePlayer, BOOL> IReGameHookRegistry_CBasePlayer_RemoveAllItems; typedef IHookChainRegistryClass<void, class CBasePlayer, BOOL> IReGameHookRegistry_CBasePlayer_RemoveAllItems;
// CBasePlayerItem::Materialize hook
typedef IHookChainClass<void, class CBasePlayerItem> IReGameHook_CBasePlayerItem_Materialize;
typedef IHookChainRegistryClass<void, class CBasePlayerItem> IReGameHookRegistry_CBasePlayerItem_Materialize;
// CBasePlayerItem::CheckRespawn hook
typedef IHookChainClass<void, class CBasePlayerItem> IReGameHook_CBasePlayerItem_CheckRespawn;
typedef IHookChainRegistryClass<void, class CBasePlayerItem> IReGameHookRegistry_CBasePlayerItem_CheckRespawn;
class IReGameHookchains { class IReGameHookchains {
public: public:
virtual ~IReGameHookchains() {} virtual ~IReGameHookchains() {}
@ -792,6 +801,9 @@ 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; virtual IReGameHookRegistry_CBasePlayer_RemoveAllItems *CBasePlayer_RemoveAllItems() = 0;
virtual IReGameHookRegistry_CBasePlayerItem_Materialize *CBasePlayerItem_Materialize() = 0;
virtual IReGameHookRegistry_CBasePlayerItem_CheckRespawn *CBasePlayerItem_CheckRespawn() = 0;
}; };
struct ReGameFuncs_t { struct ReGameFuncs_t {

View File

@ -1766,6 +1766,28 @@ void CSGameRules_SendDeathMessage(IReGameHook_CSGameRules_SendDeathMessage *chai
callVoidForward(RG_CSGameRules_SendDeathMessage, original, indexOfPDataAmx(pKiller), indexOfEdict(pVictim->pev), indexOfPDataAmx(pAssister), indexOfEdictAmx(pevInflictor), killerWeaponName, iDeathMessageFlags, iRarityOfKill); callVoidForward(RG_CSGameRules_SendDeathMessage, original, indexOfPDataAmx(pKiller), indexOfEdict(pVictim->pev), indexOfPDataAmx(pAssister), indexOfEdictAmx(pevInflictor), killerWeaponName, iDeathMessageFlags, iRarityOfKill);
} }
void CBasePlayerItem_Materialize(IReGameHook_CBasePlayerItem_Materialize *chain, CBasePlayerItem *pthis)
{
auto original = [chain](int _pthis)
{
chain->callNext(getPrivate<CBasePlayerItem>(_pthis));
};
callVoidForward(RG_CBasePlayerItem_Materialize, original, indexOfEdict(pthis->pev));
}
void CBasePlayerItem_CheckRespawn(IReGameHook_CBasePlayerItem_CheckRespawn *chain, CBasePlayerItem *pthis)
{
auto original = [chain](int _pthis)
{
chain->callNext(getPrivate<CBasePlayerItem>(_pthis));
};
callVoidForward(RG_CBasePlayerItem_CheckRespawn, original, indexOfEdict(pthis->pev));
}
/* /*
* VTC functions * VTC functions
*/ */

View File

@ -566,6 +566,8 @@ void CBasePlayer_PlayerDeathThink(IReGameHook_CBasePlayer_PlayerDeathThink *chai
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); void CBasePlayer_RemoveAllItems(IReGameHook_CBasePlayer_RemoveAllItems *chain, CBasePlayer *pthis, BOOL removeSuit);
void CSGameRules_SendDeathMessage(IReGameHook_CSGameRules_SendDeathMessage *chain, CBaseEntity *pKiller, CBasePlayer *pVictim, CBasePlayer *pAssister, entvars_t *pevInflictor, const char *killerWeaponName, int iDeathMessageFlags, int iRarityOfKill); void CSGameRules_SendDeathMessage(IReGameHook_CSGameRules_SendDeathMessage *chain, CBaseEntity *pKiller, CBasePlayer *pVictim, CBasePlayer *pAssister, entvars_t *pevInflictor, const char *killerWeaponName, int iDeathMessageFlags, int iRarityOfKill);
void CBasePlayerItem_Materialize(IReGameHook_CBasePlayerItem_Materialize *chain, CBasePlayerItem *pthis);
void CBasePlayerItem_CheckRespawn(IReGameHook_CBasePlayerItem_CheckRespawn *chain, CBasePlayerItem *pthis);
/* /*
* VTC functions * VTC functions

View File

@ -216,6 +216,7 @@ hook_t hooklist_player[] = {
DLL(CBasePlayer_PlayerDeathThink), DLL(CBasePlayer_PlayerDeathThink),
DLL(CBasePlayer_Observer_Think), DLL(CBasePlayer_Observer_Think),
DLL(CBasePlayer_RemoveAllItems), DLL(CBasePlayer_RemoveAllItems),
}; };
hook_t hooklist_gamerules[] = { hook_t hooklist_gamerules[] = {
@ -289,6 +290,14 @@ hook_t hooklist_botmanager[] = {
DLL(CBotManager_OnEvent), DLL(CBotManager_OnEvent),
}; };
hook_t hooklist_cbaseplayeritem[] = {
DLL(CBasePlayerItem_Materialize),
DLL(CBasePlayerItem_CheckRespawn),
};
#define RCHECK(h,...) { {}, {}, #h, "ReChecker", [](){ return api_cfg.hasRechecker(); }, ((!(RC_##h & (MAX_REGION_RANGE - 1)) ? regfunc::current_cell = 1, true : false) || (RC_##h & (MAX_REGION_RANGE - 1)) == regfunc::current_cell++) ? regfunc(h##__VA_ARGS__) : regfunc(#h#__VA_ARGS__), [](){ g_RecheckerHookchains->h()->registerHook(&h); }, [](){ g_RecheckerHookchains->h()->unregisterHook(&h); }, false} #define RCHECK(h,...) { {}, {}, #h, "ReChecker", [](){ return api_cfg.hasRechecker(); }, ((!(RC_##h & (MAX_REGION_RANGE - 1)) ? regfunc::current_cell = 1, true : false) || (RC_##h & (MAX_REGION_RANGE - 1)) == regfunc::current_cell++) ? regfunc(h##__VA_ARGS__) : regfunc(#h#__VA_ARGS__), [](){ g_RecheckerHookchains->h()->registerHook(&h); }, [](){ g_RecheckerHookchains->h()->unregisterHook(&h); }, false}
hook_t hooklist_rechecker[] = { hook_t hooklist_rechecker[] = {
RCHECK(FileConsistencyProcess, _AMXX), RCHECK(FileConsistencyProcess, _AMXX),
@ -316,6 +325,7 @@ hook_t* hooklist_t::getHookSafe(size_t hook)
CASE(gib) CASE(gib)
CASE(cbaseentity) CASE(cbaseentity)
CASE(botmanager) CASE(botmanager)
CASE(cbaseplayeritem)
} }
return nullptr; return nullptr;
@ -337,6 +347,7 @@ void hooklist_t::clear()
FOREACH_CLEAR(gib); FOREACH_CLEAR(gib);
FOREACH_CLEAR(cbaseentity); FOREACH_CLEAR(cbaseentity);
FOREACH_CLEAR(botmanager); FOREACH_CLEAR(botmanager);
FOREACH_CLEAR(cbaseplayeritem);
} }
void hook_t::clear() void hook_t::clear()

View File

@ -39,6 +39,7 @@ extern hook_t hooklist_weapon[];
extern hook_t hooklist_gib[]; extern hook_t hooklist_gib[];
extern hook_t hooklist_cbaseentity[]; extern hook_t hooklist_cbaseentity[];
extern hook_t hooklist_botmanager[]; extern hook_t hooklist_botmanager[];
extern hook_t hooklist_cbaseplayeritem[];
enum enum
{ {
@ -67,6 +68,7 @@ struct hooklist_t
CASE(gib) CASE(gib)
CASE(cbaseentity) CASE(cbaseentity)
CASE(botmanager) CASE(botmanager)
CASE(cbaseplayeritem)
} }
#undef CASE #undef CASE
@ -91,6 +93,7 @@ struct hooklist_t
ht_gib, ht_gib,
ht_cbaseentity, ht_cbaseentity,
ht_botmanager, ht_botmanager,
ht_cbaseplayeritem,
}; };
}; };
@ -345,3 +348,12 @@ enum ReCheckerFunc
// [...] // [...]
}; };
enum GamedllFunc_CBasePlayerItem
{
RG_CBasePlayerItem_Materialize = BEGIN_FUNC_REGION(cbaseplayeritem),
RG_CBasePlayerItem_CheckRespawn,
// [...]
};