L L4D2node

CVoxelTree::EnumerateElementsInBox

0x001dfc40 · 2241 bytes · __thiscall

_ZN10CVoxelTree22EnumerateElementsInBoxEiRK6VectorS2_bP20IPartitionEnumerator

Decompiled

undefined (6 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CVoxelTree::EnumerateElementsInBox(int, Vector const&, Vector const&, bool,
   IPartitionEnumerator*) */

void __thiscall
CVoxelTree::EnumerateElementsInBox
          (CVoxelTree *this,int param_1,Vector *param_2,Vector *param_3,bool param_4,
          IPartitionEnumerator *param_5)

{
  undefined4 *puVar1;
  undefined4 uVar2;
  CVoxelHash *pCVar3;
  undefined4 uVar4;
  int iVar5;
  char cVar6;
  int *piVar7;
  int iVar8;
  undefined4 *puVar9;
  undefined4 *puVar10;
  byte bVar11;
  int iVar12;
  uint uVar13;
  ushort uVar14;
  uint uVar15;
  float fVar16;
  float fVar17;
  float fVar18;
  float fVar19;
  float fVar20;
  float fVar21;
  float fVar22;
  CVoxelTree *pCVar23;
  CVoxelTree *local_54;
  undefined4 *local_50;
  undefined4 local_4c;
  undefined4 local_48;
  undefined4 local_40;
  undefined4 local_3c;
  int local_38;
  float local_34;
  float local_30;
  float local_2c;
  float local_28;
  float local_24;
  float local_20;
  
  local_4c = 0;
  local_48 = 0;
  if (_exit == 0) {
    local_38 = 0;
  }
  else {
    (**(code **)(_exit + 0x50))
              (_exit,&local_4c,0,0,0,0,"/data/src/engine/./spatialpartition.cpp",0x77d,
               &EnumerateElementsInBox(int,Vector_const&,Vector_const&,bool,IPartitionEnumerator*)::
                tm_fmt,"(%s)%s","Unaccounted","BoxTest/SphereTest");
    local_38 = _exit;
  }
  iVar12 = _DAT_0040b9d4;
  local_40 = local_4c;
  local_3c = local_48;
                    /* try { // try from 001e0048 to 001e0097 has its CatchHandler @ 001e053f */
  if (((_DAT_0040b028 != 0) || (DAT_0040b02c == '\0')) &&
     (iVar8 = ThreadGetCurrentId(), iVar12 == iVar8)) {
    if ((char *)*_DAT_0040b030 != "BoxTest/SphereTest") {
      _DAT_0040b030 =
           (int *)CVProfNode::GetSubNode((char *)_DAT_0040b030,0x2be3dc,&DAT_00000001,0x2a054b);
    }
    CVProfNode::EnterScope();
    DAT_0040b02c = '\0';
  }
  if (param_1 != 0) {
    fVar19 = *(float *)(param_2 + 8);
    fVar21 = *(float *)param_2;
    if (*(float *)param_2 <= s_PartitionMin) {
      fVar21 = s_PartitionMin;
    }
    fVar20 = *(float *)(param_2 + 4);
    if (*(float *)(param_2 + 4) <= DAT_003b1208) {
      fVar20 = DAT_003b1208;
    }
    if (s_PartitionMax <= fVar21) {
      fVar21 = s_PartitionMax;
    }
    fVar16 = DAT_003b120c;
    fVar17 = DAT_003b1208;
    fVar18 = s_PartitionMin;
    fVar22 = s_PartitionMax;
    piVar7 = (int *)___tls_get_addr();
    if (fVar19 <= fVar16) {
      fVar19 = fVar16;
    }
    iVar12 = *(int *)(this + 0xdc);
    if (fVar17 <= *(float *)(param_3 + 4)) {
      fVar17 = *(float *)(param_3 + 4);
    }
    if (fVar16 <= *(float *)(param_3 + 8)) {
      fVar16 = *(float *)(param_3 + 8);
    }
    local_30 = fVar20;
    if (DAT_003b11fc <= fVar20) {
      local_30 = DAT_003b11fc;
    }
    if (fVar18 <= *(float *)param_3) {
      fVar18 = *(float *)param_3;
    }
    local_24 = fVar17;
    if (DAT_003b11fc <= fVar17) {
      local_24 = DAT_003b11fc;
    }
    local_28 = fVar18;
    if (fVar22 <= fVar18) {
      local_28 = fVar22;
    }
    local_2c = fVar19;
    if (DAT_003b1200 <= fVar19) {
      local_2c = DAT_003b1200;
    }
    uVar2 = *(undefined4 *)(this + *piVar7 * 4 + 0x3c);
    local_20 = fVar16;
    if (DAT_003b1200 <= fVar16) {
      local_20 = DAT_003b1200;
    }
    puVar9 = *(undefined4 **)(this + 0xd8);
    local_34 = fVar21;
    if (puVar9 != (undefined4 *)0x0) {
      do {
                    /* try { // try from 001dfe0d to 001dffd3 has its CatchHandler @ 001e0554 */
        cVar6 = ThreadInterlockedAssignIf64(this + 0xd8,*puVar9,iVar12 + -1,puVar9,iVar12);
        if (cVar6 != '\0') {
          uVar14 = *(ushort *)(this + 0xd4);
          local_50 = puVar9 + 2;
          puVar10 = (undefined4 *)puVar9[4];
          if (uVar14 <= *(ushort *)(puVar9 + 2)) {
            if (puVar10 != (undefined4 *)0x0) {
              memset(puVar10,0,(uint)*(ushort *)((int)puVar9 + 10) << 2);
            }
            goto LAB_001dfe52;
          }
          uVar13 = (int)(uVar14 + 0x1f) >> 5;
          if (uVar13 == *(ushort *)((int)puVar9 + 10)) goto LAB_001e02da;
          if (puVar10 == (undefined4 *)0x0) goto LAB_001e013f;
          puVar1 = puVar9 + 3;
          if (puVar10 == puVar1) {
            if (uVar13 != 1) {
              puVar10 = malloc(uVar13 * 4);
              puVar9[4] = puVar10;
              *puVar10 = puVar9[3];
              puVar10 = (undefined4 *)puVar9[4];
            }
          }
          else if (uVar13 == 1) {
            puVar9[3] = *puVar10;
            free(puVar10);
            puVar9[4] = puVar1;
            puVar10 = puVar1;
          }
          else {
            puVar10 = realloc(puVar10,uVar13 * 4);
            puVar9[4] = puVar10;
          }
          goto LAB_001e02d6;
        }
        puVar9 = *(undefined4 **)(this + 0xd8);
        iVar12 = *(int *)(this + 0xdc);
      } while (puVar9 != (undefined4 *)0x0);
    }
                    /* try { // try from 001e00f7 to 001e044b has its CatchHandler @ 001e0554 */
    puVar9 = operator_new(0x18);
    puVar9[2] = 0;
    local_50 = puVar9 + 2;
    puVar9[3] = 0;
    puVar9[4] = 0;
    uVar14 = *(ushort *)(this + 0xd4);
    if (*(ushort *)(puVar9 + 2) < uVar14) {
      uVar13 = (int)(uVar14 + 0x1f) >> 5;
      if (uVar13 != *(ushort *)((int)puVar9 + 10)) {
LAB_001e013f:
        if (uVar13 == 1) {
          puVar10 = puVar9 + 3;
          puVar9[4] = puVar10;
        }
        else {
          puVar10 = malloc(uVar13 * 4);
          puVar9[4] = puVar10;
        }
LAB_001e02d6:
        *(short *)((int)puVar9 + 10) = (short)uVar13;
LAB_001e02da:
        if (puVar10 != (undefined4 *)0x0) {
          memset(puVar10,0,uVar13 * 4);
        }
      }
      *(ushort *)(puVar9 + 2) = uVar14;
    }
LAB_001dfe52:
    piVar7 = (int *)___tls_get_addr();
    *(undefined4 **)(this + *piVar7 * 4 + 0x3c) = local_50;
    pCVar23 = this + 0xe0;
    CThreadSpinRWLock::LockForRead();
    pCVar3 = *(CVoxelHash **)(this + 8);
    bVar11 = (char)*(undefined4 *)(pCVar3 + 0x104c) * '\x02' + 8;
    uVar15 = (int)(local_34 - *(float *)pCVar3) >> (bVar11 & 0x1f) & 0x7ffU |
             ((int)(local_30 - *(float *)(pCVar3 + 4)) >> (bVar11 & 0x1f) & 0x7ffU) << 0xb |
             ((int)(local_2c - *(float *)(pCVar3 + 8)) >> (bVar11 & 0x1f)) << 0x16;
    uVar13 = (int)(local_28 - *(float *)pCVar3) >> (bVar11 & 0x1f) & 0x7ffU |
             ((int)(local_24 - *(float *)(pCVar3 + 4)) >> (bVar11 & 0x1f) & 0x7ffU) << 0xb |
             ((int)(local_20 - *(float *)(pCVar3 + 8)) >> (bVar11 & 0x1f)) << 0x16;
    cVar6 = CVoxelHash::EnumerateElementsInBox
                      (pCVar3,param_1,uVar15,uVar13,&local_34,&local_28,param_5);
    if (cVar6 == '\0') {
      CThreadSpinRWLock::UnlockRead();
      piVar7 = (int *)___tls_get_addr(pCVar23);
      local_54 = this + *piVar7 * 4;
      iVar12 = *(int *)(local_54 + 0x3c);
      do {
        iVar8 = *(int *)(this + 0xdc);
        uVar4 = *(undefined4 *)(this + 0xd8);
        *(undefined4 *)(iVar12 + -8) = uVar4;
        cVar6 = ThreadInterlockedAssignIf64(this + 0xd8,iVar12 + -8,iVar8 + 0x10001,uVar4,iVar8);
      } while (cVar6 == '\0');
    }
    else {
      uVar15 = uVar15 >> 2 & 0xffcff9ff;
      uVar13 = uVar13 >> 2 & 0xffcff9ff;
      cVar6 = CVoxelHash::EnumerateElementsInBox
                        ((CVoxelHash *)(*(int *)(this + 8) + 0x1050),param_1,uVar15,uVar13,&local_34
                         ,&local_28,param_5);
      if (cVar6 == '\0') {
        CThreadSpinRWLock::UnlockRead();
        piVar7 = (int *)___tls_get_addr(pCVar23);
        iVar12 = *piVar7;
        iVar8 = *(int *)(this + iVar12 * 4 + 0x3c);
        do {
          iVar5 = *(int *)(this + 0xdc);
          uVar4 = *(undefined4 *)(this + 0xd8);
          *(undefined4 *)(iVar8 + -8) = uVar4;
          cVar6 = ThreadInterlockedAssignIf64(this + 0xd8,iVar8 + -8,iVar5 + 0x10001,uVar4,iVar5);
        } while (cVar6 == '\0');
        *(undefined4 *)(this + iVar12 * 4 + 0x3c) = uVar2;
        goto LAB_001dffe1;
      }
      uVar15 = uVar15 >> 2 & 0xffcff9ff;
      uVar13 = uVar13 >> 2 & 0xffcff9ff;
      cVar6 = CVoxelHash::EnumerateElementsInBox
                        ((CVoxelHash *)(*(int *)(this + 8) + 0x20a0),param_1,uVar15,uVar13,&local_34
                         ,&local_28,param_5);
      if (cVar6 != '\0') {
        CVoxelHash::EnumerateElementsInBox
                  ((CVoxelHash *)(*(int *)(this + 8) + 0x30f0),param_1,uVar15 >> 2 & 0xffcff9ff,
                   uVar13 >> 2 & 0xffcff9ff,&local_34,&local_28,param_5);
        CThreadSpinRWLock::UnlockRead();
        piVar7 = (int *)___tls_get_addr(pCVar23);
        iVar12 = *piVar7;
        iVar8 = *(int *)(this + iVar12 * 4 + 0x3c);
        do {
          iVar5 = *(int *)(this + 0xdc);
          uVar4 = *(undefined4 *)(this + 0xd8);
          *(undefined4 *)(iVar8 + -8) = uVar4;
          cVar6 = ThreadInterlockedAssignIf64(this + 0xd8,iVar8 + -8,iVar5 + 0x10001,uVar4,iVar5);
        } while (cVar6 == '\0');
        *(undefined4 *)(this + iVar12 * 4 + 0x3c) = uVar2;
        iVar12 = _DAT_0040b9d4;
        if (((DAT_0040b02c == '\0') || (_DAT_0040b028 != 0)) &&
           (iVar8 = ThreadGetCurrentId(), iVar12 == iVar8)) {
          cVar6 = CVProfNode::ExitScope();
          if (cVar6 != '\0') {
            _DAT_0040b030 = (int *)_DAT_0040b030[0x19];
          }
          DAT_0040b02c = _DAT_0040b030 == (int *)0x40b034;
        }
        if (local_38 == 0) {
          return;
        }
        (**(code **)(local_38 + 0x54))(local_38,local_40,local_3c,0,0,0);
        return;
      }
      CThreadSpinRWLock::UnlockRead();
      piVar7 = (int *)___tls_get_addr(pCVar23);
      local_54 = this + *piVar7 * 4;
      iVar12 = *(int *)(local_54 + 0x3c);
      do {
        iVar8 = *(int *)(this + 0xdc);
        uVar4 = *(undefined4 *)(this + 0xd8);
        *(undefined4 *)(iVar12 + -8) = uVar4;
        cVar6 = ThreadInterlockedAssignIf64(this + 0xd8,iVar12 + -8,iVar8 + 0x10001,uVar4,iVar8);
      } while (cVar6 == '\0');
    }
    *(undefined4 *)(local_54 + 0x3c) = uVar2;
  }
LAB_001dffe1:
  iVar12 = _DAT_0040b9d4;
  if (((DAT_0040b02c == '\0') || (_DAT_0040b028 != 0)) &&
     (iVar8 = ThreadGetCurrentId(), iVar12 == iVar8)) {
    cVar6 = CVProfNode::ExitScope();
    if (cVar6 != '\0') {
      _DAT_0040b030 = (int *)_DAT_0040b030[0x19];
    }
    DAT_0040b02c = _DAT_0040b030 == (int *)0x40b034;
  }
  if (local_38 != 0) {
    (**(code **)(local_38 + 0x54))(local_38,local_40,local_3c,0,0,0);
  }
  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)