L L4D2node

CNavMesh::FindActiveNavArea

0x00709fd0 · 3079 bytes · __thiscall

_ZN8CNavMesh17FindActiveNavAreaEv

Decompiled

undefined (1 param)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CNavMesh::FindActiveNavArea() */

char __thiscall CNavMesh::FindActiveNavArea(CNavMesh *this)

{
  float fVar1;
  float fVar2;
  char cVar3;
  int *piVar4;
  int iVar5;
  int iVar6;
  undefined4 uVar7;
  char cVar8;
  CNavMesh CVar9;
  longdouble lVar10;
  float fVar11;
  float fVar12;
  float fVar13;
  float fVar14;
  float fVar15;
  float fVar16;
  float fVar17;
  bool bVar18;
  CTraceFilterSimple *this_00;
  Vector *pVVar19;
  CNavArea *in_stack_fffffe88;
  float local_148;
  undefined4 local_124;
  undefined4 local_120;
  undefined4 local_11c;
  undefined4 local_118;
  int local_114;
  float local_110;
  float local_10c;
  float local_108;
  float local_104;
  float local_100;
  float local_fc;
  float local_f8;
  float local_f4;
  float local_f0;
  float local_ec;
  float local_e8;
  float local_e4;
  undefined **local_e0 [4];
  undefined4 local_d0;
  float local_cc;
  float local_c8;
  float local_c4;
  float local_bc;
  float local_b8;
  float local_b4;
  undefined4 local_ac;
  undefined4 local_a8;
  undefined4 local_a4;
  undefined4 local_9c;
  undefined4 local_98;
  undefined4 local_94;
  undefined4 local_8c;
  undefined1 local_88;
  undefined1 local_87;
  Vector local_70 [12];
  float local_64;
  float local_60;
  float local_5c;
  float local_58;
  float local_54;
  float local_50;
  float local_44;
  undefined4 local_40;
  byte bStack_3d;
  short local_30;
  
  local_124 = 0;
  local_120 = 0;
  if (___atan2f_finite == 0) {
    local_114 = 0;
  }
  else {
    in_stack_fffffe88 = (CNavArea *)0x0;
    (**(code **)(___atan2f_finite + 0x50))
              (___atan2f_finite,&local_124,0,0,0,0,"/data/src/game/server/nav_edit.cpp",0x13f,
               &FindActiveNavArea()::tm_fmt,"(%s)%s","Unaccounted","CNavMesh::FindActiveNavArea");
    local_114 = ___atan2f_finite;
  }
  iVar5 = _DAT_0105db00;
  local_11c = local_124;
  local_118 = local_120;
                    /* try { // try from 0070a526 to 0070a574 has its CatchHandler @ 0070ac25 */
  if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
     (iVar6 = ThreadGetCurrentId(), iVar5 == iVar6)) {
    if ((char *)*_DAT_0105d15c != "CNavMesh::FindActiveNavArea") {
      _DAT_0105d15c =
           (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xca1ee1,(char *)0x1,0xbfafa1);
    }
    CVProfNode::EnterScope();
    DAT_0105d158 = '\0';
  }
  this[0x48d] = (CNavMesh)0x0;
  *(undefined4 *)(this + 0x490) = 0;
  *(undefined4 *)(this + 0x474) = 0;
  this[0x494] = (CNavMesh)0x0;
  *(undefined4 *)(this + 0x4bc) = 0;
                    /* try { // try from 0070a0cb to 0070a403 has its CatchHandler @ 0070ac3d */
  piVar4 = (int *)UTIL_GetListenServerHost();
  if (piVar4 == (int *)0x0) {
LAB_0070a8e0:
    cVar8 = '\0';
    goto LAB_0070a5c5;
  }
  GetEditVectors((Vector *)&local_110,(Vector *)&local_104);
  if (*(int *)(nav_create_area_at_feet._28_4_ + 0x30) == 0) {
    cVar8 = '\0';
    fVar11 = 2000.0;
  }
  else {
    if (local_fc < 0.0) {
                    /* try { // try from 0070aaab to 0070ac1f has its CatchHandler @ 0070ac3d */
      iVar5 = (**(code **)(*piVar4 + 0x250))(piVar4);
      if (*(float *)(iVar5 + 8) != 0.0) {
        cVar8 = '\x01';
        fVar11 = (*(float *)(iVar5 + 8) * 2000.0) / (-local_fc * 2000.0);
        goto LAB_0070a12d;
      }
    }
    fVar11 = 2000.0;
    cVar8 = '\0';
  }
