L L4D2node

CNavMesh::GetNavArea

0x0073c2e0 · 1567 bytes · __thiscall

_ZNK8CNavMesh10GetNavAreaEP11CBaseEntityif

Decompiled

undefined (4 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CNavMesh::GetNavArea(CBaseEntity*, int, float) const */

CNavArea * __thiscall
CNavMesh::GetNavArea(CNavMesh *this,CBaseEntity *param_1,int param_2,float param_3)

{
  float fVar1;
  CNavArea *this_00;
  char cVar2;
  int iVar3;
  int *piVar4;
  int iVar5;
  int iVar6;
  int iVar7;
  longdouble lVar8;
  CNavArea *local_114;
  float local_110;
  float local_10c;
  undefined4 local_fc;
  undefined4 local_f8;
  undefined4 local_f4;
  undefined4 local_f0;
  int local_ec;
  float local_e8;
  float local_e4;
  float local_e0;
  CTraceFilterSimple local_dc [16];
  float local_cc;
  float local_c8;
  float local_c4;
  undefined4 local_bc;
  undefined4 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];
  Vector local_64 [8];
  float local_5c;
  float local_44;
  
  local_fc = 0;
  local_f8 = 0;
  if (___atan2f_finite == 0) {
    local_ec = 0;
  }
  else {
    (**(code **)(___atan2f_finite + 0x50))
              (___atan2f_finite,&local_fc,0,0,0,0,"/data/src/game/server/nav_mesh.cpp",0x2e0,
               &GetNavArea(CBaseEntity*,int,float)::tm_fmt,"(%s)%s","Unaccounted",
               "CNavMesh::GetNavArea [ent]");
    local_ec = ___atan2f_finite;
  }
  iVar6 = _DAT_0105db00;
  local_f4 = local_fc;
  local_f0 = local_f8;
                    /* try { // try from 0073c3af to 0073c3b3 has its CatchHandler @ 0073c92f */
  if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
     (iVar3 = ThreadGetCurrentId(), iVar6 == iVar3)) {
    if ((char *)*_DAT_0105d15c != "CNavMesh::GetNavArea [ent]") {
                    /* try { // try from 0073c74f to 0073c760 has its CatchHandler @ 0073c92f */
      _DAT_0105d15c =
           (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xca59ee,(char *)0x1,0xbfafa1);
    }
    CVProfNode::EnterScope();
    DAT_0105d158 = '\0';
  }
  if (*(int *)(this + 0x18) != 0) {
    if (((byte)param_1[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition(param_1);
    }
    local_e8 = *(float *)(param_1 + 0x2e0);
    local_e4 = *(float *)(param_1 + 0x2e4);
    local_e0 = *(float *)(param_1 + 0x2e8);
                    /* try { // try from 0073c3fd to 0073c630 has its CatchHandler @ 0073c90b */
    piVar4 = (int *)(**(code **)(*(int *)param_1 + 0x144))(param_1);
    if (piVar4 == (int *)0x0) {
      local_10c = 0.001;
    }
    else {
      local_114 = (CNavArea *)(**(code **)(*piVar4 + 0x52c))(piVar4);
      if ((local_114 == (CNavArea *)0x0) ||
         (cVar2 = CNavArea::IsOverlapping(local_114,(Vector *)&local_e8,0.0), cVar2 == '\0')) {
        local_10c = 18.0;
      }
      else {
        lVar8 = (longdouble)CNavArea::GetZ(local_114,local_e8,local_e4);
        if (((float)lVar8 <= local_e0 + 18.0) && (local_e0 - 18.0 <= (float)lVar8))
        goto LAB_0073c67f;
        local_10c = 18.0;
      }
    }
    iVar6 = *(int *)(this + 0x24);
    iVar3 = (int)((local_e8 - *(float *)(this + 0x2c)) / *(float *)(this + 0x20));
    if (iVar3 < 0) {
      iVar3 = 0;
    }
    else if (iVar6 <= iVar3) {
      iVar3 = iVar6 + -1;
    }
    iVar5 = 0;
    iVar7 = (int)((local_e4 - *(float *)(this + 0x30)) / *(float *)(this + 0x20));
    if (-1 < iVar7) {
      if (iVar7 < *(int *)(this + 0x28)) {
        iVar5 = iVar7 * iVar6;
      }
      else {
        iVar5 = (*(int *)(this + 0x28) + -1) * iVar6;
      }
    }
    piVar4 = (int *)(*(int *)(this + 0xc) + (iVar3 + iVar5) * 0x14);
    if (0 < piVar4[3]) {
      iVar6 = 0;
      local_114 = (CNavArea *)0x0;
      local_110 = -1e+08;
      do {
        while( true ) {
          this_00 = *(CNavArea **)(*piVar4 + iVar6 * 4);
          cVar2 = CNavArea::IsOverlapping(this_00,(Vector *)&local_e8,0.0);
          if (cVar2 != '\0') break;
LAB_0073c5e0:
          iVar6 = iVar6 + 1;
          if (piVar4[3] <= iVar6) goto LAB_0073c648;
        }
        if (((param_2 & 2U) != 0) || (cVar2 = CNavArea::IsBlocked(this_00,-1,false), cVar2 == '\0'))
        {
          lVar8 = (longdouble)CNavArea::GetZ(this_00,local_e8,local_e4);
          fVar1 = (float)lVar8;
          if (((fVar1 <= local_10c + local_e0) && (local_e0 - param_3 <= fVar1)) &&
             (local_110 < fVar1)) {
            local_114 = this_00;
            local_110 = fVar1;
          }
          goto LAB_0073c5e0;
        }
        iVar6 = iVar6 + 1;
      } while (iVar6 < piVar4[3]);
LAB_0073c648:
      if (((local_114 == (CNavArea *)0x0) || (param_2 == 0)) || (local_e0 - local_10c <= local_110))
      goto LAB_0073c67f;
      local_bc = 0;
      local_b8 = 0;
      local_b4 = local_110 - local_e0;
      local_94 = 0;
      local_98 = 0;
      local_9c = 0;
      local_a4 = 0;
      local_a8 = 0;
      local_ac = 0;
      local_87 = local_b4 * local_b4 != 0.0;
      local_cc = local_e8;
      local_8c = 0;
      local_88 = 1;
      local_c8 = local_e4;
      local_c4 = local_e0;
                    /* try { // try from 0073c85b to 0073c8cc has its CatchHandler @ 0073c90b */
      CTraceFilterSimple::CTraceFilterSimple
                (local_dc,(IHandleEntity *)0x0,0,(_func_bool_IHandleEntity_ptr_int *)0x0);
      (**(code **)(*enginetrace + 0x14))(enginetrace,&local_cc,0x2420b,local_dc,local_70);
      if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
        DebugDrawLine(local_70,local_64,0xff,0,0,true,-1.0);
      }
      if ((local_44 == 1.0) || (ABS(local_5c - local_110) <= local_10c)) goto LAB_0073c67f;
    }
  }
  local_114 = (CNavArea *)0x0;
LAB_0073c67f:
  iVar6 = _DAT_0105db00;
  if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
     (iVar3 = ThreadGetCurrentId(), iVar6 == iVar3)) {
    cVar2 = CVProfNode::ExitScope();
    if (cVar2 != '\0') {
      _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
    }
    DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
  }
  if (local_ec != 0) {
    (**(code **)(local_ec + 0x54))(local_ec,local_f4,local_f0,0,0,0);
  }
  return local_114;
}

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)