L L4D2node

CNavMesh::GetNavAreaWithLargestPortal

0x0073bf10 · 917 bytes · __thiscall

_ZNK8CNavMesh27GetNavAreaWithLargestPortalERK6VectorP8CNavArea10NavDirTypef

Decompiled

undefined (5 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CNavMesh::GetNavAreaWithLargestPortal(Vector const&, CNavArea*, NavDirType, float) const */

CNavArea * __thiscall
CNavMesh::GetNavAreaWithLargestPortal
          (CNavMesh *this,float *param_1,CNavArea *param_2,undefined4 param_4,float param_5)

{
  int *piVar1;
  float fVar2;
  char cVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  int iVar7;
  CNavArea *this_00;
  longdouble lVar8;
  float local_6c;
  CNavArea *local_68;
  float local_64;
  float local_50;
  undefined4 local_4c;
  undefined4 local_48;
  undefined4 local_40;
  undefined4 local_3c;
  int local_38;
  float local_34;
  float local_30;
  float local_2c;
  undefined1 local_28 [24];
  
  local_4c = 0;
  local_48 = 0;
  if (___atan2f_finite == 0) {
    local_38 = 0;
  }
  else {
    (**(code **)(___atan2f_finite + 0x50))
              (___atan2f_finite,&local_4c,0,0,0,0,"/data/src/game/server/nav_mesh.cpp",0x29e,
               &GetNavAreaWithLargestPortal(Vector_const&,CNavArea*,NavDirType,float)::tm_fmt,
               "(%s)%s","Unaccounted","CNavMesh::GetNavAreaWithLargestPortal");
    local_38 = ___atan2f_finite;
  }
  iVar6 = _DAT_0105db00;
  local_40 = local_4c;
  local_3c = local_48;
                    /* try { // try from 0073c1ee to 0073c23c has its CatchHandler @ 0073c2b5 */
  if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
     (iVar4 = ThreadGetCurrentId(), iVar6 == iVar4)) {
    if ((char *)*_DAT_0105d15c != "CNavMesh::GetNavAreaWithLargestPortal") {
      _DAT_0105d15c =
           (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xca64bc,(char *)0x1,0xbfafa1);
    }
    CVProfNode::EnterScope();
    DAT_0105d158 = '\0';
  }
  if (*(int *)(this + 0x18) != 0) {
    iVar6 = *(int *)(this + 0x24);
    local_34 = *param_1;
    iVar4 = (int)((local_34 - *(float *)(this + 0x2c)) / *(float *)(this + 0x20));
    if (iVar4 < 0) {
      iVar4 = 0;
    }
    else if (iVar6 <= iVar4) {
      iVar4 = iVar6 + -1;
    }
    local_30 = param_1[1];
    iVar5 = 0;
    iVar7 = (int)((local_30 - *(float *)(this + 0x30)) / *(float *)(this + 0x20));
    if (-1 < iVar7) {
      if (iVar7 < *(int *)(this + 0x28)) {
        iVar5 = iVar7 * iVar6;
      }
      else {
        iVar5 = (*(int *)(this + 0x28) + -1) * iVar6;
      }
    }
    piVar1 = (int *)(*(int *)(this + 0xc) + (iVar4 + iVar5) * 0x14);
    local_2c = param_1[2] + 5.0;
    if (0 < piVar1[3]) {
      iVar6 = 0;
      local_68 = (CNavArea *)0x0;
      local_6c = 1.1754944e-38;
      local_64 = -1e+08;
      do {
        while( true ) {
          this_00 = *(CNavArea **)(*piVar1 + iVar6 * 4);
                    /* try { // try from 0073c0b3 to 0073c13e has its CatchHandler @ 0073c2ca */
          cVar3 = CNavArea::IsOverlapping(this_00,(Vector *)&local_34,0.0);
          if (cVar3 != '\0') break;
LAB_0073c090:
          iVar6 = iVar6 + 1;
          this_00 = local_68;
          if (piVar1[3] <= iVar6) goto LAB_0073c18b;
        }
        lVar8 = (longdouble)CNavArea::GetZ(this_00,local_34,local_30);
        fVar2 = (float)lVar8;
        if (((local_2c < fVar2) || (fVar2 < param_1[2] - param_5)) ||
           ((fVar2 < local_64 || (cVar3 = CNavArea::IsOverlapping(this_00,param_2), cVar3 != '\0')))
           ) goto LAB_0073c090;
        CNavArea::ComputePortal(param_2,this_00,param_4,local_28,&local_50);
        if ((local_50 < 1.0) || (local_50 < local_6c)) goto LAB_0073c090;
        iVar6 = iVar6 + 1;
        local_6c = local_50;
        local_68 = this_00;
        local_64 = fVar2;
      } while (iVar6 < piVar1[3]);
      goto LAB_0073c18b;
    }
  }
  this_00 = (CNavArea *)0x0;
LAB_0073c18b:
  iVar6 = _DAT_0105db00;
  if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
     (iVar4 = ThreadGetCurrentId(), iVar6 == iVar4)) {
    cVar3 = CVProfNode::ExitScope();
    if (cVar3 != '\0') {
      _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
    }
    DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
  }
  if (local_38 != 0) {
    (**(code **)(local_38 + 0x54))(local_38,local_40,local_3c,0,0,0);
  }
  return this_00;
}

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)