mirror of
https://github.com/rehlds/reapi.git
synced 2024-12-28 07:35:31 +03:00
Implement RH_SV_AllowPhysent hook (#265)
This commit is contained in:
parent
7d9bd65e4f
commit
aeabd1fa10
@ -162,6 +162,13 @@ enum EngineFunc
|
||||
*/
|
||||
RH_SV_ClientPrintf,
|
||||
|
||||
/*
|
||||
* Description: Called before adding an entity to the physents of a player.
|
||||
* Return type: bool
|
||||
* Params: (const entity, const client)
|
||||
*/
|
||||
RH_SV_AllowPhysent,
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -36,7 +36,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;
|
||||
@ -254,6 +254,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() { }
|
||||
@ -312,6 +316,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 {
|
||||
|
@ -140,6 +140,16 @@ void ED_Free(IRehldsHook_ED_Free* chain, edict_t *entity)
|
||||
callVoidForward(RH_ED_Free, original, indexOfEdict(entity));
|
||||
}
|
||||
|
||||
bool SV_AllowPhysent(IRehldsHook_SV_AllowPhysent* chain, edict_t* check, edict_t* sv_player)
|
||||
{
|
||||
auto original = [chain](int _check, int _sv_player)
|
||||
{
|
||||
return chain->callNext(edictByIndexAmx(_check), edictByIndexAmx(_sv_player));
|
||||
};
|
||||
|
||||
return callForward<bool>(RH_SV_AllowPhysent, original, indexOfEdict(check), indexOfEdict(sv_player));
|
||||
}
|
||||
|
||||
int SV_CheckUserInfo(IRehldsHook_SV_CheckUserInfo *chain, netadr_t *adr, char *userinfo, qboolean bIsReconnecting, int iReconnectSlot, char *name)
|
||||
{
|
||||
auto original = [chain](netadr_t *_adr, char *_userinfo, qboolean _bIsReconnecting, int _iReconnectSlot, char *_name)
|
||||
|
@ -378,6 +378,7 @@ void SV_AddResource(IRehldsHook_SV_AddResource *chain, resourcetype_t type, cons
|
||||
edict_t *ED_Alloc(IRehldsHook_ED_Alloc* chain);
|
||||
void ED_Free(IRehldsHook_ED_Free* chain, edict_t *entity);
|
||||
void SV_ClientPrintf(IRehldsHook_SV_ClientPrintf* chain, const char *string);
|
||||
bool SV_AllowPhysent(IRehldsHook_SV_AllowPhysent* chain, edict_t* check, edict_t* sv_player);
|
||||
|
||||
// regamedll functions
|
||||
int GetForceCamera(IReGameHook_GetForceCamera *chain, CBasePlayer *pObserver);
|
||||
|
@ -103,6 +103,7 @@ hook_t hooklist_engine[] = {
|
||||
ENG(EV_Precache, _AMXX),
|
||||
ENG(SV_AddResource),
|
||||
ENG(SV_ClientPrintf),
|
||||
ENG(SV_AllowPhysent),
|
||||
|
||||
};
|
||||
|
||||
|
@ -112,6 +112,7 @@ enum EngineFunc
|
||||
RH_EV_Precache,
|
||||
RH_SV_AddResource,
|
||||
RH_SV_ClientPrintf,
|
||||
RH_SV_AllowPhysent,
|
||||
|
||||
// [...]
|
||||
};
|
||||
|
@ -6,5 +6,5 @@
|
||||
#pragma once
|
||||
|
||||
#define VERSION_MAJOR 5
|
||||
#define VERSION_MINOR 22
|
||||
#define VERSION_MINOR 23
|
||||
#define VERSION_MAINTENANCE 0
|
||||
|
Loading…
Reference in New Issue
Block a user