2
0
mirror of https://github.com/rehlds/rehlds.git synced 2024-12-27 07:05:43 +03:00

Add SV_AllowPhysent hook (#951)

* Add SV_AllowPhysent hook
This commit is contained in:
Hamdi 2023-02-11 00:03:53 +00:00 committed by GitHub
parent 5e8b0ba616
commit 1796459953
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 2 deletions

View File

@ -511,6 +511,14 @@ void SV_CopyEdictToPhysent(physent_t *pe, int e, edict_t *check)
pe->vuser4[2] = check->v.vuser4[2];
}
bool EXT_FUNC SV_AllowPhysent_mod(edict_t* check, edict_t* sv_player) {
return true;
}
bool SV_AllowPhysent(edict_t* check, edict_t* sv_player) {
return g_RehldsHookchains.m_SV_AllowPhysent.callChain(SV_AllowPhysent_mod, check, sv_player);
}
void SV_AddLinksToPM_(areanode_t *node, float *pmove_mins, float *pmove_maxs)
{
struct link_s *l;
@ -547,6 +555,11 @@ void SV_AddLinksToPM_(areanode_t *node, float *pmove_mins, float *pmove_maxs)
if (check->v.solid != SOLID_BSP && check->v.solid != SOLID_BBOX && check->v.solid != SOLID_SLIDEBOX && check->v.solid != SOLID_NOT)
continue;
// Apply our own custom checks
if (!SV_AllowPhysent(check, sv_player)) {
continue;
}
e = NUM_FOR_EDICT(check);
ve = &pmove->visents[pmove->numvisent];
pmove->numvisent = pmove->numvisent + 1;

View File

@ -37,7 +37,7 @@
#include "pr_dlls.h"
#define REHLDS_API_VERSION_MAJOR 3
#define REHLDS_API_VERSION_MINOR 12
#define REHLDS_API_VERSION_MINOR 13
//Steam_NotifyClientConnect hook
typedef IHookChain<qboolean, IGameClient*, const void*, unsigned int> IRehldsHook_Steam_NotifyClientConnect;
@ -255,6 +255,10 @@ typedef IVoidHookChainRegistry<resourcetype_t, const char *, int, unsigned char,
typedef IVoidHookChain<const char *> IRehldsHook_SV_ClientPrintf;
typedef IVoidHookChainRegistry<const char *> IRehldsHookRegistry_SV_ClientPrintf;
//SV_AllowPhysent hook
typedef IHookChain<bool, edict_t*, edict_t*> IRehldsHook_SV_AllowPhysent;
typedef IHookChainRegistry<bool, edict_t*, edict_t*> IRehldsHookRegistry_SV_AllowPhysent;
class IRehldsHookchains {
public:
virtual ~IRehldsHookchains() { }
@ -313,6 +317,7 @@ public:
virtual IRehldsHookRegistry_EV_Precache* EV_Precache() = 0;
virtual IRehldsHookRegistry_SV_AddResource* SV_AddResource() = 0;
virtual IRehldsHookRegistry_SV_ClientPrintf* SV_ClientPrintf() = 0;
virtual IRehldsHookRegistry_SV_AllowPhysent* SV_AllowPhysent() = 0;
};
struct RehldsFuncs_t {

View File

@ -879,6 +879,10 @@ IRehldsHookRegistry_SV_ClientPrintf* CRehldsHookchains::SV_ClientPrintf(){
return &m_SV_ClientPrintf;
}
IRehldsHookRegistry_SV_AllowPhysent* CRehldsHookchains::SV_AllowPhysent() {
return &m_SV_AllowPhysent;
}
int EXT_FUNC CRehldsApi::GetMajorVersion()
{
return REHLDS_API_VERSION_MAJOR;

View File

@ -250,6 +250,10 @@ typedef IVoidHookChainRegistryImpl<resourcetype_t, const char*, int, unsigned ch
typedef IVoidHookChainImpl<const char*> CRehldsHook_SV_ClientPrintf;
typedef IVoidHookChainRegistryImpl<const char*> CRehldsHookRegistry_SV_ClientPrintf;
//SV_AllowPhysent hook
typedef IHookChainImpl<bool, edict_t*, edict_t*> CRehldsHook_SV_AllowPhysent;
typedef IHookChainRegistryImpl<bool, edict_t*, edict_t*> CRehldsHookRegistry_SV_AllowPhysent;
class CRehldsHookchains : public IRehldsHookchains {
public:
CRehldsHookRegistry_Steam_NotifyClientConnect m_Steam_NotifyClientConnect;
@ -306,6 +310,7 @@ public:
CRehldsHookRegistry_EV_Precache m_EV_Precache;
CRehldsHookRegistry_SV_AddResource m_SV_AddResource;
CRehldsHookRegistry_SV_ClientPrintf m_SV_ClientPrintf;
CRehldsHookRegistry_SV_AllowPhysent m_SV_AllowPhysent;
public:
EXT_FUNC virtual IRehldsHookRegistry_Steam_NotifyClientConnect* Steam_NotifyClientConnect();
@ -362,6 +367,7 @@ public:
EXT_FUNC virtual IRehldsHookRegistry_EV_Precache* EV_Precache();
EXT_FUNC virtual IRehldsHookRegistry_SV_AddResource* SV_AddResource();
EXT_FUNC virtual IRehldsHookRegistry_SV_ClientPrintf* SV_ClientPrintf();
EXT_FUNC virtual IRehldsHookRegistry_SV_AllowPhysent* SV_AllowPhysent();
};
extern CRehldsHookchains g_RehldsHookchains;

View File

@ -6,5 +6,5 @@
#pragma once
#define VERSION_MAJOR 3
#define VERSION_MINOR 12
#define VERSION_MINOR 13
#define VERSION_MAINTENANCE 0