mirror of
https://github.com/rehlds/reapi.git
synced 2025-03-13 05:50:16 +03:00
Implement player Pain
, DeathSound
and JoiningThink
hooks (#209)
* Implement player Pain, DeathSound and JoiningThink hooks * fix descriptions Co-authored-by: Sergey Shorokhov <wopox1337@ya.ru>
This commit is contained in:
parent
cfeb51fff6
commit
6063144a31
@ -784,6 +784,28 @@ enum GamedllFunc_CBasePlayer
|
||||
* Params: (const this, const reason[])
|
||||
*/
|
||||
RG_CBasePlayer_DropIdlePlayer,
|
||||
|
||||
/*
|
||||
* Description: Called when a client emits a "pain sound" after received damage.
|
||||
* Return type: void
|
||||
* Params: (const this)
|
||||
*/
|
||||
RG_CBasePlayer_Pain,
|
||||
|
||||
/*
|
||||
* Description: Called when a client emits a "death sound" after death.
|
||||
* Return type: void
|
||||
* Params: (const this, lastHitGroup, bool:hasArmour)
|
||||
*/
|
||||
RG_CBasePlayer_DeathSound,
|
||||
|
||||
/*
|
||||
* Description: Called when a client "thinks for the join status".
|
||||
* (permanently called on each call of "CBasePlayer::PreThink", and only when he is not assigned as specatator or not playing)
|
||||
* Return type: void
|
||||
* Params: (const this)
|
||||
*/
|
||||
RG_CBasePlayer_JoiningThink,
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -39,7 +39,7 @@
|
||||
#include <API/CSInterfaces.h>
|
||||
|
||||
#define REGAMEDLL_API_VERSION_MAJOR 5
|
||||
#define REGAMEDLL_API_VERSION_MINOR 20
|
||||
#define REGAMEDLL_API_VERSION_MINOR 21
|
||||
|
||||
// CBasePlayer::Spawn hook
|
||||
typedef IHookChainClass<void, class CBasePlayer> IReGameHook_CBasePlayer_Spawn;
|
||||
@ -462,8 +462,8 @@ typedef IHookChainClass<bool, class CBasePlayerWeapon, int, int, float, float, c
|
||||
typedef IHookChainRegistryClass<bool, class CBasePlayerWeapon, int, int, float, float, const char *, const char *> IReGameHookRegistry_CBasePlayerWeapon_DefaultShotgunReload;
|
||||
|
||||
// CBasePlayer::DropIdlePlayer hook
|
||||
typedef IHookChainClass<void, CBasePlayer, const char *> IReGameHook_CBasePlayer_DropIdlePlayer;
|
||||
typedef IHookChainRegistryClass<void, CBasePlayer, const char *> IReGameHookRegistry_CBasePlayer_DropIdlePlayer;
|
||||
typedef IHookChainClass<void, class CBasePlayer, const char *> IReGameHook_CBasePlayer_DropIdlePlayer;
|
||||
typedef IHookChainRegistryClass<void, class CBasePlayer, const char *> IReGameHookRegistry_CBasePlayer_DropIdlePlayer;
|
||||
|
||||
// CreateWeaponBox hook
|
||||
typedef IHookChain<class CWeaponBox *, class CBasePlayerItem *, class CBasePlayer *, const char *, Vector &, Vector &, Vector &, float, bool> IReGameHook_CreateWeaponBox;
|
||||
@ -490,17 +490,28 @@ typedef IHookChainClass<void, class CGib> IReGameHook_CGib_WaitTillLand;
|
||||
typedef IHookChainRegistryClass<void, class CGib> IReGameHookRegistry_CGib_WaitTillLand;
|
||||
|
||||
// CBaseEntity::FireBullets hook
|
||||
typedef IHookChainClass<void, class CBaseEntity, ULONG, Vector&, Vector&, Vector&, float, int, int, int, entvars_t*> IReGameHook_CBaseEntity_FireBullets;
|
||||
typedef IHookChainRegistryClass<void, class CBaseEntity, ULONG, Vector&, Vector&, Vector&, float, int, int, int, entvars_t*> IReGameHookRegistry_CBaseEntity_FireBullets;
|
||||
typedef IHookChainClass<void, class CBaseEntity, ULONG, Vector &, Vector &, Vector &, float, int, int, int, entvars_t *> IReGameHook_CBaseEntity_FireBullets;
|
||||
typedef IHookChainRegistryClass<void, class CBaseEntity, ULONG, Vector &, Vector &, Vector &, float, int, int, int, entvars_t *> IReGameHookRegistry_CBaseEntity_FireBullets;
|
||||
|
||||
// CBaseEntity::FireBuckshots hook
|
||||
typedef IHookChainClass<void, class CBaseEntity, ULONG, Vector&, Vector&, Vector&, float, int, int, entvars_t*> IReGameHook_CBaseEntity_FireBuckshots;
|
||||
typedef IHookChainRegistryClass<void, class CBaseEntity, ULONG, Vector&, Vector&, Vector&, float, int, int, entvars_t*> IReGameHookRegistry_CBaseEntity_FireBuckshots;
|
||||
typedef IHookChainClass<void, class CBaseEntity, ULONG, Vector &, Vector &, Vector &, float, int, int, entvars_t *> IReGameHook_CBaseEntity_FireBuckshots;
|
||||
typedef IHookChainRegistryClass<void, class CBaseEntity, ULONG, Vector &, Vector &, Vector &, float, int, int, entvars_t *> IReGameHookRegistry_CBaseEntity_FireBuckshots;
|
||||
|
||||
// CBaseEntity::FireBullets3 hook
|
||||
typedef IHookChainClass<Vector&, class CBaseEntity, Vector&, Vector&, float, float, int, int, int, float, entvars_t*, bool, int> IReGameHook_CBaseEntity_FireBullets3;
|
||||
typedef IHookChainRegistryClass<Vector&, class CBaseEntity, Vector&, Vector&, float, float, int, int, int, float, entvars_t*, bool, int> IReGameHookRegistry_CBaseEntity_FireBullets3;
|
||||
typedef IHookChainClass<Vector &, class CBaseEntity, Vector &, Vector &, float, float, int, int, int, float, entvars_t *, bool, int> IReGameHook_CBaseEntity_FireBullets3;
|
||||
typedef IHookChainRegistryClass<Vector &, class CBaseEntity, Vector &, Vector &, float, float, int, int, int, float, entvars_t *, bool, int> IReGameHookRegistry_CBaseEntity_FireBullets3;
|
||||
|
||||
// CBasePlayer::Pain hook
|
||||
typedef IHookChainClass<void, class CBasePlayer, int, bool> IReGameHook_CBasePlayer_Pain;
|
||||
typedef IHookChainRegistryClass<void, class CBasePlayer, int, bool> IReGameHookRegistry_CBasePlayer_Pain;
|
||||
|
||||
// CBasePlayer::DeathSound hook
|
||||
typedef IHookChainClass<void, class CBasePlayer> IReGameHook_CBasePlayer_DeathSound;
|
||||
typedef IHookChainRegistryClass<void, class CBasePlayer> IReGameHookRegistry_CBasePlayer_DeathSound;
|
||||
|
||||
// CBasePlayer::JoiningThink hook
|
||||
typedef IHookChainClass<void, class CBasePlayer> IReGameHook_CBasePlayer_JoiningThink;
|
||||
typedef IHookChainRegistryClass<void, class CBasePlayer> IReGameHookRegistry_CBasePlayer_JoiningThink;
|
||||
|
||||
class IReGameHookchains {
|
||||
public:
|
||||
@ -628,6 +639,10 @@ public:
|
||||
virtual IReGameHookRegistry_CBaseEntity_FireBullets *CBaseEntity_FireBullets() = 0;
|
||||
virtual IReGameHookRegistry_CBaseEntity_FireBuckshots *CBaseEntity_FireBuckshots() = 0;
|
||||
virtual IReGameHookRegistry_CBaseEntity_FireBullets3 *CBaseEntity_FireBullets3() = 0;
|
||||
|
||||
virtual IReGameHookRegistry_CBasePlayer_Pain *CBasePlayer_Pain() = 0;
|
||||
virtual IReGameHookRegistry_CBasePlayer_DeathSound *CBasePlayer_DeathSound() = 0;
|
||||
virtual IReGameHookRegistry_CBasePlayer_JoiningThink *CBasePlayer_JoiningThink() = 0;
|
||||
};
|
||||
|
||||
struct ReGameFuncs_t {
|
||||
|
@ -562,6 +562,36 @@ void CBasePlayer_DropIdlePlayer(IReGameHook_CBasePlayer_DropIdlePlayer *chain, C
|
||||
callVoidForward(RG_CBasePlayer_DropIdlePlayer, original, indexOfEdict(pthis->pev), reason);
|
||||
}
|
||||
|
||||
void CBasePlayer_Pain(IReGameHook_CBasePlayer_Pain *chain, CBasePlayer *pthis, int iLastHitGroup, bool bHasArmour)
|
||||
{
|
||||
auto original = [chain](int _pthis, int _iLastHitGroup, bool _bHasArmour)
|
||||
{
|
||||
return chain->callNext(getPrivate<CBasePlayer>(_pthis), _iLastHitGroup, _bHasArmour);
|
||||
};
|
||||
|
||||
callVoidForward(RG_CBasePlayer_Pain, original, indexOfEdict(pthis->pev), iLastHitGroup, bHasArmour);
|
||||
}
|
||||
|
||||
void CBasePlayer_DeathSound(IReGameHook_CBasePlayer_DeathSound *chain, CBasePlayer *pthis)
|
||||
{
|
||||
auto original = [chain](int _pthis)
|
||||
{
|
||||
return chain->callNext(getPrivate<CBasePlayer>(_pthis));
|
||||
};
|
||||
|
||||
callVoidForward(RG_CBasePlayer_DeathSound, original, indexOfEdict(pthis->pev));
|
||||
}
|
||||
|
||||
void CBasePlayer_JoiningThink(IReGameHook_CBasePlayer_JoiningThink *chain, CBasePlayer *pthis)
|
||||
{
|
||||
auto original = [chain](int _pthis)
|
||||
{
|
||||
return chain->callNext(getPrivate<CBasePlayer>(_pthis));
|
||||
};
|
||||
|
||||
callVoidForward(RG_CBasePlayer_JoiningThink, original, indexOfEdict(pthis->pev));
|
||||
}
|
||||
|
||||
void CBaseAnimating_ResetSequenceInfo(IReGameHook_CBaseAnimating_ResetSequenceInfo *chain, CBaseAnimating *pthis)
|
||||
{
|
||||
auto original = [chain](int _pthis)
|
||||
|
@ -428,6 +428,9 @@ void CBasePlayer_RemoveSpawnProtection(IReGameHook_CBasePlayer_RemoveSpawnProtec
|
||||
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 CBasePlayer_DropIdlePlayer(IReGameHook_CBasePlayer_DropIdlePlayer *chain, CBasePlayer *pthis, const char *reason);
|
||||
void CBasePlayer_Pain(IReGameHook_CBasePlayer_Pain *chain, CBasePlayer *pthis, int iLastHitGroup, bool bHasArmour);
|
||||
void CBasePlayer_DeathSound(IReGameHook_CBasePlayer_DeathSound *chain, CBasePlayer *pthis);
|
||||
void CBasePlayer_JoiningThink(IReGameHook_CBasePlayer_JoiningThink *chain, CBasePlayer *pthis);
|
||||
|
||||
void CBaseAnimating_ResetSequenceInfo(IReGameHook_CBaseAnimating_ResetSequenceInfo *chain, CBaseAnimating *pthis);
|
||||
|
||||
|
@ -167,6 +167,9 @@ hook_t hooklist_player[] = {
|
||||
DLL(CBasePlayer_HintMessageEx),
|
||||
DLL(CBasePlayer_UseEmpty),
|
||||
DLL(CBasePlayer_DropIdlePlayer),
|
||||
DLL(CBasePlayer_Pain),
|
||||
DLL(CBasePlayer_DeathSound),
|
||||
DLL(CBasePlayer_JoiningThink),
|
||||
};
|
||||
|
||||
hook_t hooklist_gamerules[] = {
|
||||
|
@ -192,6 +192,9 @@ enum GamedllFunc_CBasePlayer
|
||||
RG_CBasePlayer_HintMessageEx,
|
||||
RG_CBasePlayer_UseEmpty,
|
||||
RG_CBasePlayer_DropIdlePlayer,
|
||||
RG_CBasePlayer_Pain,
|
||||
RG_CBasePlayer_DeathSound,
|
||||
RG_CBasePlayer_JoiningThink,
|
||||
|
||||
// [...]
|
||||
};
|
||||
|
@ -6,5 +6,5 @@
|
||||
#pragma once
|
||||
|
||||
#define VERSION_MAJOR 5
|
||||
#define VERSION_MINOR 19
|
||||
#define VERSION_MINOR 20
|
||||
#define VERSION_MAINTENANCE 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user