L L4D2node

CNavArea::PostLoad

0x0071b360 · 984 bytes · __thiscall

_ZN8CNavArea8PostLoadEv

Decompiled

undefined (1 param)

/* CNavArea::PostLoad() */

undefined4 __thiscall CNavArea::PostLoad(CNavArea *this)

{
  uint *puVar1;
  int iVar2;
  int iVar3;
  int *piVar4;
  uint uVar5;
  int iVar6;
  longdouble lVar7;
  float fVar8;
  float fVar9;
  float fVar10;
  undefined4 local_3c;
  CNavArea *local_38;
  int local_34;
  int local_30;
  undefined4 local_28;
  undefined4 local_24;
  float local_20;
  
  local_28 = *(undefined4 *)(this + 0x2c);
  local_24 = *(undefined4 *)(this + 0x30);
  local_20 = *(float *)(this + 0x34) + 35.5;
  iVar2 = (**(code **)*enginetrace)(enginetrace,&local_28,0x2000b,0);
  if (iVar2 != 0) {
    *(uint *)(this + 0x54) = *(uint *)(this + 0x54) | 0x10000000;
  }
  local_34 = 0;
  local_3c = 0;
  do {
    piVar4 = *(int **)(this + local_34 * 4 + 0x68);
    if (0 < *piVar4) {
      iVar2 = 0;
      do {
        uVar5 = piVar4[iVar2 + 1];
        if (*(int *)(TheNavMesh + 0x51c) < 1) {
LAB_0071b420:
          iVar3 = CNavMesh::GetLadderByID(TheNavMesh,uVar5);
          piVar4[iVar2 + 1] = iVar3;
        }
        else if (uVar5 != **(uint **)(TheNavMesh + 0x510)) {
          iVar3 = 0;
          do {
            iVar3 = iVar3 + 1;
            if (iVar3 == *(int *)(TheNavMesh + 0x51c)) goto LAB_0071b420;
          } while ((*(uint **)(TheNavMesh + 0x510))[iVar3] != uVar5);
          if (iVar3 == -1) goto LAB_0071b420;
        }
        if ((uVar5 != 0) && (piVar4[iVar2 + 1] == 0)) {
          Msg(
             "CNavArea::PostLoad: Corrupt navigation ladder data. Cannot connect Navigation Areas.\n"
             );
          local_3c = 5;
        }
        iVar2 = iVar2 + 1;
        piVar4 = *(int **)(this + local_34 * 4 + 0x68);
      } while (iVar2 < *piVar4);
    }
    local_34 = local_34 + 1;
    if (local_34 == 2) {
      local_38 = this;
      do {
        piVar4 = *(int **)(local_38 + 0x58);
        if (0 < *piVar4) {
          iVar2 = 0;
          do {
            uVar5 = piVar4[iVar2 * 2 + 1];
            iVar3 = CNavMesh::GetNavAreaByID(TheNavMesh,uVar5);
            piVar4[iVar2 * 2 + 1] = iVar3;
            if ((uVar5 != 0) && (iVar3 == 0)) {
              Msg("CNavArea::PostLoad: Corrupt navigation data. Cannot connect Navigation Areas.\n")
              ;
              iVar3 = piVar4[iVar2 * 2 + 1];
              local_3c = 5;
            }
            iVar6 = iVar2 + 1;
            fVar8 = *(float *)(iVar3 + 0x30) - *(float *)(this + 0x30);
            fVar10 = *(float *)(iVar3 + 0x34) - *(float *)(this + 0x34);
            fVar9 = *(float *)(iVar3 + 0x2c) - *(float *)(this + 0x2c);
            piVar4[iVar2 * 2 + 2] = (int)SQRT(fVar8 * fVar8 + fVar10 * fVar10 + fVar9 * fVar9);
            piVar4 = *(int **)(local_38 + 0x58);
            iVar2 = iVar6;
          } while (iVar6 < *piVar4);
        }
        local_38 = local_38 + 4;
      } while (local_38 != this + 0x10);
      piVar4 = *(int **)(this + 0xd0);
      if (0 < *piVar4) {
        local_30 = 0;
        do {
          puVar1 = (uint *)piVar4[local_30 + 1];
          uVar5 = CNavMesh::GetNavAreaByID(TheNavMesh,*puVar1);
          *puVar1 = uVar5;
          if (uVar5 == 0) {
            Msg(
               "CNavArea::PostLoad: Corrupt navigation data. Missing \"from\" Navigation Area for Encounter Spot.\n"
               );
            local_3c = 5;
          }
          uVar5 = CNavMesh::GetNavAreaByID(TheNavMesh,puVar1[3]);
          puVar1[3] = uVar5;
          if (uVar5 == 0) {
            Msg(
               "CNavArea::PostLoad: Corrupt navigation data. Missing \"to\" Navigation Area for Encounter Spot.\n"
               );
            local_3c = 5;
          }
          if ((*puVar1 != 0) && (puVar1[3] != 0)) {
            ComputePortal(this,puVar1[3],puVar1[5],puVar1 + 9,&local_28);
            ComputePortal(this,*puVar1,puVar1[2],puVar1 + 6,&local_28);
            lVar7 = (longdouble)GetZ((CNavArea *)*puVar1,(float)puVar1[6],(float)puVar1[7]);
            puVar1[8] = (uint)((float)lVar7 + 35.5);
            lVar7 = (longdouble)GetZ((CNavArea *)puVar1[3],(float)puVar1[9],(float)puVar1[10]);
            puVar1[0xb] = (uint)((float)lVar7 + 35.5);
          }
          if (0 < (int)puVar1[0xf]) {
            iVar2 = 0;
            do {
              iVar3 = puVar1[0xc] + iVar2 * 8;
              iVar6 = GetHidingSpotByID(*(uint *)(iVar3 + 4));
              *(int *)(iVar3 + 4) = iVar6;
              if (iVar6 == 0) {
                Msg("CNavArea::PostLoad: Corrupt navigation data. Missing Hiding Spot\n");
                local_3c = 5;
              }
              iVar2 = iVar2 + 1;
            } while (iVar2 < (int)puVar1[0xf]);
          }
          local_30 = local_30 + 1;
          piVar4 = *(int **)(this + 0xd0);
        } while (local_30 < *piVar4);
      }
      (**(code **)(*g_pMaterialSystem + 0x1e0))(g_pMaterialSystem);
      return local_3c;
    }
  } while( true );
}

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)