L L4D2node

TerrorNavArea::CustomAnalysis

0x00981dd0 · 1809 bytes · __thiscall

_ZN13TerrorNavArea14CustomAnalysisEb

Decompiled

undefined (2 params)

/* TerrorNavArea::CustomAnalysis(bool) */

void __thiscall TerrorNavArea::CustomAnalysis(TerrorNavArea *this,bool param_1)

{
  int *piVar1;
  CUtlVector<TerrorNavVisPair_t,CUtlMemory<TerrorNavVisPair_t,int>> *this_00;
  CNavArea *pCVar2;
  TerrorNavArea *pTVar3;
  int iVar4;
  int iVar5;
  undefined4 uVar6;
  char cVar7;
  int iVar8;
  uint uVar9;
  undefined4 *puVar10;
  uint uVar11;
  uint uVar12;
  void *pvVar13;
  undefined2 *puVar14;
  uint *puVar15;
  int iVar16;
  int iVar17;
  uint uVar18;
  int iVar19;
  int iVar20;
  uint uVar21;
  float fVar22;
  int local_74;
  undefined2 *local_70;
  CNavArea *local_68;
  uint local_64 [4];
  int local_54;
  int local_50;
  char local_4c;
  CNavArea **local_48;
  undefined4 local_44;
  undefined4 local_40;
  uint local_3c;
  CNavArea **local_38;
  code *local_34;
  undefined4 local_30;
  undefined4 local_2c;
  undefined4 local_28;
  undefined4 local_24;
  char *local_20;
  
  *(undefined4 *)(this + 0x130) = 0;
  if (param_1) {
    (**(code **)(*(int *)this + 0x84))(this);
    return;
  }
  local_40 = 0;
  local_3c = 0;
  local_4c = '\0';
  this[0x144] = (TerrorNavArea)0x0;
  local_70 = *(undefined2 **)(NavMaxViewDistance._28_4_ + 0x2c);
  if ((float)local_70 == 0.0) {
    local_70 = (undefined2 *)0x44bb8000;
  }
  local_44 = 1000;
  local_48 = malloc(4000);
  iVar4 = TheNavMesh;
  local_38 = local_48;
  if ((CNavMesh::ForAllAreasInRadius<NavAreaCollector>(NavAreaCollector&,Vector_const&,float)::
       searchMarker == '\0') &&
     (iVar16 = __cxa_guard_acquire(&CNavMesh::
                                    ForAllAreasInRadius<NavAreaCollector>(NavAreaCollector&,Vector_const&,float)
                                    ::searchMarker), iVar16 != 0)) {
                    /* try { // try from 009824f7 to 009824fb has its CatchHandler @ 00982525 */
    CNavMesh::ForAllAreasInRadius<NavAreaCollector>(NavAreaCollector&,Vector_const&,float)::
    searchMarker = RandomInt(0,0x100000);
    __cxa_guard_release(&CNavMesh::
                         ForAllAreasInRadius<NavAreaCollector>(NavAreaCollector&,Vector_const&,float)
                         ::searchMarker);
  }
  iVar16 = CNavMesh::ForAllAreasInRadius<NavAreaCollector>(NavAreaCollector&,Vector_const&,float)::
           searchMarker + 1;
  if (CNavMesh::ForAllAreasInRadius<NavAreaCollector>(NavAreaCollector&,Vector_const&,float)::
      searchMarker + 1 == 0) {
    iVar16 = CNavMesh::ForAllAreasInRadius<NavAreaCollector>(NavAreaCollector&,Vector_const&,float)
             ::searchMarker + 2;
  }
  CNavMesh::ForAllAreasInRadius<NavAreaCollector>(NavAreaCollector&,Vector_const&,float)::
  searchMarker = iVar16;
  fVar22 = 1.0 / *(float *)(iVar4 + 0x20);
  iVar16 = (int)((*(float *)(this + 0x2c) - *(float *)(iVar4 + 0x2c)) * fVar22);
  if (iVar16 < 0) {
    iVar16 = 0;
  }
  else if (*(int *)(iVar4 + 0x24) <= iVar16) {
    iVar16 = *(int *)(iVar4 + 0x24) + -1;
  }
  iVar8 = (int)((*(float *)(this + 0x30) - *(float *)(iVar4 + 0x30)) * fVar22);
  if (iVar8 < 0) {
    iVar8 = 0;
  }
  else if (*(int *)(iVar4 + 0x28) <= iVar8) {
    iVar8 = *(int *)(iVar4 + 0x28) + -1;
  }
  iVar17 = (int)(fVar22 * (float)local_70);
  if ((float)iVar17 < fVar22 * (float)local_70) {
    iVar17 = iVar17 + 1;
  }
  if ((float)local_70 == 0.0) {
    iVar17 = *(int *)(iVar4 + 0x24);
    if (*(int *)(iVar4 + 0x24) <= *(int *)(iVar4 + 0x28)) {
      iVar17 = *(int *)(iVar4 + 0x28);
    }
  }
  uVar12 = local_3c;
  for (iVar20 = iVar16 - iVar17; iVar20 <= iVar16 + iVar17; iVar20 = iVar20 + 1) {
    if ((-1 < iVar20) && (iVar5 = iVar8 - iVar17, iVar20 < *(int *)(iVar4 + 0x24))) {
      for (; iVar5 <= iVar8 + iVar17; iVar5 = iVar5 + 1) {
        if (((-1 < iVar5) && (iVar5 < *(int *)(iVar4 + 0x28))) &&
           (piVar1 = (int *)(*(int *)(iVar4 + 0xc) +
                            (iVar5 * *(int *)(iVar4 + 0x24) + iVar20) * 0x14), 0 < piVar1[3])) {
          iVar19 = 0;
LAB_00981fd5:
          do {
            pCVar2 = *(CNavArea **)(*piVar1 + iVar19 * 4);
            if (*(int *)(pCVar2 + 0x74) !=
                CNavMesh::
                ForAllAreasInRadius<NavAreaCollector>(NavAreaCollector&,Vector_const&,float)::
                searchMarker) {
              *(int *)(pCVar2 + 0x74) =
                   CNavMesh::
                   ForAllAreasInRadius<NavAreaCollector>(NavAreaCollector&,Vector_const&,float)::
                   searchMarker;
              if (((float)local_70 * (float)local_70 == 0.0) ||
                 ((*(float *)(pCVar2 + 0x34) - *(float *)(this + 0x34)) *
                  (*(float *)(pCVar2 + 0x34) - *(float *)(this + 0x34)) +
                  (*(float *)(pCVar2 + 0x2c) - *(float *)(this + 0x2c)) *
                  (*(float *)(pCVar2 + 0x2c) - *(float *)(this + 0x2c)) +
                  (*(float *)(pCVar2 + 0x30) - *(float *)(this + 0x30)) *
                  (*(float *)(pCVar2 + 0x30) - *(float *)(this + 0x30)) <=
                  (float)local_70 * (float)local_70)) {
                local_68 = pCVar2;
                if ((local_4c == '\0') || ((int)uVar12 < 1)) {
LAB_00982040:
                    /* try { // try from 00982051 to 00982496 has its CatchHandler @ 0098254c */
                  CUtlVector<CNavArea*,CUtlMemory<CNavArea*,int>>::InsertBefore
                            ((CUtlVector<CNavArea*,CUtlMemory<CNavArea*,int>> *)&local_48,uVar12,
                             &local_68);
                  iVar19 = iVar19 + 1;
                  uVar12 = local_3c;
                  if (piVar1[3] <= iVar19) break;
                  goto LAB_00981fd5;
                }
                if (pCVar2 != *local_48) {
                  uVar18 = 0;
                  do {
                    uVar18 = uVar18 + 1;
                    if (uVar18 == uVar12) goto LAB_00982040;
                  } while (pCVar2 != local_48[uVar18]);
                  if ((int)uVar18 < 0) goto LAB_00982040;
                }
              }
            }
            iVar19 = iVar19 + 1;
          } while (iVar19 < piVar1[3]);
        }
      }
    }
  }
  local_70 = (undefined2 *)(uVar12 - 1);
  local_74 = (int)local_70 * 4;
  if (-1 < (int)local_70) {
    do {
      piVar1 = g_pTerrorNavVisPairHash;
      pTVar3 = *(TerrorNavArea **)((int)local_48 + local_74);
      uVar12 = (uint)(pTVar3 < this);
      local_64[uVar12] = (uint)this;
      local_64[uVar12 ^ 1] = (uint)pTVar3;
      uVar18 = local_64[1];
      uVar12 = local_64[0];
      local_64[2] = *(int *)(local_64[1] + 0x8c) + local_64[0];
      local_64[3] = *(int *)(local_64[0] + 0x8c) + local_64[1];
      uVar9 = Hash8(local_64 + 2);
      if (*(char *)((int)piVar1 + 0x16) == '\0') {
        uVar9 = uVar9 % (uint)piVar1[3];
        puVar10 = (undefined4 *)(*piVar1 + uVar9 * 0x14);
        uVar21 = puVar10[3];
        if ((int)uVar21 < 1) goto LAB_00982438;
LAB_00982116:
        puVar15 = (uint *)*puVar10;
        uVar11 = 0;
        do {
          if ((*puVar15 == uVar12) && (puVar15[1] == uVar18)) goto LAB_00982133;
          uVar11 = uVar11 + 1;
          puVar15 = puVar15 + 2;
        } while (uVar11 != uVar21);
      }
      else {
        uVar9 = uVar9 & piVar1[6];
        puVar10 = (undefined4 *)(*piVar1 + uVar9 * 0x14);
        uVar21 = puVar10[3];
        if (0 < (int)uVar21) goto LAB_00982116;
LAB_00982438:
        uVar11 = 0;
LAB_00982133:
        if ((uVar21 != uVar11) && ((uVar9 << 0x10 | uVar11) != 0xffffffff)) {
          CUtlVector<CNavArea*,CUtlMemory<CNavArea*,int>>::FastRemove
                    ((CUtlVector<CNavArea*,CUtlMemory<CNavArea*,int>> *)&local_48,(int)local_70);
        }
      }
      local_70 = (undefined2 *)((int)local_70 + -1);
      local_74 = local_74 + -4;
    } while (local_70 != (undefined2 *)0xffffffff);
  }
  SetupPVS(this);
  local_24 = 0;
  g_pCurVisArea = this;
  LOCK();
  local_28 = 0;
  UNLOCK();
  local_20 = "ComputeVisToArea";
  local_34 = ComputeVisToArea;
  local_30 = 0;
  local_2c = 0;
  CParallelProcessor<CNavArea*,CFuncJobItemProcessor<CNavArea*>,1>::Run
            ((CParallelProcessor<CNavArea*,CFuncJobItemProcessor<CNavArea*>,1> *)&local_34,local_48,
             local_3c,0x7fffffff,(IThreadPool *)0x0);
  uVar12 = *(uint *)(this + 0x138) >> 1;
  if ((int)(*(uint *)(this + 0x138) >> 1) < (int)(short)DAT_010134ec) {
    uVar12 = (int)(short)DAT_010134ec;
  }
  pvVar13 = realloc(*(void **)(this + 0x134),uVar12 * 2);
  *(void **)(this + 0x134) = pvVar13;
  *(uint *)(this + 0x138) = uVar12 * 2;
  *(void **)(this + 0x140) = pvVar13;
LAB_00982218:
  while ((short)DAT_010134ec != 0) {
    iVar4 = *(int *)(this + 0x13c);
    CUtlVector<TerrorNavArea::AreaBindInfo,CUtlMemoryConservative<TerrorNavArea::AreaBindInfo>>::
    GrowVector((CUtlVector<TerrorNavArea::AreaBindInfo,CUtlMemoryConservative<TerrorNavArea::AreaBindInfo>>
                *)(this + 0x134),1);
    CUtlVector<TerrorNavArea::AreaBindInfo,CUtlMemoryConservative<TerrorNavArea::AreaBindInfo>>::
    ShiftElementsRight((CUtlVector<TerrorNavArea::AreaBindInfo,CUtlMemoryConservative<TerrorNavArea::AreaBindInfo>>
                        *)(this + 0x134),iVar4,1);
    iVar4 = iVar4 * 2;
    puVar14 = (undefined2 *)(iVar4 + *(int *)(this + 0x134));
    if (puVar14 == (undefined2 *)0x0) {
      local_70 = (undefined2 *)0x0;
    }
    else {
      *puVar14 = 0;
      local_70 = (undefined2 *)(iVar4 + *(int *)(this + 0x134));
    }
    do {
      puVar10 = g_ComputedVis;
      if (g_ComputedVis == (undefined4 *)0x0) goto LAB_00982218;
      cVar7 = ThreadInterlockedAssignIf64
                        (&g_ComputedVis,*g_ComputedVis,DAT_010134ec + -1,g_ComputedVis,DAT_010134ec)
      ;
    } while (cVar7 == '\0');
    *local_70 = *(undefined2 *)(puVar10 + 2);
    do {
      iVar4 = DAT_010134f4;
      uVar6 = DAT_010134f0;
      iVar16 = DAT_010134f4 + 0x10001;
      *puVar10 = DAT_010134f0;
      cVar7 = ThreadInterlockedAssignIf64(&DAT_010134f0,puVar10,iVar16,uVar6,iVar4);
    } while (cVar7 == '\0');
  }
  local_70 = (undefined2 *)0x0;
  if (0 < (int)local_3c) {
    do {
      piVar1 = g_pTerrorNavVisPairHash;
      pTVar3 = (TerrorNavArea *)local_48[(int)local_70];
      uVar12 = (uint)(pTVar3 < this);
      local_64[uVar12] = (uint)this;
      local_64[uVar12 ^ 1] = (uint)pTVar3;
      uVar18 = local_64[1];
      uVar12 = local_64[0];
      local_54 = *(int *)(local_64[1] + 0x8c) + local_64[0];
      local_50 = *(int *)(local_64[0] + 0x8c) + local_64[1];
      uVar9 = Hash8(&local_54);
      if (*(char *)((int)piVar1 + 0x16) == '\0') {
        uVar9 = uVar9 % (uint)piVar1[3];
      }
      else {
        uVar9 = uVar9 & piVar1[6];
      }
      this_00 = (CUtlVector<TerrorNavVisPair_t,CUtlMemory<TerrorNavVisPair_t,int>> *)
                (*piVar1 + uVar9 * 0x14);
      iVar4 = *(int *)(this_00 + 0xc);
      if (iVar4 < 1) {
        iVar16 = 0;
LAB_009823c7:
        if (iVar4 == iVar16) goto LAB_00982470;
      }
      else {
        puVar15 = *(uint **)this_00;
        iVar16 = 0;
        do {
          if ((*puVar15 == uVar12) && (puVar15[1] == uVar18)) goto LAB_009823c7;
          iVar16 = iVar16 + 1;
          puVar15 = puVar15 + 2;
        } while (iVar16 != iVar4);
LAB_00982470:
        CUtlVector<TerrorNavVisPair_t,CUtlMemory<TerrorNavVisPair_t,int>>::GrowVector(this_00,1);
        CUtlVector<TerrorNavVisPair_t,CUtlMemory<TerrorNavVisPair_t,int>>::ShiftElementsRight
                  (this_00,iVar4,1);
        puVar15 = (uint *)(*(int *)this_00 + iVar4 * 8);
        if (puVar15 != (uint *)0x0) {
          *puVar15 = local_64[0];
          puVar15[1] = local_64[1];
        }
      }
      local_70 = (undefined2 *)((int)local_70 + 1);
    } while ((int)local_70 < (int)local_3c);
  }
  local_3c = 0;
  CUtlMemory<CNavArea*,int>::Purge((CUtlMemory<CNavArea*,int> *)&local_48);
  local_38 = local_48;
  CUtlMemory<CNavArea*,int>::Purge((CUtlMemory<CNavArea*,int> *)&local_48);
  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)