L L4D2node

CNavMesh::CreateNavAreasFromNodes

0x0072d730 · 839 bytes · __thiscall

_ZN8CNavMesh23CreateNavAreasFromNodesEv

Decompiled

undefined (1 param)

/* CNavMesh::CreateNavAreasFromNodes() */

void __thiscall CNavMesh::CreateNavAreasFromNodes(CNavMesh *this)

{
  int iVar1;
  int iVar2;
  int iVar3;
  char cVar4;
  int iVar5;
  int iVar6;
  int iVar7;
  CNavNode *pCVar8;
  float fVar9;
  float fVar10;
  float fVar11;
  float fVar12;
  int local_48;
  int local_40;
  float local_34;
  float local_30;
  float local_28;
  float local_24;
  
  iVar5 = *(int *)(nav_area_max_size._28_4_ + 0x30);
  iVar7 = iVar5;
  local_40 = CNavNode::m_listLength;
  while (pCVar8 = CNavNode::m_list, 0 < local_40) {
    for (; pCVar8 != (CNavNode *)0x0; pCVar8 = *(CNavNode **)(pCVar8 + 0x60)) {
      while ((pCVar8[0x70] == (CNavNode)0x0 &&
             (cVar4 = TestArea(this,pCVar8,iVar5,iVar7), cVar4 != '\0'))) {
        iVar6 = BuildArea(this,pCVar8,iVar5,iVar7);
        if (iVar6 < 0) {
          Error("Generate: Error - Data corrupt.\n");
          return;
        }
        pCVar8 = *(CNavNode **)(pCVar8 + 0x60);
        local_40 = local_40 - iVar6;
        if (pCVar8 == (CNavNode *)0x0) goto LAB_0072d7c0;
      }
    }
LAB_0072d7c0:
    if (iVar5 < iVar7) {
      iVar7 = iVar7 + -1;
    }
    else {
      iVar5 = iVar5 + -1;
    }
    if ((iVar5 < 1) || (iVar7 < 1)) break;
  }
  if (DAT_00fe6000 == 0) {
    AllocateGrid(this,0.0,0.0,0.0,0.0);
    return;
  }
  fVar9 = 1e+10;
  fVar10 = -1e+10;
  fVar11 = 1e+10;
  fVar12 = -1e+10;
  if (0 < DAT_00fe6000) {
    iVar5 = 0;
    do {
      iVar7 = iVar5 * 4;
      iVar5 = iVar5 + 1;
      CNavArea::GetExtent(*(CNavArea **)(TheNavAreas + iVar7),(Extent *)&local_34);
      if (local_34 <= fVar9) {
        fVar9 = local_34;
      }
      if (local_30 <= fVar11) {
        fVar11 = local_30;
      }
      if (fVar10 <= local_28) {
        fVar10 = local_28;
      }
      if (fVar12 <= local_24) {
        fVar12 = local_24;
      }
    } while (iVar5 < DAT_00fe6000);
  }
  iVar5 = 0;
  AllocateGrid(this,fVar9,fVar10,fVar11,fVar12);
  if (0 < DAT_00fe6000) {
    do {
      iVar7 = iVar5 * 4;
      iVar5 = iVar5 + 1;
      AddNavArea(this,*(CNavArea **)(TheNavAreas + iVar7));
    } while (iVar5 < DAT_00fe6000);
  }
  ConnectGeneratedAreas(this);
  MarkPlayerClipAreas();
  MarkJumpAreas(this);
  MergeGeneratedAreas();
  SplitAreasUnderOverhangs();
  SquareUpAreas();
  MarkStairAreas();
  local_48 = 0;
  if (0 < DAT_00fe6000) {
    do {
      iVar6 = 0;
      iVar7 = *(int *)(TheNavAreas + local_48 * 4);
      iVar5 = iVar7 + 0x114;
      if ((*(byte *)(iVar7 + 0x54) & 2) != 0) {
        do {
          iVar3 = (&CSWTCH_1514)[iVar6];
          iVar6 = iVar6 + 1;
          iVar2 = iVar7 + 0x58 + iVar3 * 4;
          JumpConnector::TryToConnect((JumpConnector *)&local_34,iVar7,iVar5,iVar2,iVar3);
          iVar1 = iVar5 + -0xbc;
          iVar5 = iVar5 + 4;
          JumpConnector::TryToConnect((JumpConnector *)&local_34,iVar7,iVar1,iVar2,iVar3);
        } while (iVar6 != 4);
      }
      local_48 = local_48 + 1;
    } while (local_48 < DAT_00fe6000);
  }
  RemoveJumpAreas(this);
  HandleObstacleTopAreas(this);
  FixCornerOnCornerAreas(this);
  FixConnections();
  if ((*(int *)(this + 0x528) != 2) && (0 < *(int *)(this + 0x51c))) {
    iVar5 = 0;
    do {
      iVar7 = iVar5 * 4;
      iVar5 = iVar5 + 1;
      CNavLadder::ConnectGeneratedLadder(*(CNavLadder **)(*(int *)(this + 0x510) + iVar7),0.0);
    } while (iVar5 < *(int *)(this + 0x51c));
    return;
  }
  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)