L L4D2node

CVoxelTree::RemoveFromTree

0x001ddd90 · 643 bytes · __thiscall

_ZN10CVoxelTree14RemoveFromTreeEt

Decompiled

undefined (2 params)

/* CVoxelTree::RemoveFromTree(unsigned short) */

void __thiscall CVoxelTree::RemoveFromTree(CVoxelTree *this,ushort param_1)

{
  int iVar1;
  char cVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  char cVar7;
  int *piVar8;
  int iVar9;
  void *pvVar10;
  int iVar11;
  undefined2 *puVar12;
  
  iVar1 = (uint)param_1 * 0x34 + *(int *)(*(int *)(this + 0xbc) + 0x10);
  cVar2 = *(char *)(iVar1 + 0x1f + *(int *)(this + 0x38));
  if (cVar2 < '\0') {
    return;
  }
  piVar8 = (int *)___tls_get_addr();
  iVar3 = *(int *)(this + *piVar8 * 4 + 0x3c);
  if (iVar3 != 0) {
    CThreadSpinRWLock::UnlockRead();
  }
  iVar9 = ThreadGetCurrentId();
  LOCK();
  *(int *)(this + 0xe8) = *(int *)(this + 0xe8) + 1;
  UNLOCK();
  if ((0 < *(int *)(this + 0xe4)) ||
     (((*(int *)(this + 0xe0) != 0 && (iVar9 != *(int *)(this + 0xe0))) ||
      (cVar7 = ThreadInterlockedAssignIf64(this + 0xe0,iVar9,0,0,0), cVar7 == '\0')))) {
    CThreadSpinRWLock::SpinLockForWrite((uint)(this + 0xe0));
  }
  CVoxelHash::RemoveFromTree((CVoxelHash *)(cVar2 * 0x1050 + *(int *)(this + 8)),param_1);
  iVar4 = *(int *)(this + 0xcc);
  iVar11 = *(int *)(this + 0xc4);
  iVar5 = *(int *)(this + 0x38);
  iVar9 = iVar4 + 1;
  if (iVar11 < iVar9) {
    iVar6 = *(int *)(this + 200);
    if (-1 < iVar6) {
      if (iVar6 == 0) {
        if (iVar11 == 0) {
          if (iVar9 < 0x11) {
            iVar11 = 0x10;
            goto LAB_001ddf36;
          }
          iVar11 = 0x10;
        }
        do {
          iVar11 = iVar11 * 2;
        } while (iVar11 < iVar9);
      }
      else {
        for (iVar11 = (iVar4 / iVar6 + 1) * iVar6; iVar11 < iVar9; iVar11 = (iVar11 + iVar9) / 2) {
        }
      }
LAB_001ddf36:
      *(int *)(this + 0xc4) = iVar11;
      if (*(void **)(this + 0xc0) == (void *)0x0) {
        pvVar10 = malloc(iVar11 * 2);
        *(void **)(this + 0xc0) = pvVar10;
      }
      else {
        pvVar10 = realloc(*(void **)(this + 0xc0),iVar11 * 2);
        *(void **)(this + 0xc0) = pvVar10;
        iVar9 = *(int *)(this + 0xcc) + 1;
      }
      goto LAB_001dde68;
    }
  }
  pvVar10 = *(void **)(this + 0xc0);
LAB_001dde68:
  *(int *)(this + 0xcc) = iVar9;
  iVar9 = (iVar9 - iVar4) + -1;
  *(void **)(this + 0xd0) = pvVar10;
  if (0 < iVar9) {
    _V_memmove((void *)((int)pvVar10 + iVar4 * 2 + 2),(void *)((int)pvVar10 + iVar4 * 2),iVar9 * 2);
    pvVar10 = *(void **)(this + 0xc0);
  }
  puVar12 = (undefined2 *)(iVar4 * 2 + (int)pvVar10);
  if (puVar12 != (undefined2 *)0x0) {
    *puVar12 = *(undefined2 *)(iVar1 + 0x22 + iVar5 * 2);
  }
  *(undefined2 *)(iVar1 + 0x22 + *(int *)(this + 0x38) * 2) = 0xffff;
  CThreadSpinRWLock::UnlockWrite();
  if (iVar3 == 0) {
    return;
  }
  CThreadSpinRWLock::LockForRead();
  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)