L L4D2node

TerrorNavMesh::ProcessBreakables

0x00979d70 · 2811 bytes · __thiscall

_ZN13TerrorNavMesh17ProcessBreakablesEv

Decompiled

undefined (1 param)

/* TerrorNavMesh::ProcessBreakables() */

void __thiscall TerrorNavMesh::ProcessBreakables(TerrorNavMesh *this)

{
  int *piVar1;
  CNavArea *pCVar2;
  int iVar3;
  uint uVar4;
  undefined *puVar5;
  float *pfVar6;
  int iVar7;
  longdouble lVar8;
  float fVar9;
  int local_9c;
  int local_98;
  int local_94;
  int local_90;
  int local_8c;
  int local_88;
  int local_84;
  int local_80;
  bool local_6d;
  CNavArea *local_6c;
  CNavArea *local_68;
  char local_64;
  int *local_60;
  undefined4 local_5c;
  undefined4 local_58;
  int local_54;
  int *local_50;
  float local_4c;
  float local_48;
  float local_44;
  float local_40;
  float local_3c;
  float local_38;
  float local_34;
  float local_30;
  float local_2c;
  float local_28;
  float local_24;
  float local_20;
  
  local_60 = (int *)0x0;
  local_5c = 0;
  local_58 = 0;
  local_54 = 0;
  local_50 = (int *)0x0;
  local_64 = '\x01';
  local_8c = 0;
  if (0 < *(int *)(this + 0x684)) {
    do {
      uVar4 = *(uint *)(*(int *)(this + 0x678) + local_8c * 4);
      if ((((uVar4 != 0xffffffff) &&
           (puVar5 = g_pEntityList + (uVar4 & 0xfff) * 0x10, puVar5 != (undefined *)0xfffffffc)) &&
          (*(uint *)(puVar5 + 8) == uVar4 >> 0xc)) && (iVar3 = *(int *)(puVar5 + 4), iVar3 != 0)) {
                    /* try { // try from 00979e39 to 0097a0a9 has its CatchHandler @ 0097a883 */
        (**(code **)(*(int *)(iVar3 + 0x194) + 0x3c))(iVar3 + 0x194,&local_34,&local_28);
        local_2c = local_2c - 55.0;
        if (*(int *)(this + 0x18) != 0) {
          if ((CNavMesh::
               ForAllAreasOverlappingExtent<NavAreaCollector>(NavAreaCollector&,Extent_const&)::
               searchMarker == '\0') &&
             (iVar3 = __cxa_guard_acquire(&CNavMesh::
                                           ForAllAreasOverlappingExtent<NavAreaCollector>(NavAreaCollector&,Extent_const&)
                                           ::searchMarker), iVar3 != 0)) {
                    /* try { // try from 0097a0f8 to 0097a0fc has its CatchHandler @ 0097a898 */
            CNavMesh::
            ForAllAreasOverlappingExtent<NavAreaCollector>(NavAreaCollector&,Extent_const&)::
            searchMarker = RandomInt(0,0x100000);
            __cxa_guard_release(&CNavMesh::
                                 ForAllAreasOverlappingExtent<NavAreaCollector>(NavAreaCollector&,Extent_const&)
                                 ::searchMarker);
          }
          iVar3 = CNavMesh::
                  ForAllAreasOverlappingExtent<NavAreaCollector>(NavAreaCollector&,Extent_const&)::
                  searchMarker + 1;
          if (CNavMesh::
              ForAllAreasOverlappingExtent<NavAreaCollector>(NavAreaCollector&,Extent_const&)::
              searchMarker + 1 == 0) {
            iVar3 = CNavMesh::
                    ForAllAreasOverlappingExtent<NavAreaCollector>(NavAreaCollector&,Extent_const&)
                    ::searchMarker + 2;
          }
          CNavMesh::ForAllAreasOverlappingExtent<NavAreaCollector>(NavAreaCollector&,Extent_const&)
          ::searchMarker = iVar3;
          fVar9 = 1.0 / *(float *)(this + 0x20);
          iVar3 = (int)((local_34 - *(float *)(this + 0x2c)) * fVar9);
          if (iVar3 < 0) {
            local_84 = 0;
          }
          else {
            local_84 = *(int *)(this + 0x24) + -1;
            if (iVar3 < *(int *)(this + 0x24)) {
              local_84 = iVar3;
            }
          }
          iVar3 = (int)((local_28 - *(float *)(this + 0x2c)) * fVar9);
          if (iVar3 < 0) {
            local_90 = 0;
          }
          else {
            local_90 = *(int *)(this + 0x24) + -1;
            if (iVar3 < *(int *)(this + 0x24)) {
              local_90 = iVar3;
            }
          }
          iVar3 = (int)((local_30 - *(float *)(this + 0x30)) * fVar9);
          if (iVar3 < 0) {
            local_94 = 0;
          }
          else {
            local_94 = *(int *)(this + 0x28) + -1;
            if (iVar3 < *(int *)(this + 0x28)) {
              local_94 = iVar3;
            }
          }
          iVar3 = (int)((local_24 - *(float *)(this + 0x30)) * fVar9);
          if (iVar3 < 0) {
            local_88 = 0;
          }
          else {
            local_88 = *(int *)(this + 0x28) + -1;
            if (iVar3 < *(int *)(this + 0x28)) {
              local_88 = iVar3;
            }
          }
          for (; local_84 <= local_90; local_84 = local_84 + 1) {
            if (local_94 <= local_88) {
              iVar3 = local_94 * *(int *)(this + 0x24) + local_84;
              if (iVar3 < *(int *)(this + 0x18)) {
                local_80 = local_94;
                do {
                  iVar7 = 0;
                  piVar1 = (int *)(*(int *)(this + 0xc) + iVar3 * 0x14);
                  if (0 < piVar1[3]) {
                    do {
                      pCVar2 = *(CNavArea **)(*piVar1 + iVar7 * 4);
                      if (*(int *)(pCVar2 + 0x74) !=
                          CNavMesh::
                          ForAllAreasOverlappingExtent<NavAreaCollector>(NavAreaCollector&,Extent_const&)
                          ::searchMarker) {
                        *(int *)(pCVar2 + 0x74) =
                             CNavMesh::
                             ForAllAreasOverlappingExtent<NavAreaCollector>(NavAreaCollector&,Extent_const&)
                             ::searchMarker;
                        CNavArea::GetExtent(pCVar2,(Extent *)&local_4c);
                        if (((local_34 <= local_40) && (local_4c <= local_28)) &&
                           ((local_30 <= local_3c &&
                            (((local_48 <= local_24 && (local_2c <= local_38)) &&
                             (local_44 <= local_20)))))) {
                          local_6c = pCVar2;
                          if ((local_64 == '\0') || (local_54 < 1)) {
LAB_0097a094:
                            CUtlVector<CNavArea*,CUtlMemory<CNavArea*,int>>::InsertBefore
                                      ((CUtlVector<CNavArea*,CUtlMemory<CNavArea*,int>> *)&local_60,
                                       local_54,&local_6c);
                          }
                          else if (pCVar2 != (CNavArea *)*local_60) {
                            iVar3 = 0;
                            do {
                              iVar3 = iVar3 + 1;
                              if (iVar3 == local_54) goto LAB_0097a094;
                            } while (pCVar2 != (CNavArea *)local_60[iVar3]);
                            if (iVar3 < 0) goto LAB_0097a094;
                          }
                        }
                      }
                      iVar7 = iVar7 + 1;
                    } while (iVar7 < piVar1[3]);
                  }
                  local_80 = local_80 + 1;
                  if (local_88 < local_80) goto LAB_0097a14c;
                  iVar3 = local_80 * *(int *)(this + 0x24) + local_84;
                  if (*(int *)(this + 0x18) <= iVar3) break;
                } while( true );
              }
              if (CNavMesh::
                  ForAllAreasOverlappingExtent<NavAreaCollector>(NavAreaCollector&,Extent_const&)::
                  __executeCount < 10) {
                CNavMesh::
                ForAllAreasOverlappingExtent<NavAreaCollector>(NavAreaCollector&,Extent_const&)::
                __executeCount =
                     CNavMesh::
                     ForAllAreasOverlappingExtent<NavAreaCollector>(NavAreaCollector&,Extent_const&)
                     ::__executeCount + 1;
                Warning("** Walked off of the CNavMesh::m_grid in ForAllAreasOverlappingExtent()\n")
                ;
              }
              break;
            }
LAB_0097a14c:
          }
        }
      }
      local_8c = local_8c + 1;
    } while (local_8c < *(int *)(this + 0x684));
  }
  local_98 = 0;
  local_9c = 0;
  if (0 < *(int *)(this + 0x698)) {
    do {
      iVar3 = *(int *)(this + 0x68c);
      if (*(int *)(this + 0x18) != 0) {
        if ((CNavMesh::
             ForAllAreasOverlappingExtent<NavAreaCollector>(NavAreaCollector&,Extent_const&)::
             searchMarker == '\0') &&
           (iVar7 = __cxa_guard_acquire(&CNavMesh::
                                         ForAllAreasOverlappingExtent<NavAreaCollector>(NavAreaCollector&,Extent_const&)
                                         ::searchMarker), iVar7 != 0)) {
                    /* try { // try from 0097a758 to 0097a75c has its CatchHandler @ 0097a8c4 */
          CNavMesh::ForAllAreasOverlappingExtent<NavAreaCollector>(NavAreaCollector&,Extent_const&)
          ::searchMarker = RandomInt(0,0x100000);
          __cxa_guard_release(&CNavMesh::
                               ForAllAreasOverlappingExtent<NavAreaCollector>(NavAreaCollector&,Extent_const&)
                               ::searchMarker);
        }
        iVar7 = CNavMesh::
                ForAllAreasOverlappingExtent<NavAreaCollector>(NavAreaCollector&,Extent_const&)::
                searchMarker + 1;
        if (CNavMesh::
            ForAllAreasOverlappingExtent<NavAreaCollector>(NavAreaCollector&,Extent_const&)::
            searchMarker + 1 == 0) {
          iVar7 = CNavMesh::
                  ForAllAreasOverlappingExtent<NavAreaCollector>(NavAreaCollector&,Extent_const&)::
                  searchMarker + 2;
        }
        CNavMesh::ForAllAreasOverlappingExtent<NavAreaCollector>(NavAreaCollector&,Extent_const&)::
        searchMarker = iVar7;
        pfVar6 = (float *)(iVar3 + local_98);
        fVar9 = 1.0 / *(float *)(this + 0x20);
        iVar3 = (int)((*pfVar6 - *(float *)(this + 0x2c)) * fVar9);
        if (iVar3 < 0) {
          local_88 = 0;
        }
        else {
          local_88 = *(int *)(this + 0x24) + -1;
          if (iVar3 < *(int *)(this + 0x24)) {
            local_88 = iVar3;
          }
        }
        iVar3 = (int)((pfVar6[3] - *(float *)(this + 0x2c)) * fVar9);
        if (iVar3 < 0) {
          local_94 = 0;
        }
        else {
          local_94 = *(int *)(this + 0x24) + -1;
          if (iVar3 < *(int *)(this + 0x24)) {
            local_94 = iVar3;
          }
        }
        iVar3 = (int)((pfVar6[1] - *(float *)(this + 0x30)) * fVar9);
        if (iVar3 < 0) {
          local_90 = 0;
        }
        else {
          local_90 = *(int *)(this + 0x28) + -1;
          if (iVar3 < *(int *)(this + 0x28)) {
            local_90 = iVar3;
          }
        }
        iVar3 = (int)((pfVar6[4] - *(float *)(this + 0x30)) * fVar9);
        if (iVar3 < 0) {
          local_8c = 0;
        }
        else {
          local_8c = *(int *)(this + 0x28) + -1;
          if (iVar3 < *(int *)(this + 0x28)) {
            local_8c = iVar3;
          }
        }
        for (; local_88 <= local_94; local_88 = local_88 + 1) {
          if (local_90 <= local_8c) {
            iVar3 = local_90 * *(int *)(this + 0x24) + local_88;
            if (iVar3 < *(int *)(this + 0x18)) {
              local_84 = local_90;
              do {
                iVar7 = 0;
                piVar1 = (int *)(*(int *)(this + 0xc) + iVar3 * 0x14);
                if (0 < piVar1[3]) {
                  do {
                    pCVar2 = *(CNavArea **)(*piVar1 + iVar7 * 4);
                    if (*(int *)(pCVar2 + 0x74) !=
                        CNavMesh::
                        ForAllAreasOverlappingExtent<NavAreaCollector>(NavAreaCollector&,Extent_const&)
                        ::searchMarker) {
                      *(int *)(pCVar2 + 0x74) =
                           CNavMesh::
                           ForAllAreasOverlappingExtent<NavAreaCollector>(NavAreaCollector&,Extent_const&)
                           ::searchMarker;
                    /* try { // try from 0097a324 to 0097a701 has its CatchHandler @ 0097a883 */
                      CNavArea::GetExtent(pCVar2,(Extent *)&local_34);
                      if (((((*pfVar6 <= local_28) && (local_34 <= pfVar6[3])) &&
                           (pfVar6[1] <= local_24)) &&
                          ((local_30 <= pfVar6[4] && (pfVar6[2] <= local_20)))) &&
                         (local_2c <= pfVar6[5])) {
                        local_68 = pCVar2;
                        if ((local_64 == '\0') || (local_54 < 1)) {
LAB_0097a6ec:
                          CUtlVector<CNavArea*,CUtlMemory<CNavArea*,int>>::InsertBefore
                                    ((CUtlVector<CNavArea*,CUtlMemory<CNavArea*,int>> *)&local_60,
                                     local_54,&local_68);
                        }
                        else if (pCVar2 != (CNavArea *)*local_60) {
                          iVar3 = 0;
                          do {
                            iVar3 = iVar3 + 1;
                            if (iVar3 == local_54) goto LAB_0097a6ec;
                          } while (pCVar2 != (CNavArea *)local_60[iVar3]);
                          if (iVar3 < 0) goto LAB_0097a6ec;
                        }
                      }
                    }
                    iVar7 = iVar7 + 1;
                  } while (iVar7 < piVar1[3]);
                }
                local_84 = local_84 + 1;
                if (local_8c < local_84) goto LAB_0097a7af;
                iVar3 = local_84 * *(int *)(this + 0x24) + local_88;
                if (*(int *)(this + 0x18) <= iVar3) break;
              } while( true );
            }
            if (CNavMesh::
                ForAllAreasOverlappingExtent<NavAreaCollector>(NavAreaCollector&,Extent_const&)::
                __executeCount < 10) {
              CNavMesh::
              ForAllAreasOverlappingExtent<NavAreaCollector>(NavAreaCollector&,Extent_const&)::
              __executeCount =
                   CNavMesh::
                   ForAllAreasOverlappingExtent<NavAreaCollector>(NavAreaCollector&,Extent_const&)::
                   __executeCount + 1;
                    /* try { // try from 0097a7df to 0097a877 has its CatchHandler @ 0097a883 */
              Warning("** Walked off of the CNavMesh::m_grid in ForAllAreasOverlappingExtent()\n");
            }
            break;
          }
LAB_0097a7af:
        }
      }
      local_9c = local_9c + 1;
      local_98 = local_98 + 0x18;
    } while (local_9c < *(int *)(this + 0x698));
  }
  if (local_54 < 1) {
    *(undefined4 *)(this + 0x684) = 0;
    *(undefined4 *)(this + 0x698) = 0;
  }
  else {
    local_80 = 0;
    iVar3 = 0;
LAB_0097a4f8:
    do {
      pCVar2 = (CNavArea *)local_60[iVar3];
      CNavArea::GetExtent(pCVar2,(Extent *)&local_34);
      local_20 = local_20 + 55.0;
      local_6d = false;
      local_4c = (float)((uint)local_4c & 0xffffff00);
      FindBreakables(this,(Extent *)&local_34,(bool *)&local_4c,&local_6d);
      uVar4 = *(uint *)(pCVar2 + 0x54);
      if ((uVar4 & 0x10000) == 0) {
        if (local_4c._0_1_ != (Extent)0x0) {
          *(undefined4 *)(pCVar2 + 0x54) = 0x10000;
          ZombieDebugPrint(1,"Area %d(%f %f %f) is NAV_TANK_ONLY\n",*(undefined4 *)(pCVar2 + 0x8c),
                           (double)*(float *)(pCVar2 + 0x2c),(double)*(float *)(pCVar2 + 0x30),
                           (double)*(float *)(pCVar2 + 0x34));
          UTIL_LogPrintf("Area %d is NAV_TANK_ONLY\n",*(undefined4 *)(pCVar2 + 0x8c));
          goto LAB_0097a46f;
        }
      }
      else if (local_4c._0_1_ == (Extent)0x0) {
        *(uint *)(pCVar2 + 0x54) = uVar4 & 0xfffeffff;
        ZombieDebugPrint(1,"Area %d(%f %f %f) is not NAV_TANK_ONLY\n",*(undefined4 *)(pCVar2 + 0x8c)
                         ,(double)*(float *)(pCVar2 + 0x2c),(double)*(float *)(pCVar2 + 0x30),
                         (double)*(float *)(pCVar2 + 0x34));
        UTIL_LogPrintf("Area %d is not NAV_TANK_ONLY\n",*(undefined4 *)(pCVar2 + 0x8c));
LAB_0097a46f:
        local_80 = local_80 + 1;
        uVar4 = *(uint *)(pCVar2 + 0x54);
      }
      if ((uVar4 & 0x20000) == 0) {
        if (local_6d != false) {
          local_80 = local_80 + 1;
          *(undefined4 *)(pCVar2 + 0x54) = 0x20000;
          ZombieDebugPrint(1,"Area %d(%f %f %f) is NAV_MOB_ONLY\n",*(undefined4 *)(pCVar2 + 0x8c),
                           (double)*(float *)(pCVar2 + 0x2c),(double)*(float *)(pCVar2 + 0x30),
                           (double)*(float *)(pCVar2 + 0x34));
          UTIL_LogPrintf("Area %d is NAV_MOB_ONLY\n",*(undefined4 *)(pCVar2 + 0x8c));
        }
      }
      else if (local_6d == false) {
        local_80 = local_80 + 1;
        *(uint *)(pCVar2 + 0x54) = uVar4 & 0xfffdffff;
        ZombieDebugPrint(1,"Area %d(%f %f %f) is not NAV_MOB_ONLY\n",*(undefined4 *)(pCVar2 + 0x8c),
                         (double)*(float *)(pCVar2 + 0x2c),(double)*(float *)(pCVar2 + 0x30),
                         (double)*(float *)(pCVar2 + 0x34));
        UTIL_LogPrintf("Area %d is not NAV_MOB_ONLY\n",*(undefined4 *)(pCVar2 + 0x8c));
        iVar3 = iVar3 + 1;
        if (local_54 <= iVar3) break;
        goto LAB_0097a4f8;
      }
      iVar3 = iVar3 + 1;
    } while (iVar3 < local_54);
    *(undefined4 *)(this + 0x684) = 0;
    *(undefined4 *)(this + 0x698) = 0;
    if (((local_80 != 0) && (*(int *)(nav_recompute_flow_optimization._28_4_ + 0x30) == 0)) &&
       (*(float *)(this + 0x6cc) <= 0.0)) {
      lVar8 = (longdouble)CountdownTimer::Now();
      if ((float)lVar8 + 3.0 != *(float *)(this + 0x6cc)) {
        (**(code **)(*(int *)(this + 0x6c4) + 4))(this + 0x6c4,this + 0x6cc);
        *(float *)(this + 0x6cc) = (float)lVar8 + 3.0;
      }
      if (*(float *)(this + 0x6c8) != 3.0) {
        (**(code **)(*(int *)(this + 0x6c4) + 4))(this + 0x6c4,this + 0x6c8);
        *(undefined4 *)(this + 0x6c8) = 0x40400000;
      }
    }
  }
  local_54 = 0;
  CUtlMemory<CNavArea*,int>::Purge((CUtlMemory<CNavArea*,int> *)&local_60);
  local_50 = local_60;
  CUtlMemory<CNavArea*,int>::Purge((CUtlMemory<CNavArea*,int> *)&local_60);
  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)