L L4D2node

Path::ComputeWithOpenGoal

0x003e3c20 · 3015 bytes · __thiscall

_ZN4Path19ComputeWithOpenGoalEP8INextBotRK9IPathCostRK21IPathOpenGoalSelectorf

Decompiled

undefined (5 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* Path::ComputeWithOpenGoal(INextBot*, IPathCost const&, IPathOpenGoalSelector const&, float) */

undefined4 __thiscall
Path::ComputeWithOpenGoal
          (Path *this,INextBot *param_1,IPathCost *param_2,IPathOpenGoalSelector *param_3,
          float param_4)

{
  uint *puVar1;
  float fVar2;
  byte bVar3;
  CNavArea *this_00;
  CNavArea *this_01;
  char cVar4;
  CBaseEntity *pCVar5;
  int iVar6;
  IPathCost *pIVar7;
  CNavArea *this_02;
  Vector *pVVar8;
  undefined4 uVar9;
  int iVar10;
  int iVar11;
  Path *pPVar12;
  int *piVar13;
  int iVar14;
  int iVar15;
  int iVar16;
  int iVar17;
  longdouble lVar18;
  int local_54;
  Path *local_50;
  undefined4 local_44;
  undefined4 local_40;
  undefined4 local_3c;
  undefined4 local_38;
  undefined4 local_34;
  undefined4 local_30;
  CNavArea *local_2c;
  undefined4 local_28;
  undefined4 local_24;
  CNavArea *local_20;
  
  local_44 = 0;
  local_40 = 0;
  if (_towlower == (CNavArea *)0x0) {
    local_2c = (CNavArea *)0x0;
  }
  else {
    (**(code **)(_towlower + 0x50))
              (_towlower,&local_44,0,0,0,0,"/data/src/game/server/nextbot/path/nextbotpath.h",0x18c,
               &ComputeWithOpenGoal(INextBot*,IPathCost_const&,IPathOpenGoalSelector_const&,float)::
                tm_fmt,"(%s)%s","NextBot","ComputeWithOpenGoal");
    local_2c = _towlower;
  }
  iVar6 = _DAT_0105db00;
  local_34 = local_44;
  local_30 = local_40;
                    /* try { // try from 003e4086 to 003e40e6 has its CatchHandler @ 003e483d */
  if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
     (iVar17 = ThreadGetCurrentId(), iVar6 == iVar17)) {
    if (*(char **)_DAT_0105d15c != "ComputeWithOpenGoal") {
      _DAT_0105d15c =
           (CNavArea *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xbfa154,(char *)0x0,0xca8906);
    }
    puVar1 = (uint *)(_DAT_0105d1e8 + 4 + *(int *)(_DAT_0105d15c + 0x70) * 8);
    *puVar1 = *puVar1 | 4;
    CVProfNode::EnterScope();
    DAT_0105d158 = '\0';
  }
                    /* try { // try from 003e3cdf to 003e3e60 has its CatchHandler @ 003e47fd */
  pCVar5 = (CBaseEntity *)(**(code **)(*(int *)param_1 + 0xb4))(param_1);
  iVar6 = CBaseEntity::GetTeamNumber(pCVar5);
  pIVar7 = (IPathCost *)(**(code **)(*(int *)param_1 + 0xb4))(param_1);
  this_02 = (CNavArea *)(**(code **)(*(int *)pIVar7 + 0x52c))(pIVar7);
  if (this_02 != (CNavArea *)0x0) {
    *(undefined4 *)(this_02 + 0x78) = 0;
    this_02[0x7c] = (CNavArea)((byte)this_02[0x7c] & 0xf0 | 9);
    CNavArea::ClearSearchLists();
    pIVar7 = param_2;
    lVar18 = (longdouble)(*(code *)**(undefined4 **)param_2)(param_2,this_02,0,0,0,0xbf800000);
    if (0.0 <= (float)lVar18) {
      *(float *)(this_02 + 0x40) = (float)lVar18;
      CNavArea::AddToOpenList(this_02);
      iVar17 = 0;
LAB_003e3dd5:
      do {
        this_01 = CNavArea::m_openList;
        if (CNavArea::m_openList == (CNavArea *)0x0) goto code_r0x003e3ddf;
        CNavArea::RemoveFromOpenList(CNavArea::m_openList);
        iVar16 = CNavArea::m_masterMarker;
        *(undefined4 *)(this_01 + 0x4c) = 0;
        *(undefined4 *)(this_01 + 0x48) = 0;
        *(int *)(this_01 + 0x3c) = iVar16;
        this_02 = this_01;
        cVar4 = CNavArea::IsBlocked(this_01,iVar6,false);
        if (cVar4 == '\0') {
          *(undefined4 *)(this + 0x4754) = 0;
          pPVar12 = this + 0x4454;
          iVar16 = 0;
          piVar13 = *(int **)(this_01 + 0x58);
          if (*piVar13 < 1) {
            piVar13 = *(int **)(this_01 + 0x60);
            if (*piVar13 < 1) {
              piVar13 = *(int **)(this_01 + 100);
              if (0 < *piVar13) goto LAB_003e420f;
            }
            else {
LAB_003e41a2:
              iVar14 = 0x40 - iVar16;
              iVar10 = iVar16 + 1;
              pPVar12 = this + iVar16 * 0xc + 0x4454;
              iVar15 = 0;
              do {
                iVar16 = piVar13[iVar15 * 2 + 1];
                *(int *)(pPVar12 + 8) = 2;
                *(int *)(pPVar12 + 4) = 0;
                *(int *)pPVar12 = iVar16;
                iVar16 = iVar10 + iVar15;
                iVar15 = iVar15 + 1;
                *(int *)(this + 0x4754) = iVar16;
                piVar13 = *(int **)(this_01 + 0x60);
                if (*piVar13 <= iVar15) break;
                pPVar12 = pPVar12 + 0xc;
              } while (iVar15 != iVar14);
LAB_003e41fd:
              piVar13 = *(int **)(this_01 + 100);
              if (0 < *piVar13) {
                if (0x3f < iVar16) goto LAB_003e42d5;
LAB_003e420f:
                iVar14 = 0x40 - iVar16;
                iVar10 = iVar16 + 1;
                pPVar12 = this + iVar16 * 0xc + 0x4454;
                iVar15 = 0;
                do {
                  iVar16 = piVar13[iVar15 * 2 + 1];
                  *(int *)(pPVar12 + 8) = 3;
                  *(int *)(pPVar12 + 4) = 0;
                  *(int *)pPVar12 = iVar16;
                  iVar16 = iVar10 + iVar15;
                  iVar15 = iVar15 + 1;
                  *(int *)(this + 0x4754) = iVar16;
                  piVar13 = *(int **)(this_01 + 100);
                  if (*piVar13 <= iVar15) break;
                  pPVar12 = pPVar12 + 0xc;
                } while (iVar15 != iVar14);
              }
            }
LAB_003e426d:
            piVar13 = *(int **)(this_01 + 0x5c);
            if ((0 < *piVar13) && (iVar16 < 0x40)) {
              iVar14 = 0x40 - iVar16;
              iVar10 = iVar16 + 1;
              pPVar12 = this + iVar16 * 0xc + 0x4454;
              iVar15 = 0;
              do {
                iVar16 = piVar13[iVar15 * 2 + 1];
                *(int *)(pPVar12 + 8) = 1;
                *(int *)(pPVar12 + 4) = 0;
                *(int *)pPVar12 = iVar16;
                iVar16 = iVar10 + iVar15;
                iVar15 = iVar15 + 1;
                *(int *)(this + 0x4754) = iVar16;
                piVar13 = *(int **)(this_01 + 0x5c);
                if (*piVar13 <= iVar15) break;
                pPVar12 = pPVar12 + 0xc;
              } while (iVar15 != iVar14);
            }
          }
          else {
            do {
              iVar14 = piVar13[iVar16 * 2 + 1];
              iVar16 = iVar16 + 1;
              *(int *)(pPVar12 + 8) = 0;
              *(int *)(pPVar12 + 4) = 0;
              *(int *)pPVar12 = iVar14;
              *(int *)(this + 0x4754) = iVar16;
              piVar13 = *(int **)(this_01 + 0x58);
              if (*piVar13 <= iVar16) {
                piVar13 = *(int **)(this_01 + 0x60);
                if (*piVar13 < 1) goto LAB_003e41fd;
                if (iVar16 == 0x40) goto LAB_003e465b;
                goto LAB_003e41a2;
              }
              pPVar12 = pPVar12 + 0xc;
            } while (iVar16 != 0x40);
            if (**(int **)(this_01 + 0x60) < 1) {
              if (**(int **)(this_01 + 100) < 1) goto LAB_003e426d;
            }
            else {
LAB_003e465b:
              iVar16 = 0x40;
            }
          }
LAB_003e42d5:
          piVar13 = *(int **)(this_01 + 0x68);
          iVar14 = 0;
          if (0 < *piVar13) {
            do {
              iVar10 = piVar13[iVar14 + 1];
              iVar15 = iVar16;
              if (*(int *)(iVar10 + 0x24) == 0) {
LAB_003e4325:
                iVar11 = iVar15;
                if (*(int *)(iVar10 + 0x28) == 0) goto LAB_003e4356;
                iVar16 = iVar15;
                if (iVar15 < 0x40) {
                  iVar11 = iVar15 + 1;
                  *(int *)(this + iVar15 * 0xc + 0x4454) = *(int *)(iVar10 + 0x28);
                  *(undefined4 *)(this + iVar15 * 0xc + 0x445c) = 4;
                  *(int *)(this + iVar15 * 0xc + 0x4458) = iVar10;
                  *(int *)(this + 0x4754) = iVar11;
                  goto LAB_003e4356;
                }
              }
              else {
                iVar11 = iVar16;
                if (iVar16 < 0x40) {
                  iVar15 = iVar16 + 1;
                  *(int *)(this + iVar16 * 0xc + 0x4454) = *(int *)(iVar10 + 0x24);
                  *(undefined4 *)(this + iVar16 * 0xc + 0x445c) = 4;
                  *(int *)(this + iVar16 * 0xc + 0x4458) = iVar10;
                  *(int *)(this + 0x4754) = iVar15;
                  goto LAB_003e4325;
                }
LAB_003e4356:
                iVar16 = iVar11;
                if ((*(int *)(iVar10 + 0x2c) != 0) && (iVar11 < 0x40)) {
                  iVar16 = iVar11 + 1;
                  *(int *)(this + iVar11 * 0xc + 0x4454) = *(int *)(iVar10 + 0x2c);
                  *(undefined4 *)(this + iVar11 * 0xc + 0x445c) = 4;
                  *(int *)(this + iVar11 * 0xc + 0x4458) = iVar10;
                  *(int *)(this + 0x4754) = iVar16;
                }
              }
              iVar14 = iVar14 + 1;
              piVar13 = *(int **)(this_01 + 0x68);
            } while (iVar14 < *piVar13);
          }
          piVar13 = *(int **)(this_01 + 0x6c);
          if (*piVar13 < 1) {
LAB_003e4419:
            if (iVar16 < 1) goto LAB_003e3dd5;
          }
          else {
            iVar14 = piVar13[1];
            if (iVar16 < 0x40) {
              iVar10 = iVar16;
              iVar15 = 0;
              do {
                if (*(int *)(iVar14 + 0x34) == 0) {
                  iVar16 = *(int *)(this + 0x4754);
                  if (*piVar13 <= iVar15 + 1) goto LAB_003e4419;
                }
                else {
                  iVar16 = iVar10 + 1;
                  *(int *)(this + iVar10 * 0xc + 0x4454) = *(int *)(iVar14 + 0x34);
                  *(undefined4 *)(this + iVar10 * 0xc + 0x445c) = 5;
                  *(int *)(this + iVar10 * 0xc + 0x4458) = iVar14;
                  *(int *)(this + 0x4754) = iVar16;
                  piVar13 = *(int **)(this_01 + 0x6c);
                  if (*piVar13 <= iVar15 + 1) goto LAB_003e4419;
                }
                iVar14 = piVar13[iVar15 + 2];
                iVar10 = iVar16;
                iVar15 = iVar15 + 1;
              } while (iVar16 < 0x40);
            }
          }
          local_54 = 0;
          local_50 = this + 0x4454;
          do {
            this_00 = *(CNavArea **)local_50;
                    /* try { // try from 003e4452 to 003e44fb has its CatchHandler @ 003e47fd */
            if (((*(int *)(this_00 + 0x3c) != CNavArea::m_masterMarker) ||
                (*(int *)(this_00 + 0x3c) == *(int *)(this_00 + 0x50))) &&
               (this_02 = this_00, cVar4 = CNavArea::IsBlocked(this_00,iVar6,false), cVar4 == '\0'))
            {
              if (0.0 < param_4) {
                    /* try { // try from 003e45c3 to 003e469b has its CatchHandler @ 003e47fd */
                this_02 = (CNavArea *)param_1;
                pCVar5 = (CBaseEntity *)(**(code **)(*(int *)param_1 + 0xb4))(param_1);
                if (((byte)pCVar5[0x14d] & 8) != 0) {
                  this_02 = (CNavArea *)pCVar5;
                  CBaseEntity::CalcAbsolutePosition(pCVar5);
                }
                if (param_4 * param_4 <
                    (*(float *)(this_00 + 0x2c) - *(float *)(pCVar5 + 0x2e0)) *
                    (*(float *)(this_00 + 0x2c) - *(float *)(pCVar5 + 0x2e0)) +
                    (*(float *)(this_00 + 0x30) - *(float *)(pCVar5 + 0x2e4)) *
                    (*(float *)(this_00 + 0x30) - *(float *)(pCVar5 + 0x2e4)) +
                    (*(float *)(this_00 + 0x34) - *(float *)(pCVar5 + 0x2e8)) *
                    (*(float *)(this_00 + 0x34) - *(float *)(pCVar5 + 0x2e8))) goto LAB_003e4500;
              }
              this_02 = (CNavArea *)param_2;
              lVar18 = (longdouble)
                       (*(code *)**(undefined4 **)param_2)
                                 (param_2,this_00,this_01,*(undefined4 *)(local_50 + 4),0,0xbf800000
                                 );
              fVar2 = (float)lVar18;
              if (0.0 <= fVar2) {
                if (*(int *)(this_00 + 0x50) == CNavArea::m_masterMarker) {
                  if (*(float *)(this_00 + 0x40) <= fVar2) goto LAB_003e4500;
                  uVar9 = *(undefined4 *)(local_50 + 8);
                  *(CNavArea **)(this_00 + 0x78) = this_01;
                  *(float *)(this_00 + 0x40) = fVar2;
                  *(float *)(this_00 + 0x44) = fVar2;
                  this_00[0x7c] = (CNavArea)((byte)this_00[0x7c] & 0xf0 | (byte)uVar9 & 0xf);
                  CNavArea::UpdateOnOpenList(this_00);
                }
                else {
                  uVar9 = *(undefined4 *)(local_50 + 8);
                  *(CNavArea **)(this_00 + 0x78) = this_01;
                  *(float *)(this_00 + 0x40) = fVar2;
                  *(float *)(this_00 + 0x44) = fVar2;
                  this_00[0x7c] = (CNavArea)((byte)this_00[0x7c] & 0xf0 | (byte)uVar9 & 0xf);
                  CNavArea::AddToOpenList(this_00);
                }
                this_02 = (CNavArea *)param_3;
                iVar17 = (*(code *)**(undefined4 **)param_3)(param_3,iVar17,this_00);
              }
            }
LAB_003e4500:
            local_54 = local_54 + 1;
            local_50 = local_50 + 0xc;
          } while (local_54 < *(int *)(this + 0x4754));
        }
      } while( true );
    }
  }
LAB_003e40f8:
  this = (Path *)pIVar7;
  uVar9 = 0;
LAB_003e40fa:
  if (DAT_0105d158 != '\0') goto LAB_003e4107;
LAB_003e402b:
  iVar6 = _DAT_0105db00;
  iVar17 = ThreadGetCurrentId(this);
  if (iVar6 != iVar17) goto LAB_003e4040;
LAB_003e46ab:
  cVar4 = CVProfNode::ExitScope();
  if (cVar4 != '\0') {
    _DAT_0105d15c = *(CNavArea **)(_DAT_0105d15c + 100);
  }
  DAT_0105d158 = _DAT_0105d15c == (CNavArea *)0x105d160;
LAB_003e4040:
  if (local_2c != (CNavArea *)0x0) {
    (**(code **)(local_2c + 0x54))(local_2c,local_34,local_30,0,0,0);
  }
  return uVar9;
code_r0x003e3ddf:
  pIVar7 = (IPathCost *)this_02;
  if (iVar17 == 0) goto LAB_003e40f8;
  local_3c = 0;
  local_38 = 0;
  if (_towlower == (CNavArea *)0x0) {
    local_20 = (CNavArea *)0x0;
  }
  else {
    (**(code **)(_towlower + 0x50))
              (_towlower,&local_3c,0,0,0,0,"/data/src/game/server/nextbot/path/nextbotpath.h",0x1ff,
               &AssemblePrecomputedPath(INextBot*,Vector_const&,CNavArea*)::tm_fmt,"(%s)%s",
               "NextBot","AssemblePrecomputedPath");
    local_20 = _towlower;
  }
  iVar6 = _DAT_0105db00;
  local_28 = local_3c;
  local_24 = local_38;
                    /* try { // try from 003e4546 to 003e45a6 has its CatchHandler @ 003e4870 */
  if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
     (iVar16 = ThreadGetCurrentId(), iVar6 == iVar16)) {
    if (*(char **)_DAT_0105d15c != "AssemblePrecomputedPath") {
      _DAT_0105d15c =
           (CNavArea *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xbfa16f,(char *)0x0,0xca8906);
    }
    puVar1 = (uint *)(_DAT_0105d1e8 + 4 + *(int *)(_DAT_0105d15c + 0x70) * 8);
    *puVar1 = *puVar1 | 4;
    CVProfNode::EnterScope();
    DAT_0105d158 = '\0';
  }
                    /* try { // try from 003e3e9b to 003e3fbf has its CatchHandler @ 003e4855 */
  pVVar8 = (Vector *)(**(code **)(*(int *)param_1 + 0xd4))(param_1);
  iVar16 = 0;
  iVar6 = iVar17;
  do {
    iVar6 = *(int *)(iVar6 + 0x78);
    iVar16 = iVar16 + 1;
  } while (iVar6 != 0);
  if (0xff < iVar16) {
    iVar16 = 0xff;
LAB_003e3ecf:
    *(int *)(this + 0x4404) = iVar16;
    pPVar12 = this + (iVar16 + -1) * 0x44 + 4;
    iVar14 = iVar16;
    iVar6 = iVar17;
    do {
      *(int *)pPVar12 = iVar6;
      iVar14 = iVar14 + -1;
      bVar3 = *(byte *)(iVar6 + 0x7c);
      *(int *)(pPVar12 + 0x18) = 0;
      *(uint *)(pPVar12 + 4) = bVar3 & 0xf;
      iVar6 = *(int *)(iVar6 + 0x78);
      if (iVar6 == 0) break;
      pPVar12 = pPVar12 + -0x44;
    } while (iVar14 != 0);
    *(int *)(this + iVar16 * 0x44 + 4) = iVar17;
    *(undefined4 *)(this + iVar16 * 0x44 + 0xc) = *(undefined4 *)(iVar17 + 0x2c);
    *(undefined4 *)(this + iVar16 * 0x44 + 0x10) = *(undefined4 *)(iVar17 + 0x30);
    *(undefined4 *)(this + iVar16 * 0x44 + 0x14) = *(undefined4 *)(iVar17 + 0x34);
    iVar6 = *(int *)(this + 0x4404);
    *(undefined4 *)(this + iVar6 * 0x44 + 0x18) = 0;
    *(undefined4 *)(this + iVar6 * 0x44 + 8) = 9;
    *(undefined4 *)(this + iVar6 * 0x44 + 0x1c) = 0;
    *(int *)(this + 0x4404) = iVar6 + 1;
    uVar9 = ComputePathDetails(this,param_1,pVVar8);
    if ((char)uVar9 == '\0') {
      (**(code **)(*(int *)this + 0x48))(this);
      (**(code **)(*(int *)this + 100))(this,param_1,2);
      goto LAB_003e3fc0;
    }
                    /* try { // try from 003e46e7 to 003e4713 has its CatchHandler @ 003e4855 */
    Optimize((INextBot *)this);
    PostProcess(this);
    (**(code **)(*(int *)this + 100))(this,param_1,0);
    iVar6 = _DAT_0105db00;
    if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
       (iVar17 = ThreadGetCurrentId(), iVar6 == iVar17)) {
      this = (Path *)_DAT_0105d15c;
      cVar4 = CVProfNode::ExitScope();
      if (cVar4 != '\0') {
        _DAT_0105d15c = *(CNavArea **)(_DAT_0105d15c + 100);
      }
      DAT_0105d158 = _DAT_0105d15c == (CNavArea *)0x105d160;
    }
    if (local_20 != (CNavArea *)0x0) {
      this = (Path *)local_20;
      (**(code **)(local_20 + 0x54))(local_20,local_28,local_24,0,0,0);
    }
    goto LAB_003e40fa;
  }
  if (iVar16 != 1) goto LAB_003e3ecf;
                    /* try { // try from 003e47c4 to 003e47c8 has its CatchHandler @ 003e4855 */
  BuildTrivialPath(this,param_1,(Vector *)(iVar17 + 0x2c));
LAB_003e3fc0:
  iVar6 = _DAT_0105db00;
  if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
     (iVar17 = ThreadGetCurrentId(), iVar6 == iVar17)) {
    this = (Path *)_DAT_0105d15c;
    cVar4 = CVProfNode::ExitScope();
    if (cVar4 != '\0') {
      _DAT_0105d15c = *(CNavArea **)(_DAT_0105d15c + 100);
    }
    DAT_0105d158 = _DAT_0105d15c == (CNavArea *)0x105d160;
  }
  if (local_20 != (CNavArea *)0x0) {
    this = (Path *)local_20;
    (**(code **)(local_20 + 0x54))(local_20,local_28,local_24,0,0,0);
  }
  uVar9 = 1;
  if (DAT_0105d158 == '\0') goto LAB_003e402b;
LAB_003e4107:
  iVar6 = _DAT_0105db00;
  if ((_DAT_0105d154 == 0) || (iVar17 = ThreadGetCurrentId(this), iVar6 != iVar17))
  goto LAB_003e4040;
  goto LAB_003e46ab;
}

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)