L L4D2node

CBaseAnimating::FindDamagedBodyGroupVariant

0x005e9380 · 655 bytes · __thiscall

_ZN14CBaseAnimating27FindDamagedBodyGroupVariantEi

Decompiled

undefined (2 params)

/* CBaseAnimating::FindDamagedBodyGroupVariant(int) */

undefined4 __thiscall CBaseAnimating::FindDamagedBodyGroupVariant(CBaseAnimating *this,int param_1)

{
  int iVar1;
  char *pcVar2;
  CStudioHdr *pCVar3;
  char *pcVar4;
  int iVar5;
  int iVar6;
  CStudioHdr *pCVar7;
  undefined4 uVar8;
  CUtlMemory<int,int> *local_44;
  int local_34;
  int local_30 [8];
  
  if (param_1 < 0) {
    return 0xffffffff;
  }
  pCVar3 = *(CStudioHdr **)(this + 0x13e0);
  if (pCVar3 == (CStudioHdr *)0x0) {
    iVar1 = CBaseEntity::GetModel((CBaseEntity *)this);
    if (iVar1 == 0) {
      pCVar3 = *(CStudioHdr **)(this + 0x13e0);
    }
    else {
      LockStudioHdr(this);
      pCVar3 = *(CStudioHdr **)(this + 0x13e0);
    }
    pCVar7 = (CStudioHdr *)0x0;
    if (pCVar3 != (CStudioHdr *)0x0) goto LAB_005e93a5;
  }
  else {
LAB_005e93a5:
    pCVar7 = (CStudioHdr *)0x0;
    if (*(int *)pCVar3 != 0) {
      pCVar7 = pCVar3;
    }
  }
  iVar1 = ::GetNumBodyGroups(pCVar7);
  if (iVar1 <= param_1) {
    return 0xffffffff;
  }
  iVar1 = GetBodygroup(this,param_1);
  pCVar3 = *(CStudioHdr **)(this + 0x13e0);
  if (pCVar3 == (CStudioHdr *)0x0) {
    iVar5 = CBaseEntity::GetModel((CBaseEntity *)this);
    if (iVar5 == 0) {
      pCVar3 = *(CStudioHdr **)(this + 0x13e0);
    }
    else {
      LockStudioHdr(this);
      pCVar3 = *(CStudioHdr **)(this + 0x13e0);
    }
    if (pCVar3 != (CStudioHdr *)0x0) goto LAB_005e93da;
    pCVar7 = (CStudioHdr *)0x0;
  }
  else {
LAB_005e93da:
    pCVar7 = (CStudioHdr *)0x0;
    if (*(int *)pCVar3 != 0) {
      pCVar7 = pCVar3;
    }
  }
  pcVar2 = (char *)::GetBodygroupPartName(pCVar7,param_1,iVar1);
  local_30[0] = 0;
  pCVar3 = *(CStudioHdr **)(this + 0x13e0);
  local_30[1] = 0;
  local_30[2] = 0;
  local_30[3] = 0;
  local_30[4] = 0;
  if (pCVar3 == (CStudioHdr *)0x0) {
    iVar1 = CBaseEntity::GetModel((CBaseEntity *)this);
    if (iVar1 != 0) {
      LockStudioHdr(this);
    }
    pCVar3 = *(CStudioHdr **)(this + 0x13e0);
    pCVar7 = (CStudioHdr *)0x0;
    if (pCVar3 == (CStudioHdr *)0x0) goto LAB_005e9430;
  }
  pCVar7 = (CStudioHdr *)0x0;
  if (*(int *)pCVar3 != 0) {
    pCVar7 = pCVar3;
  }
LAB_005e9430:
                    /* try { // try from 005e943d to 005e959d has its CatchHandler @ 005e9623 */
  iVar1 = ::GetBodygroupCount(pCVar7,param_1);
  local_34 = 0;
  if (0 < iVar1) {
LAB_005e946e:
    do {
      iVar5 = local_34;
      pCVar3 = *(CStudioHdr **)(this + 0x13e0);
      if (pCVar3 == (CStudioHdr *)0x0) {
        iVar6 = CBaseEntity::GetModel((CBaseEntity *)this);
        if (iVar6 != 0) {
          LockStudioHdr(this);
        }
        pCVar3 = *(CStudioHdr **)(this + 0x13e0);
        pCVar7 = (CStudioHdr *)0x0;
        if (pCVar3 != (CStudioHdr *)0x0) goto LAB_005e947c;
      }
      else {
LAB_005e947c:
        pCVar7 = (CStudioHdr *)0x0;
        if (*(int *)pCVar3 != 0) {
          pCVar7 = pCVar3;
        }
      }
      pcVar4 = (char *)::GetBodygroupPartName(pCVar7,param_1,iVar5);
      if ((*pcVar4 == 'D') && (iVar5 = _V_strstr(pcVar4,pcVar2), iVar5 != 0)) {
        CUtlVector<int,CUtlMemory<int,int>>::InsertBefore
                  ((CUtlVector<int,CUtlMemory<int,int>> *)local_30,local_30[3],&local_34);
        local_34 = local_34 + 1;
        if (iVar1 <= local_34) break;
        goto LAB_005e946e;
      }
      local_34 = local_34 + 1;
    } while (local_34 < iVar1);
  }
  local_44 = (CUtlMemory<int,int> *)local_30;
  if (local_30[3] == 0) {
    uVar8 = 0xffffffff;
  }
  else {
    iVar1 = RandomInt(0,local_30[3] + -1);
    uVar8 = *(undefined4 *)(local_30[0] + iVar1 * 4);
  }
  local_30[3] = 0;
  CUtlMemory<int,int>::Purge(local_44);
  local_30[4] = local_30[0];
  CUtlMemory<int,int>::Purge(local_44);
  return uVar8;
}

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)