L L4D2node

CConstraintAnchor::Spawn

0x00775ad0 · 524 bytes · __thiscall

_ZN17CConstraintAnchor5SpawnEv

Decompiled

undefined (1 param)

/* CConstraintAnchor::Spawn() */

void __thiscall CConstraintAnchor::Spawn(CConstraintAnchor *this)

{
  undefined4 uVar1;
  undefined4 uVar2;
  uint uVar3;
  int *piVar4;
  undefined4 *puVar5;
  undefined *puVar6;
  int iVar7;
  int iVar8;
  int iVar9;
  undefined4 *puVar10;
  
  uVar2 = g_AnchorList._24_4_;
  uVar3 = *(uint *)(this + 0x180);
  if ((((uVar3 == 0xffffffff) ||
       (puVar6 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar6 == (undefined *)0xfffffffc)) ||
      (*(uint *)(puVar6 + 8) != uVar3 >> 0xc)) || (*(int *)(puVar6 + 4) == 0)) {
    return;
  }
  uVar1 = *(undefined4 *)(this + 0x440);
  iVar7 = g_AnchorList._24_4_ + 1;
  if ((iVar7 <= (int)g_AnchorList._16_4_) || ((int)g_AnchorList._20_4_ < 0)) goto LAB_00775b47;
  if (g_AnchorList._20_4_ == 0) {
    if (g_AnchorList._16_4_ == 0) {
      if (iVar7 < 3) {
        g_AnchorList._16_4_ = 2;
        goto LAB_00775c5f;
      }
      g_AnchorList._16_4_ = 2;
    }
    do {
      g_AnchorList._16_4_ = g_AnchorList._16_4_ * 2;
    } while ((int)g_AnchorList._16_4_ < iVar7);
  }
  else {
    for (g_AnchorList._16_4_ =
              ((int)g_AnchorList._24_4_ / (int)g_AnchorList._20_4_ + 1) * g_AnchorList._20_4_;
        (int)g_AnchorList._16_4_ < iVar7; g_AnchorList._16_4_ = (g_AnchorList._16_4_ + iVar7) / 2) {
    }
  }
LAB_00775c5f:
  if (g_AnchorList._12_4_ == 0) {
    g_AnchorList._12_4_ = malloc(g_AnchorList._16_4_ * 0x1c);
  }
  else {
    g_AnchorList._12_4_ = realloc((void *)g_AnchorList._12_4_,g_AnchorList._16_4_ * 0x1c);
    iVar7 = g_AnchorList._24_4_ + 1;
  }
LAB_00775b47:
  iVar8 = (iVar7 - uVar2) + -1;
  iVar9 = uVar2 * 0x1c;
  g_AnchorList._24_4_ = iVar7;
  g_AnchorList._28_4_ = g_AnchorList._12_4_;
  if (0 < iVar8) {
    _V_memmove((void *)(g_AnchorList._12_4_ + 0x1c + iVar9),(void *)(g_AnchorList._12_4_ + iVar9),
               iVar8 * 0x1c);
  }
  if (g_AnchorList._12_4_ + iVar9 == 0) {
    puVar10 = (undefined4 *)0x0;
  }
  else {
    *(undefined4 *)(g_AnchorList._12_4_ + iVar9 + 0xc) = 0xffffffff;
    puVar10 = (undefined4 *)(iVar9 + g_AnchorList._12_4_);
  }
  uVar3 = *(uint *)(this + 0x180);
  if (((uVar3 == 0xffffffff) ||
      (puVar6 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar6 == (undefined *)0xfffffffc)) ||
     ((*(uint *)(puVar6 + 8) != uVar3 >> 0xc ||
      (piVar4 = *(int **)(puVar6 + 4), piVar4 == (int *)0x0)))) {
    puVar10[3] = 0xffffffff;
  }
  else {
    puVar5 = (undefined4 *)(**(code **)(*piVar4 + 0xc))(piVar4);
    puVar10[3] = *puVar5;
  }
  puVar10[4] = (uint)(byte)this[0x185];
  puVar10[5] = *(undefined4 *)(this + 0x154);
  *puVar10 = *(undefined4 *)(this + 0x39c);
  puVar10[1] = *(undefined4 *)(this + 0x3a0);
  uVar2 = *(undefined4 *)(this + 0x3a4);
  puVar10[6] = uVar1;
  puVar10[2] = uVar2;
  UTIL_Remove((CBaseEntity *)this);
  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)