L L4D2node

Path::Compute<IPathCost_const>

0x008a1d60 · 1392 bytes · __thiscall

_ZN4Path7ComputeIK9IPathCostEEbP8INextBotRK6VectorRT_f

Decompiled

bool (5 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* bool Path::Compute<IPathCost const>(INextBot*, Vector const&, IPathCost const&, float) */

bool __thiscall
Path::Compute<IPathCost_const>
          (Path *this,INextBot *param_1,Vector *param_2,IPathCost *param_3,float param_4)

{
  uint *puVar1;
  CNavArea CVar2;
  bool bVar3;
  char cVar4;
  Vector *pVVar5;
  int *piVar6;
  CNavArea *pCVar7;
  CNavArea *pCVar8;
  CBaseEntity *pCVar9;
  int iVar10;
  int iVar11;
  Path *pPVar12;
  longdouble lVar13;
  CNavArea *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;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  
  local_4c = 0;
  local_48 = 0;
  if (_towlower == 0) {
    local_38 = 0;
  }
  else {
    (**(code **)(_towlower + 0x50))
              (_towlower,&local_4c,0,0,0,0,"/data/src/game/server/nextbot/path/nextbotpath.h",0x113,
               &Compute<IPathCost_const>(INextBot*,Vector_const&,IPathCost_const&,float)::tm_fmt,
               "(%s)%s","NextBotSpiky","Path::Compute(goal)");
    local_38 = _towlower;
  }
  iVar10 = _DAT_0105db00;
  local_40 = local_4c;
  local_3c = local_48;
  if ((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) {
                    /* try { // try from 008a212e to 008a218e has its CatchHandler @ 008a2303 */
    iVar11 = ThreadGetCurrentId();
    if (iVar10 == iVar11) {
      if ((char *)*_DAT_0105d15c != "Path::Compute(goal)") {
        _DAT_0105d15c =
             (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xbfa1b7,(char *)0x0,0xbfa1cb);
      }
      puVar1 = (uint *)(_DAT_0105d1e8 + 4 + _DAT_0105d15c[0x1c] * 8);
      *puVar1 = *puVar1 | 4;
      CVProfNode::EnterScope();
      DAT_0105d158 = '\0';
    }
  }
                    /* try { // try from 008a1e1f to 008a20c8 has its CatchHandler @ 008a22e2 */
  (**(code **)(*(int *)this + 0x48))(this);
  pVVar5 = (Vector *)(**(code **)(*(int *)param_1 + 0xd4))(param_1);
  piVar6 = (int *)(**(code **)(*(int *)param_1 + 0xb4))(param_1);
  pCVar7 = (CNavArea *)(**(code **)(*piVar6 + 0x52c))(piVar6);
  if (pCVar7 == (CNavArea *)0x0) {
    (**(code **)(*(int *)this + 100))(this,param_1,2);
  }
  else {
    pCVar8 = (CNavArea *)CNavMesh::GetNearestNavArea(TheNavMesh,param_2,true,200.0,true,true,false);
    if (pCVar7 == pCVar8) {
      BuildTrivialPath(this,param_1,param_2);
      bVar3 = true;
      goto LAB_008a20cb;
    }
    local_34 = *(float *)param_2;
    local_30 = *(float *)(param_2 + 4);
    local_2c = *(float *)(param_2 + 8);
    if (pCVar8 == (CNavArea *)0x0) {
      CNavMesh::GetGroundHeight(TheNavMesh,(Vector *)&local_34,&local_2c,(Vector *)0x0);
    }
    else {
      lVar13 = (longdouble)CNavArea::GetZ(pCVar8,local_34,local_30);
      local_2c = (float)lVar13;
    }
    pCVar9 = (CBaseEntity *)(**(code **)(*(int *)param_1 + 0xb4))(param_1);
    if (((byte)pCVar9[0x14d] & 8) != 0) {
                    /* try { // try from 008a21e5 to 008a22d7 has its CatchHandler @ 008a22e2 */
      CBaseEntity::CalcAbsolutePosition(pCVar9);
    }
    local_28 = *(undefined4 *)(pCVar9 + 0x2e0);
    local_50 = (CNavArea *)0x0;
    local_24 = *(undefined4 *)(pCVar9 + 0x2e4);
    local_20 = *(undefined4 *)(pCVar9 + 0x2e8);
    pCVar9 = (CBaseEntity *)(**(code **)(*(int *)param_1 + 0xb4))(param_1);
    iVar10 = CBaseEntity::GetTeamNumber(pCVar9);
    bVar3 = NavAreaBuildPath<IPathCost_const>
                      (pCVar7,pCVar8,(Vector *)&local_28,param_2,param_3,&local_50,param_4,iVar10,
                       false);
    if (local_50 != (CNavArea *)0x0) {
      if (pCVar7 == local_50) {
LAB_008a2256:
        BuildTrivialPath(this,param_1,param_2);
        goto LAB_008a20cb;
      }
      iVar10 = 1;
      pCVar8 = local_50;
      do {
        pCVar8 = *(CNavArea **)(pCVar8 + 0x78);
        if (pCVar8 == (CNavArea *)0x0) break;
        iVar10 = iVar10 + 1;
      } while (pCVar7 != pCVar8);
      if (iVar10 < 0x100) {
        if (iVar10 == 1) goto LAB_008a2256;
        *(int *)(this + 0x4404) = iVar10;
      }
      else {
        iVar10 = 0xff;
        *(undefined4 *)(this + 0x4404) = 0xff;
      }
      pCVar7 = local_50;
      iVar11 = iVar10;
      pPVar12 = this + (iVar10 + -1) * 0x44 + 4;
      do {
        *(CNavArea **)pPVar12 = pCVar7;
        iVar11 = iVar11 + -1;
        CVar2 = pCVar7[0x7c];
        *(undefined4 *)(pPVar12 + 0x18) = 0;
        *(uint *)(pPVar12 + 4) = (byte)CVar2 & 0xf;
        pCVar7 = *(CNavArea **)(pCVar7 + 0x78);
        if (pCVar7 == (CNavArea *)0x0) break;
        pPVar12 = pPVar12 + -0x44;
      } while (iVar11 != 0);
      *(float *)(this + iVar10 * 0x44 + 0xc) = local_34;
      *(CNavArea **)(this + iVar10 * 0x44 + 4) = local_50;
      *(float *)(this + iVar10 * 0x44 + 0x10) = local_30;
      *(float *)(this + iVar10 * 0x44 + 0x14) = local_2c;
      iVar10 = *(int *)(this + 0x4404);
      *(undefined4 *)(this + iVar10 * 0x44 + 0x18) = 0;
      *(undefined4 *)(this + iVar10 * 0x44 + 8) = 9;
      *(undefined4 *)(this + iVar10 * 0x44 + 0x1c) = 0;
      *(int *)(this + 0x4404) = iVar10 + 1;
      cVar4 = ComputePathDetails(this,param_1,pVVar5);
      if (cVar4 != '\0') {
        Optimize((INextBot *)this);
        PostProcess(this);
        (**(code **)(*(int *)this + 100))(this,param_1,!bVar3);
        goto LAB_008a20cb;
      }
      (**(code **)(*(int *)this + 0x48))(this);
      (**(code **)(*(int *)this + 100))(this,param_1,2);
    }
  }
  bVar3 = false;
LAB_008a20cb:
  iVar10 = _DAT_0105db00;
  if ((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) {
    iVar11 = ThreadGetCurrentId();
    if (iVar10 == iVar11) {
      cVar4 = CVProfNode::ExitScope();
      if (cVar4 != '\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 bVar3;
}

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)