L L4D2node

CVoxelTree::InsertIntoTree

0x001dd850 · 765 bytes · __thiscall

_ZN10CVoxelTree14InsertIntoTreeEtRK6VectorS2_

Decompiled

undefined (4 params)

/* CVoxelTree::InsertIntoTree(unsigned short, Vector const&, Vector const&) */

void __thiscall
CVoxelTree::InsertIntoTree(CVoxelTree *this,ushort param_1,Vector *param_2,Vector *param_3)

{
  short sVar1;
  int iVar2;
  char cVar3;
  int *piVar4;
  int iVar5;
  CVoxelHash *this_00;
  float fVar6;
  float fVar7;
  float fVar8;
  float fVar9;
  float fVar10;
  float fVar11;
  float local_34;
  float local_30;
  float local_2c;
  float local_28;
  float local_24;
  float local_20;
  
  piVar4 = (int *)___tls_get_addr();
  iVar2 = *(int *)(this + *piVar4 * 4 + 0x3c);
  if (iVar2 != 0) {
    CThreadSpinRWLock::UnlockRead();
  }
  iVar5 = ThreadGetCurrentId();
  LOCK();
  *(int *)(this + 0xe8) = *(int *)(this + 0xe8) + 1;
  UNLOCK();
  if ((0 < *(int *)(this + 0xe4)) ||
     (((*(int *)(this + 0xe0) != 0 && (iVar5 != *(int *)(this + 0xe0))) ||
      (cVar3 = ThreadInterlockedAssignIf64(this + 0xe0,iVar5,0,0,0), cVar3 == '\0')))) {
    CThreadSpinRWLock::SpinLockForWrite((uint)(this + 0xe0));
  }
  iVar5 = (uint)param_1 * 0x34 + *(int *)(*(int *)(this + 0xbc) + 0x10);
  if (*(int *)(this + 0xcc) == 0) {
    sVar1 = *(short *)(this + 0xd4);
    *(short *)(this + 0xd4) = sVar1 + 1;
    *(short *)(iVar5 + 0x22 + *(int *)(this + 0x38) * 2) = sVar1;
  }
  else {
    *(undefined2 *)(iVar5 + 0x22 + *(int *)(this + 0x38) * 2) =
         *(undefined2 *)(*(int *)(this + 0xc0) + -2 + *(int *)(this + 0xcc) * 2);
    *(int *)(this + 0xcc) = *(int *)(this + 0xcc) + -1;
  }
  fVar8 = *(float *)(param_2 + 8) - 0.03125;
  fVar7 = *(float *)param_2 - 0.03125;
  fVar10 = *(float *)(param_2 + 4) - 0.03125;
  fVar9 = *(float *)(param_3 + 8) + 0.03125;
  fVar11 = *(float *)param_3 + 0.03125;
  fVar6 = *(float *)(param_3 + 4) + 0.03125;
  local_34 = s_PartitionMax;
  if ((fVar7 <= s_PartitionMax) && (local_34 = s_PartitionMin, s_PartitionMin <= fVar7)) {
    local_34 = fVar7;
  }
  local_30 = DAT_003b11fc;
  if ((fVar10 <= DAT_003b11fc) && (local_30 = fVar10, fVar10 <= DAT_003b1208)) {
    local_30 = DAT_003b1208;
  }
  local_2c = DAT_003b1200;
  if ((fVar8 <= DAT_003b1200) && (local_2c = fVar8, fVar8 <= DAT_003b120c)) {
    local_2c = DAT_003b120c;
  }
  local_28 = s_PartitionMax;
  if ((fVar11 <= s_PartitionMax) && (local_28 = fVar11, fVar11 <= s_PartitionMin)) {
    local_28 = s_PartitionMin;
  }
  local_24 = DAT_003b11fc;
  if ((fVar6 <= DAT_003b11fc) && (local_24 = fVar6, fVar6 <= DAT_003b1208)) {
    local_24 = DAT_003b1208;
  }
  local_20 = DAT_003b1200;
  if ((fVar9 <= DAT_003b1200) && (local_20 = DAT_003b120c, DAT_003b120c <= fVar9)) {
    local_20 = fVar9;
  }
  if (*(int *)(this + 4) < 2) {
    this_00 = *(CVoxelHash **)(this + 8);
  }
  else {
    iVar5 = 0;
    this_00 = *(CVoxelHash **)(this + 8);
    do {
      fVar6 = (float)(0x100 << ((char)*(undefined4 *)(this_00 + 0x104c) * '\x02' & 0x1fU));
      if (((local_28 - local_34 < fVar6) && (local_24 - local_30 < fVar6)) &&
         (local_20 - local_2c < fVar6)) goto LAB_001dda7e;
      iVar5 = iVar5 + 1;
      this_00 = this_00 + 0x1050;
    } while (iVar5 != *(int *)(this + 4) + -1);
    this_00 = *(CVoxelHash **)(this + 8) + iVar5 * 0x1050;
  }
LAB_001dda7e:
  CVoxelHash::InsertIntoTree(this_00,param_1,(Vector *)&local_34,(Vector *)&local_28);
  CThreadSpinRWLock::UnlockWrite();
  if (iVar2 != 0) {
    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)