L L4D2node

RagdollActivate

0x004a3570 · 1549 bytes · __cdecl

_Z15RagdollActivateR9ragdoll_tP10vcollide_tiP10CCallQueueb

Decompiled

undefined (5 params)

/* RagdollActivate(ragdoll_t&, vcollide_t*, int, CCallQueue*, bool) */

void RagdollActivate(ragdoll_t *param_1,vcollide_t *param_2,int param_3,CCallQueue *param_4,
                    bool param_5)

{
  int *piVar1;
  char cVar2;
  ushort uVar3;
  CMemberFunctor1<IPhysicsObject*,void(IPhysicsObject::*)(bool),bool,CRefCounted1<CFunctor,CRefCountServiceBase<true,CRefMT>>,CFuncMemPolicyNone>
  *this;
  CCallQueue *pCVar4;
  CMemberFunctor0<IPhysicsConstraintGroup*,void(IPhysicsConstraintGroup::*)(),CRefCounted1<CFunctor,CRefCountServiceBase<true,CRefMT>>,CFuncMemPolicyNone>
  *this_00;
  CMemberFunctor0<IPhysicsObject*,void(IPhysicsObject::*)(),CRefCounted1<CFunctor,CRefCountServiceBase<true,CRefMT>>,CFuncMemPolicyNone>
  *pCVar5;
  CCallQueue *pCVar6;
  undefined4 *puVar7;
  int iVar8;
  ragdoll_t *prVar9;
  ragdoll_t *local_2c;
  ragdoll_t *local_28;
  
  RagdollSetupCollisions(param_1,param_2,param_3);
  local_2c = (ragdoll_t *)0x0;
  local_28 = param_1 + 0x18;
  pCVar6 = param_4 + 8;
  if (0 < *(int *)param_1) {
    do {
      piVar1 = *(int **)local_28;
      if (piVar1 != (int *)0x0) {
        uVar3 = (**(code **)(*piVar1 + 0x50))(piVar1);
        (**(code **)(*piVar1 + 0x4c))(piVar1,uVar3 | 0x10);
        if (param_4 == (CCallQueue *)0x0) {
          (**(code **)(**(int **)local_28 + 0x34))(*(int **)local_28,1);
          if (param_5) {
            (**(code **)(**(int **)local_28 + 100))(*(int **)local_28);
          }
        }
        else {
          iVar8 = *(int *)local_28;
          this = operator_new(0x20);
          *(undefined4 *)(this + 0xc) = 1;
          *(undefined ***)this = &PTR_AddRef_00c1c448;
          *(undefined **)(this + 8) = &DAT_00c1c464;
          *(undefined4 *)(this + 0x10) = 0x35;
          *(undefined4 *)(this + 0x14) = 0;
          *(int *)(this + 0x18) = iVar8;
          this[0x1c] = (CMemberFunctor1<IPhysicsObject*,void(IPhysicsObject::*)(bool),bool,CRefCounted1<CFunctor,CRefCountServiceBase<true,CRefMT>>,CFuncMemPolicyNone>
                        )0x1;
          if (param_4[0x20] == (CCallQueue)0x0) {
            iVar8 = *(int *)(param_4 + 0x1c);
            puVar7 = *(undefined4 **)(param_4 + 0x18);
            while (puVar7 != (undefined4 *)0x0) {
              cVar2 = ThreadInterlockedAssignIf64(param_4 + 0x18,*puVar7,iVar8 + -1,puVar7,iVar8);
              if (cVar2 != '\0') {
                puVar7[1] = this;
                goto LAB_004a36ce;
              }
              iVar8 = *(int *)(param_4 + 0x1c);
              puVar7 = *(undefined4 **)(param_4 + 0x18);
            }
            puVar7 = operator_new(8);
            puVar7[1] = this;
LAB_004a36ce:
            *puVar7 = param_4;
            while( true ) {
              iVar8 = *(int *)(param_4 + 0xc);
              piVar1 = *(int **)(param_4 + 8);
              LOCK();
              pCVar4 = (CCallQueue *)*piVar1;
              if (param_4 == pCVar4) {
                *piVar1 = (int)puVar7;
                pCVar4 = param_4;
              }
              UNLOCK();
              if (param_4 == pCVar4) break;
              ThreadInterlockedAssignIf64(pCVar6,*piVar1,iVar8 + 1,piVar1,iVar8);
            }
            ThreadInterlockedAssignIf64(pCVar6,puVar7,iVar8 + 1,piVar1,iVar8);
            LOCK();
            *(int *)(param_4 + 0x10) = *(int *)(param_4 + 0x10) + 1;
            UNLOCK();
          }
          else {
            CMemberFunctor1<IPhysicsObject*,void(IPhysicsObject::*)(bool),bool,CRefCounted1<CFunctor,CRefCountServiceBase<true,CRefMT>>,CFuncMemPolicyNone>
            ::operator()(this);
            (**(code **)(*(int *)this + 4))(this);
          }
          if (param_5) {
            iVar8 = *(int *)local_28;
            pCVar5 = operator_new(0x1c);
            *(undefined4 *)(pCVar5 + 0xc) = 1;
            *(undefined ***)pCVar5 = &PTR_AddRef_00c1c488;
            *(undefined **)(pCVar5 + 8) = &DAT_00c1c4a4;
            *(undefined4 *)(pCVar5 + 0x10) = 0x65;
            *(undefined4 *)(pCVar5 + 0x14) = 0;
            *(int *)(pCVar5 + 0x18) = iVar8;
            if (param_4[0x20] == (CCallQueue)0x0) {
              iVar8 = *(int *)(param_4 + 0x1c);
              puVar7 = *(undefined4 **)(param_4 + 0x18);
              while (puVar7 != (undefined4 *)0x0) {
                cVar2 = ThreadInterlockedAssignIf64(param_4 + 0x18,*puVar7,iVar8 + -1,puVar7,iVar8);
                if (cVar2 != '\0') {
                  puVar7[1] = pCVar5;
                  goto LAB_004a3846;
                }
                iVar8 = *(int *)(param_4 + 0x1c);
                puVar7 = *(undefined4 **)(param_4 + 0x18);
              }
              puVar7 = operator_new(8);
              puVar7[1] = pCVar5;
LAB_004a3846:
              *puVar7 = param_4;
              while( true ) {
                iVar8 = *(int *)(param_4 + 0xc);
                piVar1 = *(int **)(param_4 + 8);
                LOCK();
                pCVar4 = (CCallQueue *)*piVar1;
                if (param_4 == pCVar4) {
                  *piVar1 = (int)puVar7;
                  pCVar4 = param_4;
                }
                UNLOCK();
                if (param_4 == pCVar4) break;
                ThreadInterlockedAssignIf64(pCVar6,*piVar1,iVar8 + 1,piVar1,iVar8);
              }
              ThreadInterlockedAssignIf64(pCVar6,puVar7,iVar8 + 1,piVar1,iVar8);
              LOCK();
              *(int *)(param_4 + 0x10) = *(int *)(param_4 + 0x10) + 1;
              UNLOCK();
            }
            else {
              CMemberFunctor0<IPhysicsObject*,void(IPhysicsObject::*)(),CRefCounted1<CFunctor,CRefCountServiceBase<true,CRefMT>>,CFuncMemPolicyNone>
              ::operator()(pCVar5);
              (**(code **)(*(int *)pCVar5 + 4))(pCVar5);
            }
          }
        }
      }
      local_2c = (ragdoll_t *)((int)local_2c + 1);
      local_28 = local_28 + 0x54;
    } while ((int)local_2c < *(int *)param_1);
  }
  piVar1 = *(int **)(param_1 + 8);
  if (piVar1 != (int *)0x0) {
    if (param_4 == (CCallQueue *)0x0) {
      (**(code **)(*piVar1 + 8))(piVar1);
      if ((!param_5) && (0 < *(int *)param_1)) {
        prVar9 = param_1 + 0x18;
        iVar8 = 0;
        do {
          piVar1 = *(int **)prVar9;
          if (piVar1 != (int *)0x0) {
            (**(code **)(*piVar1 + 0x68))(piVar1);
          }
          iVar8 = iVar8 + 1;
          prVar9 = prVar9 + 0x54;
        } while (iVar8 < *(int *)param_1);
      }
    }
    else {
      this_00 = operator_new(0x1c);
      *(undefined4 *)(this_00 + 0xc) = 1;
      *(undefined ***)this_00 = &PTR_AddRef_00c1c4c8;
      *(undefined ***)(this_00 + 8) = &PTR__CMemberFunctor0_00c1c4e4;
      *(undefined4 *)(this_00 + 0x10) = 9;
      *(undefined4 *)(this_00 + 0x14) = 0;
      *(int **)(this_00 + 0x18) = piVar1;
      if (param_4[0x20] == (CCallQueue)0x0) {
        puVar7 = *(undefined4 **)(param_4 + 0x18);
        iVar8 = *(int *)(param_4 + 0x1c);
        if (puVar7 != (undefined4 *)0x0) {
          do {
            cVar2 = ThreadInterlockedAssignIf64(param_4 + 0x18,*puVar7,iVar8 + -1,puVar7,iVar8);
            if (cVar2 != '\0') {
              puVar7[1] = this_00;
              goto LAB_004a3b3e;
            }
            puVar7 = *(undefined4 **)(param_4 + 0x18);
            iVar8 = *(int *)(param_4 + 0x1c);
          } while (puVar7 != (undefined4 *)0x0);
        }
        puVar7 = operator_new(8);
        puVar7[1] = this_00;
LAB_004a3b3e:
        *puVar7 = param_4;
        while( true ) {
          iVar8 = *(int *)(param_4 + 0xc);
          piVar1 = *(int **)(param_4 + 8);
          LOCK();
          pCVar6 = (CCallQueue *)*piVar1;
          if (param_4 == pCVar6) {
            *piVar1 = (int)puVar7;
            pCVar6 = param_4;
          }
          UNLOCK();
          if (param_4 == pCVar6) break;
          ThreadInterlockedAssignIf64(param_4 + 8,*piVar1,iVar8 + 1,piVar1,iVar8);
        }
        ThreadInterlockedAssignIf64(param_4 + 8,puVar7,iVar8 + 1,piVar1,iVar8);
        LOCK();
        *(int *)(param_4 + 0x10) = *(int *)(param_4 + 0x10) + 1;
        UNLOCK();
      }
      else {
        CMemberFunctor0<IPhysicsConstraintGroup*,void(IPhysicsConstraintGroup::*)(),CRefCounted1<CFunctor,CRefCountServiceBase<true,CRefMT>>,CFuncMemPolicyNone>
        ::operator()(this_00);
        (**(code **)(*(int *)this_00 + 4))(this_00);
      }
      if ((!param_5) && (0 < *(int *)param_1)) {
        local_2c = param_1 + 0x18;
        local_28 = (ragdoll_t *)0x0;
        do {
          iVar8 = *(int *)local_2c;
          if (iVar8 != 0) {
            pCVar5 = operator_new(0x1c);
            *(undefined4 *)(pCVar5 + 0xc) = 1;
            *(undefined ***)pCVar5 = &PTR_AddRef_00c1c488;
            *(undefined **)(pCVar5 + 8) = &DAT_00c1c4a4;
            *(undefined4 *)(pCVar5 + 0x10) = 0x69;
            *(undefined4 *)(pCVar5 + 0x14) = 0;
            *(int *)(pCVar5 + 0x18) = iVar8;
            if (param_4[0x20] == (CCallQueue)0x0) {
              iVar8 = *(int *)(param_4 + 0x1c);
              puVar7 = *(undefined4 **)(param_4 + 0x18);
              while (puVar7 != (undefined4 *)0x0) {
                cVar2 = ThreadInterlockedAssignIf64(param_4 + 0x18,*puVar7,iVar8 + -1,puVar7,iVar8);
                if (cVar2 != '\0') {
                  puVar7[1] = pCVar5;
                  goto LAB_004a3a0e;
                }
                iVar8 = *(int *)(param_4 + 0x1c);
                puVar7 = *(undefined4 **)(param_4 + 0x18);
              }
              puVar7 = operator_new(8);
              puVar7[1] = pCVar5;
LAB_004a3a0e:
              *puVar7 = param_4;
              while( true ) {
                iVar8 = *(int *)(param_4 + 0xc);
                piVar1 = *(int **)(param_4 + 8);
                LOCK();
                pCVar6 = (CCallQueue *)*piVar1;
                if (param_4 == pCVar6) {
                  *piVar1 = (int)puVar7;
                  pCVar6 = param_4;
                }
                UNLOCK();
                if (param_4 == pCVar6) break;
                ThreadInterlockedAssignIf64(param_4 + 8,*piVar1,iVar8 + 1,piVar1,iVar8);
              }
              ThreadInterlockedAssignIf64(param_4 + 8,puVar7,iVar8 + 1,piVar1,iVar8);
              LOCK();
              *(int *)(param_4 + 0x10) = *(int *)(param_4 + 0x10) + 1;
              UNLOCK();
            }
            else {
              CMemberFunctor0<IPhysicsObject*,void(IPhysicsObject::*)(),CRefCounted1<CFunctor,CRefCountServiceBase<true,CRefMT>>,CFuncMemPolicyNone>
              ::operator()(pCVar5);
              (**(code **)(*(int *)pCVar5 + 4))(pCVar5);
            }
          }
          local_28 = (ragdoll_t *)((int)local_28 + 1);
          local_2c = local_2c + 0x54;
        } while ((int)local_28 < *(int *)param_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)