L L4D2node

CBaseAnimatingOverlay::AllocateLayer

0x005ed7e0 · 658 bytes · __thiscall

_ZN21CBaseAnimatingOverlay13AllocateLayerEi

Decompiled

undefined (2 params)

/* CBaseAnimatingOverlay::AllocateLayer(int) */

int __thiscall CBaseAnimatingOverlay::AllocateLayer(CBaseAnimatingOverlay *this,int param_1)

{
  undefined4 uVar1;
  int iVar2;
  CBaseEdict *pCVar3;
  uint *puVar4;
  int iVar5;
  int iVar6;
  int iVar7;
  int iVar8;
  int local_28;
  int local_24;
  int local_20;
  
  iVar6 = *(int *)(this + 0x1400);
  if (iVar6 < 1) {
    local_20 = 0;
    iVar7 = 0;
LAB_005eda35:
    local_24 = CUtlVector<CAnimationLayer,CUtlMemory<CAnimationLayer,int>>::InsertBefore
                         ((CUtlVector<CAnimationLayer,CUtlMemory<CAnimationLayer,int>> *)
                          (this + 0x13f4),iVar6);
    local_28 = local_24 * 0x4c;
    CAnimationLayer::Init((CAnimationLayer *)(local_28 + *(int *)(this + 0x13f4)),this);
    iVar8 = *(int *)(this + 0x1400);
  }
  else {
    puVar4 = *(uint **)(this + 0x13f4);
    iVar7 = 0;
    local_24 = -1;
    local_20 = 0;
    iVar2 = 0;
LAB_005ed835:
    do {
      iVar8 = iVar2;
      iVar2 = local_24;
      if ((*puVar4 & 1) == 0) {
        if (((*puVar4 & 0x20) == 0) && (iVar2 = iVar8, local_24 != -1)) {
          iVar7 = iVar7 + 1;
          puVar4 = puVar4 + 0x13;
          iVar2 = iVar8 + 1;
          if (iVar8 + 1 == iVar6) break;
          goto LAB_005ed835;
        }
      }
      else if (((int)puVar4[0xe] <= param_1) && (local_20 < (int)(puVar4[0xf] + 1))) {
        local_20 = puVar4[0xf] + 1;
      }
      local_24 = iVar2;
      puVar4 = puVar4 + 0x13;
      iVar2 = iVar8 + 1;
    } while (iVar8 + 1 != iVar6);
    iVar8 = iVar8 + 1;
    if (local_24 == -1) {
      if (0xe < iVar8) {
        return -1;
      }
      goto LAB_005eda35;
    }
    local_28 = local_24 * 0x4c;
  }
  if (iVar7 == 0) {
    if (iVar8 < 0xf) {
      iVar6 = CUtlVector<CAnimationLayer,CUtlMemory<CAnimationLayer,int>>::InsertBefore
                        ((CUtlVector<CAnimationLayer,CUtlMemory<CAnimationLayer,int>> *)
                         (this + 0x13f4),iVar8);
      CAnimationLayer::Init((CAnimationLayer *)(iVar6 * 0x4c + *(int *)(this + 0x13f4)),this);
      iVar8 = *(int *)(this + 0x1400);
      goto LAB_005ed885;
    }
  }
  else {
LAB_005ed885:
    if (iVar8 < 1) {
      iVar6 = *(int *)(this + 0x13f4);
      goto LAB_005ed920;
    }
  }
  iVar6 = *(int *)(this + 0x13f4);
  iVar7 = 0;
  do {
    iVar8 = iVar7 * 0x4c + iVar6;
    iVar2 = *(int *)(iVar8 + 0x3c);
    if ((local_20 <= iVar2) && (iVar2 < 0xf)) {
      iVar6 = *(int *)(iVar8 + 0x48);
      if (iVar6 != 0) {
        if (*(char *)(iVar6 + 0x6c) == '\0') {
          pCVar3 = *(CBaseEdict **)(iVar6 + 0x30);
          if (pCVar3 != (CBaseEdict *)0x0) {
            *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
            iVar5 = CBaseEdict::GetChangeAccessor(pCVar3);
            *(undefined2 *)(iVar5 + 2) = 0;
          }
        }
        else {
          *(byte *)(iVar6 + 0x70) = *(byte *)(iVar6 + 0x70) | 1;
        }
        uVar1 = *(undefined4 *)(gpGlobals + 0xc);
        *(undefined4 *)(iVar6 + 0x78) = 0;
        *(undefined4 *)(iVar6 + 0x74) = uVar1;
      }
      *(int *)(iVar8 + 0x3c) = iVar2 + 1;
      iVar6 = *(int *)(this + 0x13f4);
    }
    iVar7 = iVar7 + 1;
  } while (iVar7 < *(int *)(this + 0x1400));
LAB_005ed920:
  *(undefined4 *)(iVar6 + local_28) = 1;
  iVar7 = *(int *)(this + 0x13f4) + local_28;
  iVar6 = gpGlobals;
  if (local_20 != *(int *)(iVar7 + 0x3c)) {
    iVar2 = *(int *)(iVar7 + 0x48);
    if (iVar2 != 0) {
      if (*(char *)(iVar2 + 0x6c) == '\0') {
        pCVar3 = *(CBaseEdict **)(iVar2 + 0x30);
        if (pCVar3 != (CBaseEdict *)0x0) {
          *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
          iVar6 = CBaseEdict::GetChangeAccessor(pCVar3);
          *(undefined2 *)(iVar6 + 2) = 0;
        }
      }
      else {
        *(byte *)(iVar2 + 0x70) = *(byte *)(iVar2 + 0x70) | 1;
      }
      iVar6 = gpGlobals;
      uVar1 = *(undefined4 *)(gpGlobals + 0xc);
      *(undefined4 *)(iVar2 + 0x78) = 0;
      *(undefined4 *)(iVar2 + 0x74) = uVar1;
    }
    *(int *)(iVar7 + 0x3c) = local_20;
    iVar7 = local_28 + *(int *)(this + 0x13f4);
  }
  *(int *)(iVar7 + 0x38) = param_1;
  *(undefined4 *)(*(int *)(this + 0x13f4) + 0x44 + local_28) = *(undefined4 *)(iVar6 + 0xc);
  return local_24;
}

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)