L L4D2node

CBaseAnimating::RandomizeBodygroups

0x005e9180 · 447 bytes · __thiscall

_ZN14CBaseAnimating19RandomizeBodygroupsER10CUtlVectorIPKc10CUtlMemoryIS2_iEE

Decompiled

undefined (2 params)

/* CBaseAnimating::RandomizeBodygroups(CUtlVector<char const*, CUtlMemory<char const*, int> >&) */

void __thiscall CBaseAnimating::RandomizeBodygroups(CBaseAnimating *this,CUtlVector *param_1)

{
  char *pcVar1;
  CStudioHdr *pCVar2;
  int iVar3;
  int iVar4;
  CStudioHdr *pCVar5;
  int iVar6;
  CBaseAnimating *this_00;
  int iVar7;
  int iVar8;
  CUtlMemory<int,int> *local_44;
  int local_40;
  int local_34;
  int local_30 [8];
  
  local_30[0] = 0;
  local_30[1] = 0;
  local_30[2] = 0;
  local_30[3] = 0;
  local_30[4] = 0;
  local_40 = 10000;
  if (0 < *(int *)(param_1 + 0xc)) {
    iVar6 = 0;
LAB_005e91dc:
    do {
      pcVar1 = *(char **)(*(int *)param_1 + iVar6 * 4);
      pCVar2 = *(CStudioHdr **)(this + 0x13e0);
      if (pCVar2 == (CStudioHdr *)0x0) {
        iVar3 = CBaseEntity::GetModel((CBaseEntity *)this);
        if (iVar3 != 0) {
          LockStudioHdr(this);
        }
        pCVar2 = *(CStudioHdr **)(this + 0x13e0);
        pCVar5 = (CStudioHdr *)0x0;
        if (pCVar2 != (CStudioHdr *)0x0) goto LAB_005e91f2;
      }
      else {
LAB_005e91f2:
        pCVar5 = (CStudioHdr *)0x0;
        if (*(int *)pCVar2 != 0) {
          pCVar5 = pCVar2;
        }
      }
                    /* try { // try from 005e9205 to 005e933f has its CatchHandler @ 005e934d */
      local_34 = ::FindBodygroupByName(pCVar5,pcVar1);
      if (local_34 < 0) {
LAB_005e91d0:
        iVar6 = iVar6 + 1;
        if (*(int *)(param_1 + 0xc) <= iVar6) break;
        goto LAB_005e91dc;
      }
      CUtlVector<int,CUtlMemory<int,int>>::InsertBefore
                ((CUtlVector<int,CUtlMemory<int,int>> *)local_30,local_30[3],&local_34);
      iVar3 = CountBodyGroupVariants(this,local_34);
      if (local_40 < iVar3) goto LAB_005e91d0;
      local_40 = CountBodyGroupVariants(this,local_34);
      iVar6 = iVar6 + 1;
    } while (iVar6 < *(int *)(param_1 + 0xc));
    if (local_40 == 0) goto LAB_005e926f;
  }
  iVar6 = RandomInt(1,local_40);
  iVar3 = 0;
  if (0 < local_30[3]) {
    do {
      iVar7 = *(int *)(local_30[0] + iVar3 * 4);
      this_00 = this;
      iVar8 = iVar6;
      iVar4 = FindBodyGroupVariant(this,iVar7,iVar6);
      if ((-1 < iVar4) && (-1 < *(int *)(local_30[0] + iVar3 * 4))) {
        SetBodygroup(this_00,iVar7,iVar8);
      }
      iVar3 = iVar3 + 1;
    } while (iVar3 < local_30[3]);
  }
LAB_005e926f:
  local_44 = (CUtlMemory<int,int> *)local_30;
  local_30[3] = 0;
  CUtlMemory<int,int>::Purge(local_44);
  local_30[4] = local_30[0];
  CUtlMemory<int,int>::Purge(local_44);
  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)