LAB_0070a12d:
  this_00 = (CTraceFilterSimple *)local_e0;
  local_f4 = local_100 * fVar11 + local_10c;
  local_f8 = local_104 * fVar11 + local_110;
  local_f0 = fVar11 * local_fc + local_108;
  CTraceFilterSimple::CTraceFilterSimple
            (this_00,(IHandleEntity *)0x0,0,(_func_bool_IHandleEntity_ptr_int *)0x0);
  pVVar19 = local_70;
  local_e0[0] = &PTR_ShouldHitEntity_00ca1b68;
  local_d0 = 0xf;
  local_bc = local_f8 - local_110;
  local_b4 = local_f0 - local_108;
  local_b8 = local_f4 - local_10c;
  local_94 = 0;
  local_98 = 0;
  local_9c = 0;
  local_88 = 1;
  local_a4 = 0;
  local_8c = 0;
  local_a8 = 0;
  local_ac = 0;
  local_cc = local_110;
  local_c8 = local_10c;
  local_87 = local_bc * local_bc + local_b4 * local_b4 + local_b8 * local_b8 != 0.0;
  local_c4 = local_108;
  (**(code **)(*enginetrace + 0x14))
            (enginetrace,&local_cc,
             (-(uint)(*(int *)(nav_solid_props._28_4_ + 0x30) == 0) & 0xfe000000) + 0x202420b);
  if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
    in_stack_fffffe88 = (CNavArea *)0x1;
    pVVar19 = (Vector *)0x0;
    this_00 = (CTraceFilterSimple *)0x0;
    DebugDrawLine(local_70,(Vector *)&local_64,0xff,0,0,true,-1.0);
  }
  bVar18 = SUB41(this,0);
  if (local_44 == 1.0) {
    if (cVar8 != '\0') {
      in_stack_fffffe88 = (CNavArea *)0x0;
      pVVar19 = (Vector *)0x1;
      this_00 = (CTraceFilterSimple *)0x1;
      SnapToGrid((Vector *)&local_cc,bVar18,SUB41(&local_64,0),true);
      *(float *)(this + 0x464) = local_cc;
      *(float *)(this + 0x468) = local_c8;
      *(float *)(this + 0x46c) = local_c4;
    }
    if (*(int *)(this + 0x458) - 2U < 2) goto LAB_0070a8e0;
    if (*(int *)(this + 0x18) != 0) {
      FindNavAreaOrLadderAlongRay
                (this + 0x474,(Vector *)(this + 0x4bc),(Vector *)0x0,(CNavArea **)this_00,
                 (CNavLadder **)pVVar19,in_stack_fffffe88);
    }
    if ((*(int *)(this + 0x474) == 0) && (*(int *)(this + 0x4bc) == 0)) goto LAB_0070a5c5;
  }
  else {
    if (*(int *)(this + 0x458) == 2) {
LAB_0070a648:
      if (this[0x494] == (CNavMesh)0x0) {
LAB_0070a9ae:
        iVar5 = *(int *)(this + 0x458);
        goto LAB_0070a39e;
      }
LAB_0070a655:
      iVar5 = 0;
      local_148 = 40000.0;
      if (0 < *(int *)(this + 0x51c)) {
        do {
          iVar6 = *(int *)(*(int *)(this + 0x510) + iVar5 * 4);
          local_ec = 0.0;
          fVar11 = *(float *)(iVar6 + 0x14);
          fVar15 = *(float *)(iVar6 + 8);
          fVar1 = *(float *)(iVar6 + 0x18);
          fVar13 = *(float *)(iVar6 + 0x10);
          fVar2 = *(float *)(iVar6 + 0xc);
          fVar17 = *(float *)(iVar6 + 4);
          local_e8 = 0.0;
          local_e4 = 0.0;
          local_cc = 0.0;
          local_c8 = 0.0;
          local_c4 = 0.0;
                    /* try { // try from 0070a725 to 0070a9ed has its CatchHandler @ 0070ac3d */
          VectorVectors((Vector *)(iVar6 + 0x40),(Vector *)&local_ec,(Vector *)&local_cc);
          fVar12 = *(float *)(iVar6 + 0x20) * 0.5;
          fVar14 = *(float *)(this + 0x464);
          local_ec = local_ec * fVar12;
          local_e8 = local_e8 * fVar12;
          local_e4 = fVar12 * local_e4;
          fVar16 = -local_ec;
          fVar12 = fVar16;
          if (local_ec <= fVar16) {
            fVar12 = local_ec;
          }
          if (fVar12 + -5.0 + fVar13 <= fVar14) {
            fVar13 = local_ec;
            if (local_ec <= fVar16) {
              fVar13 = fVar16;
            }
            if (fVar14 <= fVar13 + 5.0 + fVar17) {
              fVar17 = -local_e8;
              fVar13 = fVar17;
              if (local_e8 <= fVar17) {
                fVar13 = local_e8;
              }
              if (fVar13 + -5.0 + fVar11 <= *(float *)(this + 0x468)) {
                fVar11 = local_e8;
                if (local_e8 <= fVar17) {
                  fVar11 = fVar17;
                }
                if (((*(float *)(this + 0x468) <= fVar11 + 5.0 + fVar15) &&
                    (fVar1 + -5.0 <= *(float *)(this + 0x46c))) &&
                   (*(float *)(this + 0x46c) <= fVar2 + 5.0)) {
                  *(int *)(this + 0x4bc) = iVar6;
                  break;
                }
              }
            }
          }
          if ((this[0x494] != (CNavMesh)0x0) &&
             (fVar14 = (*(float *)(iVar6 + 4) + *(float *)(iVar6 + 0x10)) * 0.5 - fVar14,
             fVar11 = (*(float *)(iVar6 + 0xc) + *(float *)(iVar6 + 0x18)) * 0.5 -
                      *(float *)(this + 0x46c),
             fVar15 = (*(float *)(iVar6 + 8) + *(float *)(iVar6 + 0x14)) * 0.5 -
                      *(float *)(this + 0x468),
             fVar11 = fVar11 * fVar11 + fVar15 * fVar15 + fVar14 * fVar14, fVar11 < local_148)) {
            *(int *)(this + 0x4bc) = iVar6;
            local_148 = fVar11;
          }
          iVar5 = iVar5 + 1;
        } while (iVar5 < *(int *)(this + 0x51c));
      }
    }
    else {
      iVar5 = (**(code **)(*physprops + 0x18))(physprops,(int)local_30);
      CVar9 = (CNavMesh)(*(char *)(iVar5 + 0x4e) != '\0');
      this[0x494] = CVar9;
      if (!(bool)CVar9) {
        *(float *)(this + 0x498) = local_58;
        *(float *)(this + 0x49c) = local_54;
        CVar9 = (CNavMesh)(bStack_3d >> 5 & 1);
        *(float *)(this + 0x4a0) = local_50;
        this[0x494] = CVar9;
        if (CVar9 != (CNavMesh)0x0) goto LAB_0070a37b;
        goto LAB_0070a9ae;
      }
      *(float *)(this + 0x498) = local_58;
      *(float *)(this + 0x49c) = local_54;
      *(float *)(this + 0x4a0) = local_50;
LAB_0070a37b:
      iVar5 = *(int *)(this + 0x458);
      if ((iVar5 == 3) &&
         (((local_58 != *(float *)(this + 0x4b0) || (local_54 != *(float *)(this + 0x4b4))) ||
          (local_50 != *(float *)(this + 0x4b8))))) {
        this[0x494] = (CNavMesh)0x0;
      }
      if (local_50 <= 0.9) goto LAB_0070a648;
      this[0x494] = (CNavMesh)0x0;
LAB_0070a39e:
      if (iVar5 != 2) goto LAB_0070a655;
    }
    *(float *)(this + 0x464) = local_64;
    *(float *)(this + 0x468) = local_60;
    *(float *)(this + 0x46c) = local_5c;
    if ((this[0x494] == (CNavMesh)0x0) && (*(int *)(this + 0x4bc) == 0)) {
      local_c8 = local_100 * 100.0 + local_60;
      local_c4 = local_fc * 100.0 + local_5c;
      local_cc = local_104 * 100.0 + local_64;
      if (*(int *)(this + 0x18) != 0) {
        FindNavAreaOrLadderAlongRay
                  (this + 0x474,(Vector *)(this + 0x4bc),(Vector *)0x0,(CNavArea **)this_00,
                   (CNavLadder **)pVVar19,in_stack_fffffe88);
      }
      if (*(int *)(this + 0x474) != 0) goto LAB_0070a3f3;
      if (*(int *)(this + 0x4bc) == 0) {
        uVar7 = GetNearestNavArea(TheNavMesh,(Vector *)&local_64,false,500.0,false,true,false);
        *(undefined4 *)(this + 0x474) = uVar7;
        goto LAB_0070a3e5;
      }
    }
    else {
LAB_0070a3e5:
      if (*(int *)(this + 0x474) != 0) {
LAB_0070a3f3:
        iVar5 = (**(code **)(*piVar4 + 0x238))(piVar4);
        for (fVar11 = *(float *)(iVar5 + 4); 360.0 < fVar11; fVar11 = fVar11 - 360.0) {
        }
        for (; fVar11 < 0.0; fVar11 = fVar11 + 360.0) {
        }
        if (((fVar11 < 45.0) || (315.0 < fVar11)) || ((fVar11 < 225.0 && (135.0 < fVar11)))) {
          lVar10 = (longdouble)SnapToGrid(this,local_60,true);
          this[0x48d] = (CNavMesh)0x1;
          *(float *)(this + 0x490) = (float)lVar10;
        }
        else {
          lVar10 = (longdouble)SnapToGrid(this,local_64,true);
          this[0x48d] = (CNavMesh)0x0;
          *(float *)(this + 0x490) = (float)lVar10;
        }
      }
    }
    if ((this[0x494] == (CNavMesh)0x0) && (*(int *)(this + 0x458) != 3)) {
      SnapToGrid((Vector *)&local_cc,bVar18,(bool)(bVar18 + 'd'),true);
      *(float *)(this + 0x464) = local_cc;
      *(float *)(this + 0x468) = local_c8;
      *(float *)(this + 0x46c) = local_c4;
    }
  }
  cVar8 = '\x01';
LAB_0070a5c5:
  iVar5 = _DAT_0105db00;
  if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
     (iVar6 = ThreadGetCurrentId(), iVar5 == iVar6)) {
    cVar3 = CVProfNode::ExitScope();
    if (cVar3 != '\0') {
      _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
    }
    DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
  }
  if (local_114 != 0) {
    (**(code **)(local_114 + 0x54))(local_114,local_11c,local_118,0,0,0);
  }
  return cVar8;
}

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)