Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions reapi/extra/amxmodx/scripting/include/reapi_engine_const.inc
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,13 @@ enum EngineFunc
*/
RH_SV_SendResources,

/*
* Description: Called when an entity checks collision with another entity.
* Return type: int
* Params: (const entity)
*/
RH_SV_TestEntityPosition,

};

/**
Expand Down
5 changes: 5 additions & 0 deletions reapi/include/cssdk/engine/rehlds_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,10 @@ typedef IHookChainRegistry<bool, edict_t*, edict_t*> IRehldsHookRegistry_SV_Allo
typedef IVoidHookChain<sizebuf_t *> IRehldsHook_SV_SendResources;
typedef IVoidHookChainRegistry<sizebuf_t *> IRehldsHookRegistry_SV_SendResources;

// SV_TestEntityPosition hook
typedef IHookChain<edict_t *, edict_t *> IRehldsHook_SV_TestEntityPosition;
typedef IHookChainRegistry<edict_t *, edict_t *> IRehldsHookRegistry_SV_TestEntityPosition;

class IRehldsHookchains {
public:
virtual ~IRehldsHookchains() { }
Expand Down Expand Up @@ -324,6 +328,7 @@ class IRehldsHookchains {
virtual IRehldsHookRegistry_SV_ClientPrintf* SV_ClientPrintf() = 0;
virtual IRehldsHookRegistry_SV_AllowPhysent* SV_AllowPhysent() = 0;
virtual IRehldsHookRegistry_SV_SendResources* SV_SendResources() = 0;
virtual IRehldsHookRegistry_SV_TestEntityPosition* SV_TestEntityPosition() = 0;
};

struct RehldsFuncs_t {
Expand Down
10 changes: 10 additions & 0 deletions reapi/src/hook_callback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,16 @@ void SV_SendResources(IRehldsHook_SV_SendResources *chain, sizebuf_t *msg)
SV_SendResources_AMXX(&data, g_RehldsFuncs->GetHostClient());
}

edict_t *SV_TestEntityPosition(IRehldsHook_SV_TestEntityPosition* chain, edict_t* ent)
{
auto original = [chain](int _ent)
{
return indexOfEdict(chain->callNext(edictByIndexAmx(_ent)));
};

return edictByIndexAmx(callForward<int>(RH_SV_TestEntityPosition, original, indexOfEdict(ent)));
}

/*
* ReGameDLL functions
*/
Expand Down
1 change: 1 addition & 0 deletions reapi/src/hook_callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ 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);
edict_t *SV_TestEntityPosition(IRehldsHook_SV_TestEntityPosition* chain, edict_t* ent);

/*
* ReGameDLL functions
Expand Down
1 change: 1 addition & 0 deletions reapi/src/hook_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ hook_t hooklist_engine[] = {
ENG(SV_AllowPhysent),
ENG(ExecuteServerStringCmd),
ENG(SV_SendResources, _AMXX),
ENG(SV_TestEntityPosition),
};

#define DLL(h,...) { {}, {}, #h, "ReGameDLL", [](){ return api_cfg.hasReGameDLL(); }, ((!(RG_##h & (MAX_REGION_RANGE - 1)) ? regfunc::current_cell = 1, true : false) || (RG_##h & (MAX_REGION_RANGE - 1)) == regfunc::current_cell++) ? regfunc(h##__VA_ARGS__) : regfunc(#h#__VA_ARGS__), [](){ g_ReGameHookchains->h()->registerHook(&h); }, [](){ g_ReGameHookchains->h()->unregisterHook(&h); }, false}
Expand Down
1 change: 1 addition & 0 deletions reapi/src/hook_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ enum EngineFunc
RH_SV_AllowPhysent,
RH_ExecuteServerStringCmd,
RH_SV_SendResources,
RH_SV_TestEntityPosition,

// [...]
};
Expand Down
Loading