L L4D2node

WitchRetreat::BuildRetreatPath

0x00a420e0 · 1554 bytes · __thiscall

_ZN12WitchRetreat16BuildRetreatPathEP8Infected

Decompiled

undefined (2 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* WitchRetreat::BuildRetreatPath(Infected*) */

undefined4 __thiscall WitchRetreat::BuildRetreatPath(WitchRetreat *this,Infected *param_1)

{
  Vector *pVVar1;
  uint *puVar2;
  CNavArea CVar3;
  char cVar4;
  bool bVar5;
  int iVar6;
  CBaseEntity *pCVar7;
  int iVar8;
  INextBot *pIVar9;
  Path *this_00;
  Vector *pVVar10;
  int *piVar11;
  CNavArea *pCVar12;
  CNavArea *pCVar13;
  int iVar14;
  WitchRetreat *pWVar15;
  Infected *pIVar16;
  longdouble lVar17;
  CNavArea *local_68;
  undefined4 local_64;
  undefined4 local_60;
  undefined4 local_58;
  undefined4 local_54;
  int local_50;
  float local_4c;
  float local_48;
  float local_44;
  undefined4 local_40;
  undefined4 local_3c;
  undefined4 local_38;
  undefined **local_34;
  Infected *local_30;
  CBaseEntity *local_2c;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  
  iVar6 = FindSafeArea(this,param_1);
  if (iVar6 == 0) {
    return 0;
  }
  pIVar16 = (Infected *)0x0;
  if (param_1 != (Infected *)0x0) {
    pIVar16 = param_1 + 0x1a3c;
  }
  local_34 = &PTR_operator___00d20e60;
  local_30 = pIVar16;
  local_28 = (**(code **)(*(int *)pIVar16 + 0xc0))(pIVar16);
  pCVar7 = (CBaseEntity *)(**(code **)(*(int *)pIVar16 + 0xb4))(pIVar16);
  iVar8 = (**(code **)(*(int *)pCVar7 + 0x14c))(pCVar7);
  if (iVar8 == 0) {
    local_24 = 0x3f800000;
  }
  else {
    local_24 = *(undefined4 *)(iVar8 + 0x1cec);
  }
  cVar4 = (**(code **)(*(int *)pCVar7 + 0x16c))(pCVar7);
  local_2c = (CBaseEntity *)0x0;
  if (cVar4 != '\0') {
    local_2c = pCVar7;
  }
  iVar8 = CBaseEntity::GetTeamNumber(pCVar7);
  local_20 = 9;
  if (iVar8 == 3) {
    local_20 = (**(code **)(*(int *)pCVar7 + 0x544))(pCVar7);
  }
  pVVar1 = (Vector *)(iVar6 + 0x2c);
  pIVar9 = (INextBot *)(param_1 + 0x1a3c);
  local_64 = 0;
  if (param_1 == (Infected *)0x0) {
    pIVar9 = (INextBot *)0x0;
  }
  local_60 = 0;
  this_00 = (Path *)(this + 0x34);
  if (_towlower == 0) {
    local_50 = 0;
  }
  else {
    (**(code **)(_towlower + 0x50))
              (_towlower,&local_64,0,0,0,0,"/data/src/game/server/nextbot/path/nextbotpath.h",0x113,
               &Path::Compute<InfectedPathCost>(INextBot*,Vector_const&,InfectedPathCost&,float)::
                tm_fmt,"(%s)%s","NextBotSpiky","Path::Compute(goal)");
    local_50 = _towlower;
  }
  iVar8 = _DAT_0105db00;
  local_58 = local_64;
  local_54 = local_60;
  if ((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) {
                    /* try { // try from 00a42556 to 00a425b6 has its CatchHandler @ 00a42704 */
    iVar14 = ThreadGetCurrentId();
    if (iVar8 == iVar14) {
      if ((char *)*_DAT_0105d15c != "Path::Compute(goal)") {
        _DAT_0105d15c =
             (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xbfa1b7,(char *)0x0,0xbfa1cb);
      }
      puVar2 = (uint *)(_DAT_0105d1e8 + 4 + _DAT_0105d15c[0x1c] * 8);
      *puVar2 = *puVar2 | 4;
      CVProfNode::EnterScope();
      DAT_0105d158 = '\0';
    }
  }
                    /* try { // try from 00a4225a to 00a424ed has its CatchHandler @ 00a42719 */
  (**(code **)(*(int *)(this + 0x34) + 0x48))(this_00);
  pVVar10 = (Vector *)(**(code **)(*(int *)pIVar9 + 0xd4))(pIVar9);
  piVar11 = (int *)(**(code **)(*(int *)pIVar9 + 0xb4))(pIVar9);
  pCVar12 = (CNavArea *)(**(code **)(*piVar11 + 0x52c))(piVar11);
  if (pCVar12 == (CNavArea *)0x0) {
                    /* try { // try from 00a426ac to 00a426f1 has its CatchHandler @ 00a42719 */
    (**(code **)(*(int *)(this + 0x34) + 100))(this_00,pIVar9,2);
    goto LAB_00a424ee;
  }
  pCVar13 = (CNavArea *)CNavMesh::GetNearestNavArea(TheNavMesh,pVVar1,true,200.0,true,true,false);
  if (pCVar12 != pCVar13) {
    local_4c = *(float *)(iVar6 + 0x2c);
    local_48 = *(float *)(iVar6 + 0x30);
    local_44 = *(float *)(iVar6 + 0x34);
    if (pCVar13 == (CNavArea *)0x0) {
      CNavMesh::GetGroundHeight(TheNavMesh,(Vector *)&local_4c,&local_44,(Vector *)0x0);
    }
    else {
      lVar17 = (longdouble)CNavArea::GetZ(pCVar13,local_4c,local_48);
      local_44 = (float)lVar17;
    }
    pCVar7 = (CBaseEntity *)(**(code **)(*(int *)pIVar9 + 0xb4))(pIVar9);
    if (((byte)pCVar7[0x14d] & 8) != 0) {
                    /* try { // try from 00a4260d to 00a42659 has its CatchHandler @ 00a42719 */
      CBaseEntity::CalcAbsolutePosition(pCVar7);
    }
    local_40 = *(undefined4 *)(pCVar7 + 0x2e0);
    local_68 = (CNavArea *)0x0;
    local_3c = *(undefined4 *)(pCVar7 + 0x2e4);
    local_38 = *(undefined4 *)(pCVar7 + 0x2e8);
    pCVar7 = (CBaseEntity *)(**(code **)(*(int *)pIVar9 + 0xb4))(pIVar9);
    iVar6 = CBaseEntity::GetTeamNumber(pCVar7);
    bVar5 = NavAreaBuildPath<InfectedPathCost>
                      (pCVar12,pCVar13,(Vector *)&local_40,pVVar1,(InfectedPathCost *)&local_34,
                       &local_68,0.0,iVar6,false);
    if (local_68 == (CNavArea *)0x0) goto LAB_00a424ee;
    if (pCVar12 != local_68) {
      iVar6 = 1;
      pCVar13 = local_68;
      do {
        pCVar13 = *(CNavArea **)(pCVar13 + 0x78);
        if (pCVar13 == (CNavArea *)0x0) break;
        iVar6 = iVar6 + 1;
      } while (pCVar12 != pCVar13);
      if (iVar6 < 0x100) {
        if (iVar6 == 1) goto LAB_00a426b4;
        *(int *)(this + 0x4438) = iVar6;
      }
      else {
        iVar6 = 0xff;
        *(undefined4 *)(this + 0x4438) = 0xff;
      }
      pCVar12 = local_68;
      iVar8 = iVar6;
      pWVar15 = this + (iVar6 + -1) * 0x44 + 0x38;
      do {
        *(CNavArea **)pWVar15 = pCVar12;
        iVar8 = iVar8 + -1;
        CVar3 = pCVar12[0x7c];
        *(undefined4 *)(pWVar15 + 0x18) = 0;
        *(uint *)(pWVar15 + 4) = (byte)CVar3 & 0xf;
        pCVar12 = *(CNavArea **)(pCVar12 + 0x78);
        if (pCVar12 == (CNavArea *)0x0) break;
        pWVar15 = pWVar15 + -0x44;
      } while (iVar8 != 0);
      iVar6 = iVar6 * 0x44;
      *(CNavArea **)(this + iVar6 + 0x38) = local_68;
      *(float *)(this_00 + iVar6 + 0xc) = local_4c;
      *(float *)(this_00 + iVar6 + 0x10) = local_48;
      *(float *)(this_00 + iVar6 + 0x14) = local_44;
      iVar6 = *(int *)(this + 0x4438);
      *(undefined4 *)(this + iVar6 * 0x44 + 0x4c) = 0;
      *(undefined4 *)(this + iVar6 * 0x44 + 0x3c) = 9;
      *(undefined4 *)(this + iVar6 * 0x44 + 0x50) = 0;
      *(int *)(this + 0x4438) = iVar6 + 1;
      cVar4 = Path::ComputePathDetails(this_00,pIVar9,pVVar10);
      if (cVar4 == '\0') {
        (**(code **)(*(int *)(this + 0x34) + 0x48))(this_00);
        (**(code **)(*(int *)(this + 0x34) + 100))(this_00,pIVar9,2);
      }
      else {
        Path::Optimize((INextBot *)this_00);
        Path::PostProcess(this_00);
        (**(code **)(*(int *)(this + 0x34) + 100))(this_00,pIVar9,!bVar5);
      }
      goto LAB_00a424ee;
    }
  }
LAB_00a426b4:
  Path::BuildTrivialPath(this_00,pIVar9,pVVar1);
LAB_00a424ee:
  iVar6 = _DAT_0105db00;
  if ((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) {
    iVar8 = ThreadGetCurrentId();
    if (iVar6 == iVar8) {
      cVar4 = CVProfNode::ExitScope();
      if (cVar4 != '\0') {
        _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
      }
      DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
    }
  }
  if (local_50 != 0) {
    (**(code **)(local_50 + 0x54))(local_50,local_58,local_54,0,0,0);
  }
  return 1;
}

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)