diff --git a/rehlds/engine/pr_cmds.cpp b/rehlds/engine/pr_cmds.cpp index dfd28468..ba21e601 100644 --- a/rehlds/engine/pr_cmds.cpp +++ b/rehlds/engine/pr_cmds.cpp @@ -2106,6 +2106,11 @@ sizebuf_t* EXT_FUNC WriteDest_Parm(int dest) } void EXT_FUNC PF_MessageBegin_I(int msg_dest, int msg_type, const float *pOrigin, edict_t *ed) +{ + g_RehldsHookchains.m_PF_MessageBegin_I.callChain(PF_MessageBegin_I_internal, msg_dest, msg_type, pOrigin, ed); +} + +void EXT_FUNC PF_MessageBegin_I_internal(int msg_dest, int msg_type, const float *pOrigin, edict_t *ed) { if (msg_dest == MSG_ONE || msg_dest == MSG_ONE_UNRELIABLE) { @@ -2147,6 +2152,11 @@ void EXT_FUNC PF_MessageBegin_I(int msg_dest, int msg_type, const float *pOrigin } void EXT_FUNC PF_MessageEnd_I(void) +{ + g_RehldsHookchains.m_PF_MessageEnd_I.callChain(PF_MessageEnd_I_internal); +} + +void EXT_FUNC PF_MessageEnd_I_internal(void) { qboolean MsgIsVarLength = 0; if (!gMsgStarted) @@ -2273,12 +2283,22 @@ void EXT_FUNC PF_MessageEnd_I(void) void EXT_FUNC PF_WriteByte_I(int iValue) { + g_RehldsHookchains.m_PF_WriteByte_I.callChain(PF_WriteByte_I_internal, iValue); +} + +void EXT_FUNC PF_WriteByte_I_internal(int iValue) +{ if (!gMsgStarted) Sys_Error("%s: called with no active message\n", __func__); MSG_WriteByte(&gMsgBuffer, iValue); } void EXT_FUNC PF_WriteChar_I(int iValue) +{ + g_RehldsHookchains.m_PF_WriteChar_I.callChain(PF_WriteChar_I_internal, iValue); +} + +void EXT_FUNC PF_WriteChar_I_internal(int iValue) { if (!gMsgStarted) Sys_Error("%s: called with no active message\n", __func__); @@ -2286,6 +2306,11 @@ void EXT_FUNC PF_WriteChar_I(int iValue) } void EXT_FUNC PF_WriteShort_I(int iValue) +{ + g_RehldsHookchains.m_PF_WriteShort_I.callChain(PF_WriteShort_I_internal, iValue); +} + +void EXT_FUNC PF_WriteShort_I_internal(int iValue) { if (!gMsgStarted) Sys_Error("%s: called with no active message\n", __func__); @@ -2293,6 +2318,11 @@ void EXT_FUNC PF_WriteShort_I(int iValue) } void EXT_FUNC PF_WriteLong_I(int iValue) +{ + g_RehldsHookchains.m_PF_WriteLong_I.callChain(PF_WriteLong_I_internal, iValue); +} + +void EXT_FUNC PF_WriteLong_I_internal(int iValue) { if (!gMsgStarted) Sys_Error("%s: called with no active message\n", __func__); @@ -2300,6 +2330,11 @@ void EXT_FUNC PF_WriteLong_I(int iValue) } void EXT_FUNC PF_WriteAngle_I(float flValue) +{ + g_RehldsHookchains.m_PF_WriteAngle_I.callChain(PF_WriteAngle_I_internal, flValue); +} + +void EXT_FUNC PF_WriteAngle_I_internal(float flValue) { if (!gMsgStarted) Sys_Error("%s: called with no active message\n", __func__); @@ -2307,6 +2342,11 @@ void EXT_FUNC PF_WriteAngle_I(float flValue) } void EXT_FUNC PF_WriteCoord_I(float flValue) +{ + g_RehldsHookchains.m_PF_WriteCoord_I.callChain(PF_WriteCoord_I_internal, flValue); +} + +void EXT_FUNC PF_WriteCoord_I_internal(float flValue) { if (!gMsgStarted) Sys_Error("%s: called with no active message\n", __func__); @@ -2314,6 +2354,11 @@ void EXT_FUNC PF_WriteCoord_I(float flValue) } void EXT_FUNC PF_WriteString_I(const char *sz) +{ + g_RehldsHookchains.m_PF_WriteString_I.callChain(PF_WriteString_I_internal, sz); +} + +void EXT_FUNC PF_WriteString_I_internal(const char *sz) { if (!gMsgStarted) Sys_Error("%s: called with no active message\n", __func__); @@ -2321,6 +2366,11 @@ void EXT_FUNC PF_WriteString_I(const char *sz) } void EXT_FUNC PF_WriteEntity_I(int iValue) +{ + g_RehldsHookchains.m_PF_WriteEntity_I.callChain(PF_WriteEntity_I_internal, iValue); +} + +void EXT_FUNC PF_WriteEntity_I_internal(int iValue) { if (!gMsgStarted) Sys_Error("%s: called with no active message\n", __func__); diff --git a/rehlds/engine/pr_cmds.h b/rehlds/engine/pr_cmds.h index a7d424c2..b021d7d8 100644 --- a/rehlds/engine/pr_cmds.h +++ b/rehlds/engine/pr_cmds.h @@ -155,15 +155,25 @@ edict_t *CreateFakeClient_internal(const char *netname); void PF_RunPlayerMove_I(edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, unsigned char impulse, unsigned char msec); sizebuf_t *WriteDest_Parm(int dest); void PF_MessageBegin_I(int msg_dest, int msg_type, const float *pOrigin, edict_t *ed); +void PF_MessageBegin_I_internal(int msg_dest, int msg_type, const float *pOrigin, edict_t *ed); void PF_MessageEnd_I(void); +void PF_MessageEnd_I_internal(void); void PF_WriteByte_I(int iValue); +void PF_WriteByte_I_internal(int iValue); void PF_WriteChar_I(int iValue); +void PF_WriteChar_I_internal(int iValue); void PF_WriteShort_I(int iValue); +void PF_WriteShort_I_internal(int iValue); void PF_WriteLong_I(int iValue); +void PF_WriteLong_I_internal(int iValue); void PF_WriteAngle_I(float flValue); +void PF_WriteAngle_I_internal(float flValue); void PF_WriteCoord_I(float flValue); +void PF_WriteCoord_I_internal(float flValue); void PF_WriteString_I(const char *sz); +void PF_WriteString_I_internal(const char *sz); void PF_WriteEntity_I(int iValue); +void PF_WriteEntity_I_internal(int iValue); void PF_makestatic_I(edict_t *ent); void PF_StaticDecal(const float *origin, int decalIndex, int entityIndex, int modelIndex); void PF_setspawnparms_I(edict_t *ent); diff --git a/rehlds/public/rehlds/rehlds_api.h b/rehlds/public/rehlds/rehlds_api.h index bc835819..f5c6c9f2 100644 --- a/rehlds/public/rehlds/rehlds_api.h +++ b/rehlds/public/rehlds/rehlds_api.h @@ -259,6 +259,46 @@ typedef IVoidHookChainRegistry IRehldsHookRegistry_SV_ClientPrintf typedef IHookChain IRehldsHook_SV_AllowPhysent; typedef IHookChainRegistry IRehldsHookRegistry_SV_AllowPhysent; +//PF_MessageBegin_I hook +typedef IVoidHookChain IRehldsHook_PF_MessageBegin_I; +typedef IVoidHookChainRegistry IRehldsHookRegistry_PF_MessageBegin_I; + +//PF_MessageEnd_I hook +typedef IVoidHookChain<> IRehldsHook_PF_MessageEnd_I; +typedef IVoidHookChainRegistry<> IRehldsHookRegistry_PF_MessageEnd_I; + +//PF_WriteByte_I hook +typedef IVoidHookChain IRehldsHook_PF_WriteByte_I; +typedef IVoidHookChainRegistry IRehldsHookRegistry_PF_WriteByte_I; + +//PF_WriteChar_I hook +typedef IVoidHookChain IRehldsHook_PF_WriteChar_I; +typedef IVoidHookChainRegistry IRehldsHookRegistry_PF_WriteChar_I; + +//PF_WriteShort_I hook +typedef IVoidHookChain IRehldsHook_PF_WriteShort_I; +typedef IVoidHookChainRegistry IRehldsHookRegistry_PF_WriteShort_I; + +//PF_WriteLong_I hook +typedef IVoidHookChain IRehldsHook_PF_WriteLong_I; +typedef IVoidHookChainRegistry IRehldsHookRegistry_PF_WriteLong_I; + +//PF_WriteAngle_I hook +typedef IVoidHookChain IRehldsHook_PF_WriteAngle_I; +typedef IVoidHookChainRegistry IRehldsHookRegistry_PF_WriteAngle_I; + +//PF_WriteCoord_I hook +typedef IVoidHookChain IRehldsHook_PF_WriteCoord_I; +typedef IVoidHookChainRegistry IRehldsHookRegistry_PF_WriteCoord_I; + +//PF_WriteString_I hook +typedef IVoidHookChain IRehldsHook_PF_WriteString_I; +typedef IVoidHookChainRegistry IRehldsHookRegistry_PF_WriteString_I; + +//PF_WriteEntity_I hook +typedef IVoidHookChain IRehldsHook_PF_WriteEntity_I; +typedef IVoidHookChainRegistry IRehldsHookRegistry_PF_WriteEntity_I; + class IRehldsHookchains { public: virtual ~IRehldsHookchains() { } @@ -318,6 +358,16 @@ class IRehldsHookchains { virtual IRehldsHookRegistry_SV_AddResource* SV_AddResource() = 0; virtual IRehldsHookRegistry_SV_ClientPrintf* SV_ClientPrintf() = 0; virtual IRehldsHookRegistry_SV_AllowPhysent* SV_AllowPhysent() = 0; + virtual IRehldsHookRegistry_PF_MessageBegin_I* PF_MessageBegin_I() = 0; + virtual IRehldsHookRegistry_PF_MessageEnd_I* PF_MessageEnd_I() = 0; + virtual IRehldsHookRegistry_PF_WriteByte_I* PF_WriteByte_I() = 0; + virtual IRehldsHookRegistry_PF_WriteChar_I* PF_WriteChar_I() = 0; + virtual IRehldsHookRegistry_PF_WriteShort_I* PF_WriteShort_I() = 0; + virtual IRehldsHookRegistry_PF_WriteLong_I* PF_WriteLong_I() = 0; + virtual IRehldsHookRegistry_PF_WriteAngle_I* PF_WriteAngle_I() = 0; + virtual IRehldsHookRegistry_PF_WriteCoord_I* PF_WriteCoord_I() = 0; + virtual IRehldsHookRegistry_PF_WriteString_I* PF_WriteString_I() = 0; + virtual IRehldsHookRegistry_PF_WriteEntity_I* PF_WriteEntity_I() = 0; }; struct RehldsFuncs_t { diff --git a/rehlds/rehlds/rehlds_api_impl.cpp b/rehlds/rehlds/rehlds_api_impl.cpp index 8d7f9dad..c1b744f0 100644 --- a/rehlds/rehlds/rehlds_api_impl.cpp +++ b/rehlds/rehlds/rehlds_api_impl.cpp @@ -885,6 +885,46 @@ IRehldsHookRegistry_SV_AllowPhysent* CRehldsHookchains::SV_AllowPhysent() { return &m_SV_AllowPhysent; } +IRehldsHookRegistry_PF_MessageBegin_I* CRehldsHookchains::PF_MessageBegin_I() { + return &m_PF_MessageBegin_I; +} + +IRehldsHookRegistry_PF_MessageEnd_I* CRehldsHookchains::PF_MessageEnd_I() { + return &m_PF_MessageEnd_I; +} + +IRehldsHookRegistry_PF_WriteByte_I* CRehldsHookchains::PF_WriteByte_I() { + return &m_PF_WriteByte_I; +} + +IRehldsHookRegistry_PF_WriteChar_I* CRehldsHookchains::PF_WriteChar_I() { + return &m_PF_WriteChar_I; +} + +IRehldsHookRegistry_PF_WriteShort_I* CRehldsHookchains::PF_WriteShort_I() { + return &m_PF_WriteShort_I; +} + +IRehldsHookRegistry_PF_WriteLong_I* CRehldsHookchains::PF_WriteLong_I() { + return &m_PF_WriteLong_I; +} + +IRehldsHookRegistry_PF_WriteAngle_I* CRehldsHookchains::PF_WriteAngle_I() { + return &m_PF_WriteAngle_I; +} + +IRehldsHookRegistry_PF_WriteCoord_I* CRehldsHookchains::PF_WriteCoord_I() { + return &m_PF_WriteCoord_I; +} + +IRehldsHookRegistry_PF_WriteString_I* CRehldsHookchains::PF_WriteString_I() { + return &m_PF_WriteString_I; +} + +IRehldsHookRegistry_PF_WriteEntity_I* CRehldsHookchains::PF_WriteEntity_I() { + return &m_PF_WriteEntity_I; +} + int EXT_FUNC CRehldsApi::GetMajorVersion() { return REHLDS_API_VERSION_MAJOR; diff --git a/rehlds/rehlds/rehlds_api_impl.h b/rehlds/rehlds/rehlds_api_impl.h index 699bd164..eace4d1d 100644 --- a/rehlds/rehlds/rehlds_api_impl.h +++ b/rehlds/rehlds/rehlds_api_impl.h @@ -254,6 +254,46 @@ typedef IVoidHookChainRegistryImpl CRehldsHookRegistry_SV_ClientPri typedef IHookChainImpl CRehldsHook_SV_AllowPhysent; typedef IHookChainRegistryImpl CRehldsHookRegistry_SV_AllowPhysent; +//PF_MessageBegin_I hook +typedef IVoidHookChain CRehldsHook_PF_MessageBegin_I; +typedef IVoidHookChainRegistryImpl CRehldsHookRegistry_PF_MessageBegin_I; + +//PF_MessageEnd_I hook +typedef IVoidHookChain<> CRehldsHook_PF_MessageEnd_I; +typedef IVoidHookChainRegistryImpl<> CRehldsHookRegistry_PF_MessageEnd_I; + +//PF_WriteByte_I hook +typedef IVoidHookChain CRehldsHook_PF_WriteByte_I; +typedef IVoidHookChainRegistryImpl CRehldsHookRegistry_PF_WriteByte_I; + +//PF_WriteChar_I hook +typedef IVoidHookChain CRehldsHook_PF_WriteChar_I; +typedef IVoidHookChainRegistryImpl CRehldsHookRegistry_PF_WriteChar_I; + +//PF_WriteShort_I hook +typedef IVoidHookChain CRehldsHook_PF_WriteShort_I; +typedef IVoidHookChainRegistryImpl CRehldsHookRegistry_PF_WriteShort_I; + +//PF_WriteLong_I hook +typedef IVoidHookChain CRehldsHook_PF_WriteLong_I; +typedef IVoidHookChainRegistryImpl CRehldsHookRegistry_PF_WriteLong_I; + +//PF_WriteAngle_I hook +typedef IVoidHookChain CRehldsHook_PF_WriteAngle_I; +typedef IVoidHookChainRegistryImpl CRehldsHookRegistry_PF_WriteAngle_I; + +//PF_WriteCoord_I hook +typedef IVoidHookChain CRehldsHook_PF_WriteCoord_I; +typedef IVoidHookChainRegistryImpl CRehldsHookRegistry_PF_WriteCoord_I; + +//PF_WriteString_I hook +typedef IVoidHookChain CRehldsHook_PF_WriteString_I; +typedef IVoidHookChainRegistryImpl CRehldsHookRegistry_PF_WriteString_I; + +//PF_WriteEntity_I hook +typedef IVoidHookChain CRehldsHook_PF_WriteEntity_I; +typedef IVoidHookChainRegistryImpl CRehldsHookRegistry_PF_WriteEntity_I; + class CRehldsHookchains : public IRehldsHookchains { public: CRehldsHookRegistry_Steam_NotifyClientConnect m_Steam_NotifyClientConnect; @@ -311,6 +351,16 @@ class CRehldsHookchains : public IRehldsHookchains { CRehldsHookRegistry_SV_AddResource m_SV_AddResource; CRehldsHookRegistry_SV_ClientPrintf m_SV_ClientPrintf; CRehldsHookRegistry_SV_AllowPhysent m_SV_AllowPhysent; + CRehldsHookRegistry_PF_MessageBegin_I m_PF_MessageBegin_I; + CRehldsHookRegistry_PF_MessageEnd_I m_PF_MessageEnd_I; + CRehldsHookRegistry_PF_WriteByte_I m_PF_WriteByte_I; + CRehldsHookRegistry_PF_WriteChar_I m_PF_WriteChar_I; + CRehldsHookRegistry_PF_WriteShort_I m_PF_WriteShort_I; + CRehldsHookRegistry_PF_WriteLong_I m_PF_WriteLong_I; + CRehldsHookRegistry_PF_WriteAngle_I m_PF_WriteAngle_I; + CRehldsHookRegistry_PF_WriteCoord_I m_PF_WriteCoord_I; + CRehldsHookRegistry_PF_WriteString_I m_PF_WriteString_I; + CRehldsHookRegistry_PF_WriteEntity_I m_PF_WriteEntity_I; public: EXT_FUNC virtual IRehldsHookRegistry_Steam_NotifyClientConnect* Steam_NotifyClientConnect(); @@ -368,6 +418,16 @@ class CRehldsHookchains : public IRehldsHookchains { EXT_FUNC virtual IRehldsHookRegistry_SV_AddResource* SV_AddResource(); EXT_FUNC virtual IRehldsHookRegistry_SV_ClientPrintf* SV_ClientPrintf(); EXT_FUNC virtual IRehldsHookRegistry_SV_AllowPhysent* SV_AllowPhysent(); + EXT_FUNC virtual IRehldsHookRegistry_PF_MessageBegin_I* PF_MessageBegin_I(); + EXT_FUNC virtual IRehldsHookRegistry_PF_MessageEnd_I* PF_MessageEnd_I(); + EXT_FUNC virtual IRehldsHookRegistry_PF_WriteByte_I* PF_WriteByte_I(); + EXT_FUNC virtual IRehldsHookRegistry_PF_WriteChar_I* PF_WriteChar_I(); + EXT_FUNC virtual IRehldsHookRegistry_PF_WriteShort_I* PF_WriteShort_I(); + EXT_FUNC virtual IRehldsHookRegistry_PF_WriteLong_I* PF_WriteLong_I(); + EXT_FUNC virtual IRehldsHookRegistry_PF_WriteAngle_I* PF_WriteAngle_I(); + EXT_FUNC virtual IRehldsHookRegistry_PF_WriteCoord_I* PF_WriteCoord_I(); + EXT_FUNC virtual IRehldsHookRegistry_PF_WriteString_I* PF_WriteString_I(); + EXT_FUNC virtual IRehldsHookRegistry_PF_WriteEntity_I* PF_WriteEntity_I(); }; extern CRehldsHookchains g_RehldsHookchains;