L L4D2node

CCollisionEvent::UpdatePenetrateEvents

0x0077ac60 · 702 bytes · __thiscall

_ZN15CCollisionEvent21UpdatePenetrateEventsEv

Decompiled

undefined (1 param)

/* CCollisionEvent::UpdatePenetrateEvents() */

void __thiscall CCollisionEvent::UpdatePenetrateEvents(CCollisionEvent *this)

{
  undefined4 *puVar1;
  undefined4 *puVar2;
  uint uVar3;
  int iVar4;
  CAI_BaseNPC *pCVar5;
  undefined *puVar6;
  uint *puVar7;
  CBaseEntity *pCVar8;
  CBaseEntity *pCVar9;
  int local_28;
  CBaseEntity *local_24;
  int local_20;
  
  local_20 = *(int *)(this + 300) + -1;
  if (-1 < local_20) {
    local_28 = local_20 * 0x14;
    do {
      while( true ) {
        local_24 = (CBaseEntity *)0x0;
        puVar7 = (uint *)(local_28 + *(int *)(this + 0x120));
        uVar3 = *puVar7;
        if (((uVar3 != 0xffffffff) &&
            (puVar6 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar6 != (undefined *)0xfffffffc)) &&
           (*(uint *)(puVar6 + 8) == uVar3 >> 0xc)) {
          local_24 = *(CBaseEntity **)(puVar6 + 4);
        }
        uVar3 = puVar7[1];
        pCVar9 = (CBaseEntity *)0x0;
        if (((uVar3 != 0xffffffff) &&
            (puVar6 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar6 != (undefined *)0xfffffffc)) &&
           (*(uint *)(puVar6 + 8) == uVar3 >> 0xc)) {
          pCVar9 = *(CBaseEntity **)(puVar6 + 4);
        }
        uVar3 = puVar7[4];
        if (uVar3 != 1) break;
        if ((pCVar9 == (CBaseEntity *)0x0) || (local_24 == (CBaseEntity *)0x0)) goto LAB_0077acc4;
        if (*(IPhysicsObject **)(local_24 + 0x238) != (IPhysicsObject *)0x0) {
          PhysForceEntityToSleep(local_24,*(IPhysicsObject **)(local_24 + 0x238));
        }
        if (*(IPhysicsObject **)(pCVar9 + 0x238) != (IPhysicsObject *)0x0) {
          PhysForceEntityToSleep(pCVar9,*(IPhysicsObject **)(pCVar9 + 0x238));
        }
        local_20 = local_20 + -1;
        *(undefined4 *)(*(int *)(this + 0x120) + 0x10 + local_28) = 4;
        local_28 = local_28 + -0x14;
        if (local_20 == -1) {
          return;
        }
      }
      if (uVar3 == 2) {
        if ((pCVar9 != (CBaseEntity *)0x0) && (local_24 != (CBaseEntity *)0x0)) {
          pCVar5 = (CAI_BaseNPC *)CBaseEntity::MyNPCPointer();
          pCVar8 = pCVar9;
          if (pCVar5 == (CAI_BaseNPC *)0x0) {
            pCVar5 = (CAI_BaseNPC *)CBaseEntity::MyNPCPointer();
            pCVar8 = local_24;
          }
          NPCPhysics_CreateSolver(pCVar5,pCVar8,true,1.0);
        }
LAB_0077acc4:
        if (0 < *(int *)(this + 300)) {
          iVar4 = *(int *)(this + 300) + -1;
          if (local_20 != iVar4) {
            puVar1 = (undefined4 *)(*(int *)(this + 0x120) + iVar4 * 0x14);
            puVar2 = (undefined4 *)(*(int *)(this + 0x120) + local_28);
            *puVar2 = *puVar1;
            puVar2[1] = puVar1[1];
            puVar2[2] = puVar1[2];
            puVar2[3] = puVar1[3];
            puVar2[4] = puVar1[4];
            iVar4 = *(int *)(this + 300) + -1;
          }
          *(int *)(this + 300) = iVar4;
        }
        UpdateEntityPenetrationFlag(local_24,false);
        UpdateEntityPenetrationFlag(pCVar9,false);
      }
      else {
        if (uVar3 == 3) {
          if ((pCVar9 != (CBaseEntity *)0x0) && (local_24 != (CBaseEntity *)0x0)) {
            pCVar8 = pCVar9;
            if ((*(int *)(pCVar9 + 0x234) - 1U < 3) && (pCVar9[0x186] == (CBaseEntity)0x6)) {
              pCVar8 = local_24;
              local_24 = pCVar9;
            }
            EntityPhysics_CreateSolver(pCVar8,local_24,true,1.0);
            pCVar9 = local_24;
            local_24 = pCVar8;
          }
          goto LAB_0077acc4;
        }
        if (1.0 < *(float *)(gpGlobals + 0xc) - (float)puVar7[3]) {
          if ((((uVar3 != 4) || (local_24 == (CBaseEntity *)0x0)) || (pCVar9 == (CBaseEntity *)0x0))
             || ((*(int *)(pCVar9 + 0x238) == 0 || (*(int *)(local_24 + 0x238) == 0))))
          goto LAB_0077acc4;
          puVar7[4] = 0;
        }
      }
      local_20 = local_20 + -1;
      local_28 = local_28 + -0x14;
    } while (local_20 != -1);
  }
  return;
}

SourceMod gamedata

paste into addons/sourcemod/gamedata/<your_plugin>.txt
used as the SourceMod key — change to fit your plugin's convention
SourceMod library name (server / engine / matchmaking)

Just a Signatures{} block, ready to drop into a gamedata file. Wire it up in your plugin however you like - SDKCall, DHooks, raw memory ops, or anything else.



        

        

          

Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.

Return-type handling cheatsheet (DHookReturn)