2
0
mirror of https://github.com/rehlds/reapi.git synced 2024-12-28 07:35:31 +03:00

API: PlayerDeathThink and Observer_Think (#301)

This commit is contained in:
肯定龙 2024-01-31 08:46:19 -04:00 committed by GitHub
parent 16afeded60
commit 016a08a58a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 45 additions and 0 deletions

View File

@ -914,6 +914,18 @@ enum GamedllFunc_CBasePlayer
* Params: (const this)
*/
RG_CBasePlayer_EntSelectSpawnPoint,
/*
* Description: -
* Params: (const this)
*/
RG_CBasePlayer_PlayerDeathThink,
/*
* Description: -
* Params: (const this)
*/
RG_CBasePlayer_Observer_Think,
};
/**

View File

@ -622,6 +622,10 @@ typedef IHookChainRegistry<void, class CBaseEntity *, class CBasePlayer *, class
typedef IHookChainClass<void, class CBasePlayer> IReGameHook_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 {
public:
virtual ~IReGameHookchains() {}
@ -782,6 +786,8 @@ public:
virtual IReGameHookRegistry_CSGameRules_SendDeathMessage *CSGameRules_SendDeathMessage() = 0;
virtual IReGameHookRegistry_CBasePlayer_PlayerDeathThink *CBasePlayer_PlayerDeathThink() = 0;
virtual IReGameHookRegistry_CBasePlayer_Observer_Think *CBasePlayer_Observer_Think() = 0;
};
struct ReGameFuncs_t {

View File

@ -1710,6 +1710,25 @@ void CBasePlayerWeapon_SendWeaponAnim(IReGameHook_CBasePlayerWeapon_SendWeaponAn
callVoidForward(RG_CBasePlayerWeapon_SendWeaponAnim, original, indexOfEdict(pthis->pev), iAnim, skiplocal);
}
void CBasePlayer_PlayerDeathThink(IReGameHook_CBasePlayer_PlayerDeathThink *chain, CBasePlayer *pthis)
{
auto original = [chain](int _pthis)
{
chain->callNext(getPrivate<CBasePlayer>(_pthis));
};
callVoidForward(RG_CBasePlayer_PlayerDeathThink, original, indexOfEdict(pthis->pev));
}
void CBasePlayer_Observer_Think(IReGameHook_CBasePlayer_Observer_Think *chain, CBasePlayer *pthis)
{
auto original = [chain](int _pthis)
{
chain->callNext(getPrivate<CBasePlayer>(_pthis));
};
callVoidForward(RG_CBasePlayer_Observer_Think, original, indexOfEdict(pthis->pev));
}
/*
* VTC functions

View File

@ -558,6 +558,8 @@ edict_t *CBasePlayer_EntSelectSpawnPoint(IReGameHook_CBasePlayer_EntSelectSpawnP
void CBasePlayerWeapon_ItemPostFrame(IReGameHook_CBasePlayerWeapon_ItemPostFrame *chain, CBasePlayerWeapon *pthis);
void CBasePlayerWeapon_KickBack(IReGameHook_CBasePlayerWeapon_KickBack *chain, CBasePlayerWeapon *pthis, float up_base, float lateral_base, float up_modifier, float lateral_modifier, float up_max, float lateral_max, int direction_change);
void CBasePlayerWeapon_SendWeaponAnim(IReGameHook_CBasePlayerWeapon_SendWeaponAnim *chain, CBasePlayerWeapon *pthis, int iAnim, int skiplocal);
void CBasePlayer_PlayerDeathThink(IReGameHook_CBasePlayer_PlayerDeathThink *chain, CBasePlayer *pthis);
void CBasePlayer_Observer_Think(IReGameHook_CBasePlayer_Observer_Think *chain, CBasePlayer *pthis);
/*
* VTC functions

View File

@ -212,6 +212,9 @@ hook_t hooklist_player[] = {
DLL(CBasePlayer_CheckTimeBasedDamage),
DLL(CBasePlayer_EntSelectSpawnPoint),
DLL(CBasePlayer_PlayerDeathThink),
DLL(CBasePlayer_Observer_Think),
};
hook_t hooklist_gamerules[] = {

View File

@ -236,6 +236,9 @@ enum GamedllFunc_CBasePlayer
RG_CBasePlayer_CheckTimeBasedDamage,
RG_CBasePlayer_EntSelectSpawnPoint,
RG_CBasePlayer_PlayerDeathThink,
RG_CBasePlayer_Observer_Think,
// [...]
};