L L4D2node

TerrorNavArea::GetNextEscapeStep

0x0097b9e0 · 1039 bytes · __thiscall

_ZNK13TerrorNavArea17GetNextEscapeStepEP15NavTraverseType

Decompiled

undefined (2 params)

/* TerrorNavArea::GetNextEscapeStep(NavTraverseType*) const */

int __thiscall TerrorNavArea::GetNextEscapeStep(TerrorNavArea *this,NavTraverseType *param_1)

{
  float fVar1;
  int iVar2;
  uint uVar3;
  int *piVar4;
  int iVar5;
  undefined *puVar6;
  int iVar7;
  int iVar8;
  CNavArea *this_00;
  TerrorNavArea *pTVar9;
  float fVar10;
  int local_60;
  CNavArea *local_50;
  int local_4c;
  Vector local_48 [8];
  float local_40;
  int local_3c;
  int local_38;
  float local_34;
  int *local_30;
  undefined4 local_2c;
  undefined4 local_28;
  int local_24;
  int *local_20;
  
  local_30 = (int *)0x0;
  local_2c = 0;
  local_28 = 0;
  local_24 = 0;
  local_20 = (int *)0x0;
  local_60 = 0;
  do {
    piVar4 = *(int **)(this + local_60 * 4 + 0x58);
    iVar8 = *piVar4;
    if (0 < iVar8) {
      iVar7 = 0;
      iVar5 = iVar8;
      do {
        if (iVar5 < 1) {
LAB_0097ba4b:
          this_00 = (CNavArea *)0x0;
        }
        else {
          iVar2 = 0;
          if (iVar7 != 0) {
            do {
              iVar2 = iVar2 + 1;
              if (iVar2 == iVar5) goto LAB_0097ba4b;
            } while (iVar7 != iVar2);
          }
          this_00 = (CNavArea *)piVar4[iVar2 * 2 + 1];
        }
                    /* try { // try from 0097ba5e to 0097bd14 has its CatchHandler @ 0097be0d */
        CNavArea::GetClosestPointOnArea((CNavArea *)this,(Vector *)(this_00 + 0x2c),local_48);
        CNavArea::GetClosestPointOnArea(this_00,(Vector *)(this + 0x2c),(Vector *)&local_3c);
        fVar10 = local_34 - local_40;
        if ((fVar10 < *(float *)(NavFlowMaxSurvivorClimbHeight._28_4_ + 0x2c) ||
             fVar10 == *(float *)(NavFlowMaxSurvivorClimbHeight._28_4_ + 0x2c)) &&
           (-fVar10 < *(float *)(NavFlowMaxSurvivorDropHeight._28_4_ + 0x2c) ||
            -fVar10 == *(float *)(NavFlowMaxSurvivorDropHeight._28_4_ + 0x2c))) {
          local_4c = local_60;
          local_50 = this_00;
          CUtlVector<Info,CUtlMemory<Info,int>>::InsertBefore
                    ((CUtlVector<Info,CUtlMemory<Info,int>> *)&local_30,local_24,(Info *)&local_50);
        }
        if (iVar7 + 1 == iVar8) break;
        iVar7 = iVar7 + 1;
        piVar4 = *(int **)(this + local_60 * 4 + 0x58);
        iVar5 = *piVar4;
      } while( true );
    }
    local_60 = local_60 + 1;
  } while (local_60 != 4);
  if ((this != (TerrorNavArea *)0xffffff98) && (piVar4 = *(int **)(this + 0x68), 0 < *piVar4)) {
    iVar8 = 0;
    do {
      while( true ) {
        iVar5 = piVar4[iVar8 + 1];
        uVar3 = *(uint *)(iVar5 + 0x38);
        if ((((uVar3 != 0xffffffff) &&
             (puVar6 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar6 != (undefined *)0xfffffffc))
            && (*(uint *)(puVar6 + 8) == uVar3 >> 0xc)) &&
           ((*(CBaseEntity **)(puVar6 + 4) != (CBaseEntity *)0x0 &&
            (uVar3 = CBaseEntity::GetTeamNumber(*(CBaseEntity **)(puVar6 + 4)),
            (uVar3 & 0xfffffffd) != 0)))) break;
        if (*(int *)(iVar5 + 0x24) != 0) {
          local_38 = 4;
          local_3c = *(int *)(iVar5 + 0x24);
          CUtlVector<Info,CUtlMemory<Info,int>>::InsertBefore
                    ((CUtlVector<Info,CUtlMemory<Info,int>> *)&local_30,local_24,(Info *)&local_3c);
        }
        if (*(int *)(iVar5 + 0x28) != 0) {
          local_38 = 4;
          local_3c = *(int *)(iVar5 + 0x28);
          CUtlVector<Info,CUtlMemory<Info,int>>::InsertBefore
                    ((CUtlVector<Info,CUtlMemory<Info,int>> *)&local_30,local_24,(Info *)&local_3c);
        }
        if (*(int *)(iVar5 + 0x2c) != 0) {
          local_38 = 4;
          local_3c = *(int *)(iVar5 + 0x2c);
          CUtlVector<Info,CUtlMemory<Info,int>>::InsertBefore
                    ((CUtlVector<Info,CUtlMemory<Info,int>> *)&local_30,local_24,(Info *)&local_3c);
        }
        piVar4 = *(int **)(this + 0x68);
        iVar8 = iVar8 + 1;
        if (*piVar4 <= iVar8) goto LAB_0097bc10;
      }
      piVar4 = *(int **)(this + 0x68);
      iVar8 = iVar8 + 1;
    } while (iVar8 < *piVar4);
  }
LAB_0097bc10:
  if ((this != (TerrorNavArea *)0xffffff94) && (piVar4 = *(int **)(this + 0x6c), 0 < *piVar4)) {
    iVar8 = 0;
    do {
      while( true ) {
        iVar5 = piVar4[iVar8 + 1];
        uVar3 = *(uint *)(iVar5 + 0x38);
        if ((((uVar3 != 0xffffffff) &&
             (puVar6 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar6 != (undefined *)0xfffffffc))
            && (*(uint *)(puVar6 + 8) == uVar3 >> 0xc)) &&
           ((*(CBaseEntity **)(puVar6 + 4) != (CBaseEntity *)0x0 &&
            (uVar3 = CBaseEntity::GetTeamNumber(*(CBaseEntity **)(puVar6 + 4)),
            (uVar3 & 0xfffffffd) != 0)))) break;
        iVar5 = *(int *)(iVar5 + 0x34);
        if (iVar5 != 0) {
          local_38 = 5;
          local_3c = iVar5;
          CUtlVector<Info,CUtlMemory<Info,int>>::InsertBefore
                    ((CUtlVector<Info,CUtlMemory<Info,int>> *)&local_30,local_24,(Info *)&local_3c);
        }
        piVar4 = *(int **)(this + 0x6c);
        iVar8 = iVar8 + 1;
        if (*piVar4 <= iVar8) goto LAB_0097bcb0;
      }
      piVar4 = *(int **)(this + 0x6c);
      iVar8 = iVar8 + 1;
    } while (iVar8 < *piVar4);
  }
LAB_0097bcb0:
  if ((CNavArea::GetElevatorAreas()::empty == '\0') &&
     (iVar8 = __cxa_guard_acquire(&CNavArea::GetElevatorAreas()::empty), iVar8 != 0)) {
    if ((CUtlVectorUltraConservative<NavConnect,CUtlVectorUltraConservativeAllocator>::StaticData()
         ::staticData == '\0') &&
       (iVar8 = __cxa_guard_acquire(&CUtlVectorUltraConservative<NavConnect,CUtlVectorUltraConservativeAllocator>
                                     ::StaticData()::staticData), iVar8 != 0)) {
      __cxa_guard_release(&CUtlVectorUltraConservative<NavConnect,CUtlVectorUltraConservativeAllocator>
                           ::StaticData()::staticData);
    }
    CNavArea::GetElevatorAreas()::empty =
         &CUtlVectorUltraConservative<NavConnect,CUtlVectorUltraConservativeAllocator>::StaticData()
          ::staticData;
    __cxa_guard_release(&CNavArea::GetElevatorAreas()::empty);
    __cxa_atexit(CUtlVectorUltraConservative<NavConnect,CUtlVectorUltraConservativeAllocator>::
                 ~CUtlVectorUltraConservative,&CNavArea::GetElevatorAreas()::empty,&__dso_handle);
  }
  pTVar9 = (TerrorNavArea *)&CNavArea::GetElevatorAreas()::empty;
  if (((byte)this[0x57] & 0x40) != 0) {
    pTVar9 = this + 0x88;
  }
  iVar8 = 0;
  piVar4 = *(int **)pTVar9;
  if (0 < *piVar4) {
    do {
      local_3c = piVar4[iVar8 * 2 + 1];
      local_38 = (uint)(*(float *)(this + 0x34) <= *(float *)(local_3c + 0x34) &&
                       *(float *)(local_3c + 0x34) != *(float *)(this + 0x34)) * 2 + 5;
      CUtlVector<Info,CUtlMemory<Info,int>>::InsertBefore
                ((CUtlVector<Info,CUtlMemory<Info,int>> *)&local_30,local_24,(Info *)&local_3c);
      piVar4 = *(int **)pTVar9;
      iVar8 = iVar8 + 1;
    } while (iVar8 < *piVar4);
  }
  iVar8 = 0;
  if (0 < local_24) {
    iVar8 = 0;
    fVar10 = -1e+07;
    piVar4 = local_30;
    do {
      iVar5 = *piVar4;
      if ((((*(uint *)(iVar5 + 0x54) & 0x70000) == 0) &&
          (fVar1 = *(float *)(iVar5 + 0x154), fVar10 < fVar1)) &&
         (iVar8 = iVar5, fVar10 = fVar1, param_1 != (NavTraverseType *)0x0)) {
        *(int *)param_1 = piVar4[1];
      }
      piVar4 = piVar4 + 2;
    } while (piVar4 != local_30 + local_24 * 2);
  }
  local_24 = 0;
  CUtlMemory<Info,int>::Purge((CUtlMemory<Info,int> *)&local_30);
  local_20 = local_30;
  CUtlMemory<Info,int>::Purge((CUtlMemory<Info,int> *)&local_30);
  return iVar8;
}

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)