Hello. I want detour CTraceFilterSimple::ShouldHitEntity, so i found part of code in collisionhook extension thread, made by God-Tony. I want to know 1 thing - how next code is look like?I need to know how look like
g_iPassEntOffs and g_iCollisionOffs in code. I know, its offsets of contentmask and collisiongroup, but i want to know how declare it (or it just integer?). Thanks in advance.
PHP Code:
DETOUR_DECL_MEMBER2(ShouldHitEntity, bool, IHandleEntity *, pHandleEntity, int, contentsMask)
{
IHandleEntity *m_pPassEnt = *(IHandleEntity **)((intptr_t)this + g_iPassEntOffs);
int m_collisionGroup = *(int *)((intptr_t)this + g_iCollisionOffs);
cell_t result = DETOUR_MEMBER_CALL(ShouldHitEntity)(pHandleEntity, contentsMask);
if (!pHandleEntity || !m_pPassEnt || pHandleEntity == m_pPassEnt)
return (result != 0);
cell_t touchEnt = gamehelpers->EntityToBCompatRef((CBaseEntity *)pHandleEntity);
cell_t passEnt = gamehelpers->EntityToBCompatRef((CBaseEntity *)m_pPassEnt);
g_pOnShouldCollide->PushCell(touchEnt);
g_pOnShouldCollide->PushCell(passEnt);
g_pOnShouldCollide->PushCell(m_collisionGroup);
g_pOnShouldCollide->PushCell(contentsMask);
g_pOnShouldCollide->PushCellByRef(&result);
g_pOnShouldCollide->Execute(NULL);
return (result != 0);
}
Need to use GETGAMEDATAOFFSET.