L L4D2node

CCollisionEvent::ShouldFreezeObject

0x007801d0 · 719 bytes · __thiscall

_ZN15CCollisionEvent18ShouldFreezeObjectEP14IPhysicsObject

Decompiled

undefined (2 params)

/* CCollisionEvent::ShouldFreezeObject(IPhysicsObject*) */

undefined4 __thiscall
CCollisionEvent::ShouldFreezeObject(CCollisionEvent *this,IPhysicsObject *param_1)

{
  undefined4 *puVar1;
  char cVar2;
  CBaseEntity *pCVar3;
  int iVar4;
  uint uVar5;
  CFunctor4<CBaseEntity*(*)(CBaseEntity*,CBaseEntity*,bool,float),CBaseEntity*,CBaseEntity*,bool,float,CRefCounted1<CFunctor,CRefCountServiceBase<true,CRefMT>>>
  *this_00;
  CBaseEntity *pCVar6;
  undefined4 *puVar7;
  undefined4 *puVar8;
  longdouble lVar9;
  IPhysicsObject *local_98;
  Vector local_94 [12];
  float local_88;
  float local_84;
  float local_80;
  CTakeDamageInfo local_7c [108];
  
  pCVar3 = (CBaseEntity *)(**(code **)(*(int *)param_1 + 0x48))(param_1);
  if (pCVar3 != (CBaseEntity *)0x0) {
    if ((pCVar3[0x186] == (CBaseEntity)0x7) ||
       ((iVar4 = (**(code **)(*(int *)pCVar3 + 0x18c))(pCVar3), iVar4 != 0 &&
        (uVar5 = (**(code **)(*(int *)param_1 + 0x60))(param_1), (uVar5 & 0x40) == 0)))) {
      return 0;
    }
    if ((*(int *)(pCVar3 + 0x234) - 1U < 3) &&
       (cVar2 = (**(code **)(*(int *)pCVar3 + 0x140))(pCVar3), cVar2 == '\0')) {
      local_98 = (IPhysicsObject *)0x0;
      lVar9 = (longdouble)(**(code **)(*(int *)param_1 + 0x78))(param_1);
      cVar2 = FindMaxContact(param_1,(float)lVar9 * 10.0,&local_98,local_94,(Vector *)&local_88);
      if (cVar2 != '\0') {
        pCVar6 = (CBaseEntity *)(**(code **)(*(int *)local_98 + 0x48))(local_98);
        if ((char)pCVar3[0x105] < '\x02') {
          cVar2 = PropIsGib(pCVar3);
          if (cVar2 == '\0') {
            this_00 = ::operator_new(0x24);
            *(undefined4 *)(this_00 + 0xc) = 1;
            *(undefined ***)this_00 = &PTR_AddRef_00cb1148;
            *(undefined **)(this_00 + 8) = &DAT_00cb1164;
            *(code **)(this_00 + 0x10) = EntityPhysics_CreateSolver;
            *(CBaseEntity **)(this_00 + 0x14) = pCVar6;
            *(CBaseEntity **)(this_00 + 0x18) = pCVar3;
            this_00[0x1c] =
                 (CFunctor4<CBaseEntity*(*)(CBaseEntity*,CBaseEntity*,bool,float),CBaseEntity*,CBaseEntity*,bool,float,CRefCounted1<CFunctor,CRefCountServiceBase<true,CRefMT>>>
                  )0x1;
            *(undefined4 *)(this_00 + 0x20) = 0x3f800000;
            if (DAT_00fec500 == '\0') {
              do {
                puVar7 = DAT_00fec4f8;
                if (DAT_00fec4f8 == (undefined4 *)0x0) {
                  puVar7 = ::operator_new(8);
                  puVar7[1] = this_00;
                  goto LAB_0078042f;
                }
                cVar2 = ThreadInterlockedAssignIf64
                                  (&DAT_00fec4f8,*DAT_00fec4f8,DAT_00fec4fc + -1,DAT_00fec4f8,
                                   DAT_00fec4fc);
              } while (cVar2 == '\0');
              puVar7[1] = this_00;
LAB_0078042f:
              *puVar7 = &g_PostSimulationQueue;
              while( true ) {
                iVar4 = DAT_00fec4ec;
                puVar1 = DAT_00fec4e8;
                LOCK();
                puVar8 = (undefined4 *)*DAT_00fec4e8;
                if (puVar8 == &g_PostSimulationQueue) {
                  *DAT_00fec4e8 = puVar7;
                  puVar8 = &g_PostSimulationQueue;
                }
                UNLOCK();
                if (puVar8 == &g_PostSimulationQueue) break;
                ThreadInterlockedAssignIf64(&DAT_00fec4e8,*puVar1,iVar4 + 1,puVar1,iVar4);
              }
              ThreadInterlockedAssignIf64(&DAT_00fec4e8,puVar7,iVar4 + 1,puVar1,iVar4);
              LOCK();
              DAT_00fec4f0 = DAT_00fec4f0 + 1;
              UNLOCK();
            }
            else {
              CFunctor4<CBaseEntity*(*)(CBaseEntity*,CBaseEntity*,bool,float),CBaseEntity*,CBaseEntity*,bool,float,CRefCounted1<CFunctor,CRefCountServiceBase<true,CRefMT>>>
              ::operator()(this_00);
              (**(code **)(*(int *)this_00 + 4))(this_00);
            }
          }
          else {
            PhysCallbackRemove((IServerNetworkable *)(pCVar3 + 0x24));
          }
        }
        else {
          CTakeDamageInfo::CTakeDamageInfo
                    (local_7c,pCVar6,pCVar6,(Vector *)&local_88,local_94,
                     SQRT(local_80 * local_80 + local_88 * local_88 + local_84 * local_84) * 0.1,1,0
                     ,(Vector *)0x0);
          PhysCallbackDamage(pCVar3,local_7c);
        }
      }
    }
  }
  return 1;
}

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)