L L4D2node

SmokerMoveToAttackPosition::ComputePath

0x00ac6a50 · 2664 bytes · __thiscall

_ZN26SmokerMoveToAttackPosition11ComputePathEP6Smoker

Decompiled

undefined (2 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* SmokerMoveToAttackPosition::ComputePath(Smoker*) */

void __thiscall
SmokerMoveToAttackPosition::ComputePath(SmokerMoveToAttackPosition *this,Smoker *param_1)

{
  Vector *pVVar1;
  Path *this_00;
  uint *puVar2;
  CNavArea CVar3;
  uint uVar4;
  char cVar5;
  bool bVar6;
  int *piVar7;
  CNavArea *pCVar8;
  int iVar9;
  Vector *pVVar10;
  int *piVar11;
  CNavArea *pCVar12;
  CBaseEntity *pCVar13;
  undefined *puVar14;
  int iVar15;
  SmokerMoveToAttackPosition *pSVar16;
  int in_GS_OFFSET;
  longdouble lVar17;
  float fVar18;
  int local_ac;
  undefined4 local_a4;
  INextBot *local_a0;
  CNavArea *local_90;
  undefined4 local_8c;
  undefined4 local_88;
  undefined4 local_80;
  undefined4 local_7c;
  int local_78;
  float local_74;
  float local_70;
  float local_6c;
  undefined4 local_68;
  undefined4 local_64;
  undefined4 local_60;
  undefined **local_5c;
  Smoker *local_58;
  undefined4 local_54;
  undefined4 local_50;
  Smoker *local_4c;
  undefined4 local_48;
  int *local_44;
  undefined4 local_40;
  int *local_3c;
  undefined4 local_38;
  undefined4 local_34;
  int local_30;
  int *local_2c;
  float local_28;
  Color local_24;
  undefined1 local_23;
  undefined1 local_22;
  undefined1 local_21;
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  uVar4 = *(uint *)(this + 0x34);
  if ((((uVar4 == 0xffffffff) ||
       (puVar14 = g_pEntityList + (uVar4 & 0xfff) * 0x10, puVar14 == (undefined *)0xfffffffc)) ||
      (*(uint *)(puVar14 + 8) != uVar4 >> 0xc)) || (*(int *)(puVar14 + 4) == 0)) goto LAB_00ac6a97;
  piVar7 = (int *)(**(code **)(*(int *)param_1 + 0x9b0))(param_1);
  cVar5 = (**(code **)(*piVar7 + 0xd4))(piVar7);
  if (cVar5 != '\0') goto LAB_00ac6a97;
  lVar17 = (longdouble)CountdownTimer::Now();
  if ((float)lVar17 + 3.0 != *(float *)(this + 0x4820)) {
    (**(code **)(*(int *)(this + 0x4818) + 4))(this + 0x4818,this + 0x4820);
    *(float *)(this + 0x4820) = (float)lVar17 + 3.0;
  }
  if (*(float *)(this + 0x481c) != 3.0) {
    (**(code **)(*(int *)(this + 0x4818) + 4))(this + 0x4818,this + 0x481c);
    *(undefined4 *)(this + 0x481c) = 0x40400000;
  }
  uVar4 = *(uint *)(this + 0x34);
  piVar7 = (int *)0x0;
  if (((uVar4 != 0xffffffff) &&
      (puVar14 = g_pEntityList + (uVar4 & 0xfff) * 0x10, puVar14 != (undefined *)0xfffffffc)) &&
     (*(uint *)(puVar14 + 8) == uVar4 >> 0xc)) {
    piVar7 = *(int **)(puVar14 + 4);
  }
  local_3c = (int *)0x0;
  local_38 = 0;
  local_34 = 0;
  local_30 = 0;
  local_2c = (int *)0x0;
  local_4c = param_1;
                    /* try { // try from 00ac6b96 to 00ac6bac has its CatchHandler @ 00ac7511 */
  local_48 = (**(code **)(*(int *)param_1 + 0x52c))(param_1);
  local_44 = piVar7;
  local_40 = (**(code **)(*piVar7 + 0x52c))(piVar7);
  local_28 = 0.0;
  fVar18 = *(float *)(TongueRange._28_4_ + 0x2c);
  if (((byte)param_1[0x14d] & 8) != 0) {
                    /* try { // try from 00ac6bdd to 00ac6e81 has its CatchHandler @ 00ac750d */
    CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_1);
  }
  pCVar8 = (CNavArea *)(**(code **)(*(int *)param_1 + 0x52c))(param_1);
  SearchSurroundingAreas<TongueAttackPositionScan>
            (pCVar8,(Vector *)(param_1 + 0x2e0),(TongueAttackPositionScan *)&local_4c,fVar18 * 1.25,
             0,-1);
  if (local_30 == 0) {
LAB_00ac6c9a:
    cVar5 = INextBot::IsDebugging((INextBot *)(param_1 + 0x4028),1);
    if (cVar5 != '\0') {
      local_24 = 0xff;
      local_23 = 0xff;
      local_22 = 0xff;
      local_21 = 0xff;
      ConColorMsg(&local_24,"Can\'t find a good attack area, moving directly towards victim");
    }
    uVar4 = *(uint *)(this + 0x34);
    piVar7 = (int *)0x0;
    if (((uVar4 != 0xffffffff) &&
        (puVar14 = g_pEntityList + (uVar4 & 0xfff) * 0x10, puVar14 != (undefined *)0xfffffffc)) &&
       (*(uint *)(puVar14 + 8) == uVar4 >> 0xc)) {
      piVar7 = *(int **)(puVar14 + 4);
    }
    piVar7 = (int *)(**(code **)(*piVar7 + 0x52c))(piVar7);
    lVar17 = (longdouble)CountdownTimer::Now();
    if ((float)lVar17 + 2.0 != *(float *)(this + 0x482c)) {
      (**(code **)(*(int *)(this + 0x4824) + 4))(this + 0x4824,this + 0x482c);
      *(float *)(this + 0x482c) = (float)lVar17 + 2.0;
    }
    if (*(float *)(this + 0x4828) != 2.0) {
                    /* try { // try from 00ac746d to 00ac74d2 has its CatchHandler @ 00ac750d */
      (**(code **)(*(int *)(this + 0x4824) + 4))(this + 0x4824,this + 0x4828);
      *(undefined4 *)(this + 0x4828) = 0x40000000;
    }
    if (piVar7 != (int *)0x0) goto LAB_00ac6d78;
  }
  else {
    lVar17 = (longdouble)RandomFloat(0,local_28 - 1.0);
    if (local_30 < 1) goto LAB_00ac6c9a;
    fVar18 = (float)lVar17 - (float)local_3c[1];
    piVar7 = local_3c;
    if (0.0 < fVar18) {
      iVar15 = 0;
      piVar11 = local_3c;
      do {
        iVar15 = iVar15 + 1;
        if (iVar15 == local_30) goto LAB_00ac6c9a;
        fVar18 = fVar18 - (float)piVar11[3];
        piVar7 = piVar11 + 2;
        piVar11 = piVar11 + 2;
      } while (0.0 < fVar18);
    }
    piVar7 = (int *)*piVar7;
    if (piVar7 == (int *)0x0) goto LAB_00ac6c9a;
LAB_00ac6d78:
    local_a0 = (INextBot *)(param_1 + 0x4028);
    cVar5 = INextBot::IsDebugging(local_a0,1);
    if (cVar5 != '\0') {
                    /* try { // try from 00ac7303 to 00ac7305 has its CatchHandler @ 00ac750d */
      (**(code **)(*piVar7 + 0x54))(piVar7,0xff,0xff,0,0xff,0x4479c000,1);
    }
    local_a4 = 0;
    uVar4 = *(uint *)(this + 0x34);
    if (((uVar4 != 0xffffffff) &&
        (puVar14 = g_pEntityList + (uVar4 & 0xfff) * 0x10, puVar14 != (undefined *)0xfffffffc)) &&
       (*(uint *)(puVar14 + 8) == uVar4 >> 0xc)) {
      local_a4 = *(undefined4 *)(puVar14 + 4);
    }
    local_5c = &PTR_operator___00d34e38;
    local_58 = param_1;
    local_54 = (**(code **)(*(int *)param_1 + 0x9b0))(param_1);
    local_8c = 0;
    local_88 = 0;
    local_50 = local_a4;
    pVVar1 = (Vector *)(piVar7 + 0xb);
    this_00 = (Path *)(this + 0x38);
    if (_towlower == 0) {
      local_78 = 0;
    }
    else {
      (**(code **)(_towlower + 0x50))
                (_towlower,&local_8c,0,0,0,0,"/data/src/game/server/nextbot/path/nextbotpath.h",
                 0x113,&Path::Compute<SmokerPathCost>(INextBot*,Vector_const&,SmokerPathCost&,float)
                        ::tm_fmt,"(%s)%s","NextBotSpiky","Path::Compute(goal)");
      local_78 = _towlower;
    }
    iVar15 = _DAT_0105db00;
    local_80 = local_8c;
    local_7c = local_88;
                    /* try { // try from 00ac6ebb to 00ac6ebf has its CatchHandler @ 00ac74d8 */
    if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
       (iVar9 = ThreadGetCurrentId(), iVar15 == iVar9)) {
      if ((char *)*_DAT_0105d15c != "Path::Compute(goal)") {
                    /* try { // try from 00ac7399 to 00ac73bc has its CatchHandler @ 00ac74d8 */
        _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 00ac6ed8 to 00ac7211 has its CatchHandler @ 00ac74fd */
    (**(code **)(*(int *)(this + 0x38) + 0x48))(this_00);
    pVVar10 = (Vector *)(**(code **)(*(int *)(param_1 + 0x4028) + 0xd4))(local_a0);
    piVar11 = (int *)(**(code **)(*(int *)(param_1 + 0x4028) + 0xb4))(local_a0);
    pCVar8 = (CNavArea *)(**(code **)(*piVar11 + 0x52c))(piVar11);
    if (pCVar8 == (CNavArea *)0x0) {
                    /* try { // try from 00ac7424 to 00ac744e has its CatchHandler @ 00ac74fd */
      (**(code **)(*(int *)(this + 0x38) + 100))(this_00,local_a0,2);
    }
    else {
      pCVar12 = (CNavArea *)
                CNavMesh::GetNearestNavArea(TheNavMesh,pVVar1,true,200.0,true,true,false);
      if (pCVar8 == pCVar12) {
LAB_00ac733a:
        Path::BuildTrivialPath(this_00,local_a0,pVVar1);
      }
      else {
        local_74 = (float)piVar7[0xb];
        local_70 = (float)piVar7[0xc];
        local_6c = (float)piVar7[0xd];
        if (pCVar12 == (CNavArea *)0x0) {
          CNavMesh::GetGroundHeight(TheNavMesh,(Vector *)&local_74,&local_6c,(Vector *)0x0);
        }
        else {
          lVar17 = (longdouble)CNavArea::GetZ(pCVar12,local_74,local_70);
          local_6c = (float)lVar17;
        }
        pCVar13 = (CBaseEntity *)(**(code **)(*(int *)(param_1 + 0x4028) + 0xb4))(local_a0);
        if (((byte)pCVar13[0x14d] & 8) != 0) {
          CBaseEntity::CalcAbsolutePosition(pCVar13);
        }
        local_90 = (CNavArea *)0x0;
        local_68 = *(undefined4 *)(pCVar13 + 0x2e0);
        local_64 = *(undefined4 *)(pCVar13 + 0x2e4);
        local_60 = *(undefined4 *)(pCVar13 + 0x2e8);
        pCVar13 = (CBaseEntity *)(**(code **)(*(int *)(param_1 + 0x4028) + 0xb4))(local_a0);
        iVar15 = CBaseEntity::GetTeamNumber(pCVar13);
        bVar6 = NavAreaBuildPath<SmokerPathCost>
                          (pCVar8,pCVar12,(Vector *)&local_68,pVVar1,(SmokerPathCost *)&local_5c,
                           &local_90,0.0,iVar15,false);
        if (local_90 != (CNavArea *)0x0) {
          if (pCVar8 == local_90) goto LAB_00ac733a;
          local_ac = 1;
          pCVar12 = local_90;
          do {
            pCVar12 = *(CNavArea **)(pCVar12 + 0x78);
            if (pCVar12 == (CNavArea *)0x0) break;
            local_ac = local_ac + 1;
          } while (pCVar8 != pCVar12);
          if (local_ac < 0x100) {
            if (local_ac == 1) goto LAB_00ac733a;
            *(int *)(this + 0x443c) = local_ac;
          }
          else {
            *(undefined4 *)(this + 0x443c) = 0xff;
            local_ac = 0xff;
          }
          pCVar8 = local_90;
          iVar15 = local_ac;
          pSVar16 = this + (local_ac + -1) * 0x44 + 0x3c;
          do {
            *(CNavArea **)pSVar16 = pCVar8;
            iVar15 = iVar15 + -1;
            CVar3 = pCVar8[0x7c];
            *(undefined4 *)(pSVar16 + 0x18) = 0;
            *(uint *)(pSVar16 + 4) = (byte)CVar3 & 0xf;
            pCVar8 = *(CNavArea **)(pCVar8 + 0x78);
            if (pCVar8 == (CNavArea *)0x0) break;
            pSVar16 = pSVar16 + -0x44;
          } while (iVar15 != 0);
          local_ac = local_ac * 0x44;
          *(CNavArea **)(this + local_ac + 0x3c) = local_90;
          *(float *)(this_00 + local_ac + 0xc) = local_74;
          *(float *)(this_00 + local_ac + 0x10) = local_70;
          *(float *)(this_00 + local_ac + 0x14) = local_6c;
          iVar15 = *(int *)(this + 0x443c);
          *(undefined4 *)(this + iVar15 * 0x44 + 0x50) = 0;
          *(undefined4 *)(this + iVar15 * 0x44 + 0x40) = 9;
          *(undefined4 *)(this + iVar15 * 0x44 + 0x54) = 0;
          *(int *)(this + 0x443c) = iVar15 + 1;
          cVar5 = Path::ComputePathDetails(this_00,local_a0,pVVar10);
          if (cVar5 == '\0') {
                    /* try { // try from 00ac7317 to 00ac735b has its CatchHandler @ 00ac74fd */
            (**(code **)(*(int *)(this + 0x38) + 0x48))(this_00);
            (**(code **)(*(int *)(this + 0x38) + 100))(this_00,local_a0,2);
          }
          else {
            Path::Optimize((INextBot *)this_00);
            Path::PostProcess(this_00);
            (**(code **)(*(int *)(this + 0x38) + 100))(this_00,local_a0,!bVar6);
          }
        }
      }
    }
    iVar15 = _DAT_0105db00;
    if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
       (iVar9 = ThreadGetCurrentId(), iVar15 == iVar9)) {
      cVar5 = CVProfNode::ExitScope();
      if (cVar5 != '\0') {
        _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
      }
      DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
    }
    if (local_78 != 0) {
      (**(code **)(local_78 + 0x54))(local_78,local_80,local_7c,0,0,0);
    }
  }
  local_30 = 0;
  CUtlMemory<TongueAttackPositionScan::AttackArea,int>::Purge
            ((CUtlMemory<TongueAttackPositionScan::AttackArea,int> *)&local_3c);
  local_2c = local_3c;
  CUtlMemory<TongueAttackPositionScan::AttackArea,int>::Purge
            ((CUtlMemory<TongueAttackPositionScan::AttackArea,int> *)&local_3c);
LAB_00ac6a97:
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  return;
}

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)