View Single Post
Author Message
keygens
Senior Member
Join Date: Mar 2010
Location: Somewhere
Old 09-19-2016 , 19:43   [SOLVED]Detour ShouldHitEntity
Reply With Quote #1

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(ShouldHitEntityboolIHandleEntity *, pHandleEntityintcontentsMask)
{
    
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)(pHandleEntitycontentsMask);

    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.

Last edited by keygens; 09-19-2016 at 20:16.
keygens is offline