L L4D2node

L4D1SurvivorLegsBattleStations::Update

0x0094ec00 · 2310 bytes · __thiscall

_ZN30L4D1SurvivorLegsBattleStations6UpdateEP11SurvivorBotf

Decompiled

undefined (3 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* L4D1SurvivorLegsBattleStations::Update(SurvivorBot*, float) */

L4D1SurvivorLegsBattleStations * __thiscall
L4D1SurvivorLegsBattleStations::Update
          (L4D1SurvivorLegsBattleStations *this,SurvivorBot *param_1,float param_2)

{
  Vector *pVVar1;
  Path *this_00;
  INextBot *pIVar2;
  uint *puVar3;
  float fVar4;
  CNavArea CVar5;
  char cVar6;
  bool bVar7;
  CNavArea *pCVar8;
  CNavArea *pCVar9;
  undefined4 uVar10;
  int *piVar11;
  int iVar12;
  int iVar13;
  Vector *pVVar14;
  CBaseEntity *pCVar15;
  int iVar16;
  SurvivorBot *pSVar17;
  longdouble lVar18;
  bool local_81;
  PathFollower *local_74;
  CNavArea *local_60;
  undefined4 local_5c;
  undefined4 local_58;
  undefined4 local_50;
  undefined4 local_4c;
  int local_48;
  float local_44;
  float local_40;
  float local_3c;
  undefined4 local_38;
  undefined4 local_34;
  undefined4 local_30;
  undefined **local_2c;
  int local_28;
  undefined4 local_24;
  undefined1 local_20;
  undefined1 local_1f;
  
  pCVar8 = (CNavArea *)(**(code **)(*(int *)param_2 + 0x52c))(param_2);
  if (pCVar8 == (CNavArea *)0x0) goto LAB_0094ec71;
  pCVar9 = (CNavArea *)
           FindBattleStation((L4D1SurvivorLegsBattleStations *)param_1,(SurvivorBot *)param_2,
                             *(TerrorNavArea **)(param_1 + 0x4814));
  *(CNavArea **)(param_1 + 0x4814) = pCVar9;
  if (pCVar9 == (CNavArea *)0x0) goto LAB_0094ec71;
  if (pCVar8 == pCVar9) {
    lVar18 = (longdouble)CountdownTimer::Now();
    if (*(float *)(param_1 + 0x4820) <= (float)lVar18) {
      uVar10 = FindBattleStation((L4D1SurvivorLegsBattleStations *)param_1,(SurvivorBot *)param_2,
                                 *(TerrorNavArea **)(param_1 + 0x4814));
      *(undefined4 *)(param_1 + 0x4814) = uVar10;
      lVar18 = (longdouble)RandomFloat(0x3f000000,0x40000000);
      fVar4 = (float)lVar18;
      lVar18 = (longdouble)CountdownTimer::Now();
      if ((float)lVar18 + fVar4 != *(float *)(param_1 + 0x4820)) {
        (**(code **)(*(int *)(param_1 + 0x4818) + 4))(param_1 + 0x4818,param_1 + 0x4820);
        *(float *)(param_1 + 0x4820) = (float)lVar18 + fVar4;
      }
      if (fVar4 != *(float *)(param_1 + 0x481c)) {
        (**(code **)(*(int *)(param_1 + 0x4818) + 4))(param_1 + 0x4818,param_1 + 0x481c);
        *(float *)(param_1 + 0x481c) = fVar4;
      }
    }
    goto LAB_0094ec71;
  }
  cVar6 = CNavArea::IsBlocked(pCVar9,2,false);
  if (((cVar6 != '\0') ||
      (*(int *)(gpGlobals + 0x18) <= *(int *)(*(TerrorNavArea **)(param_1 + 0x4814) + 0x70))) ||
     (cVar6 = IsOccupied((L4D1SurvivorLegsBattleStations *)param_1,(SurvivorBot *)param_2,
                         *(TerrorNavArea **)(param_1 + 0x4814)), cVar6 != '\0')) {
    *(undefined4 *)(param_1 + 0x4814) = 0;
    goto LAB_0094ec71;
  }
  lVar18 = (longdouble)CountdownTimer::Now();
  if (*(float *)(param_1 + 0x482c) <= (float)lVar18) {
    piVar11 = (int *)(**(code **)(*(int *)param_2 + 0x9a0))(param_2);
    cVar6 = (**(code **)(*piVar11 + 0xd4))(piVar11);
    if (cVar6 == '\0') {
      lVar18 = (longdouble)CountdownTimer::Now();
      if ((float)lVar18 + 2.0 != *(float *)(param_1 + 0x482c)) {
        (**(code **)(*(int *)(param_1 + 0x4824) + 4))(param_1 + 0x4824,param_1 + 0x482c);
        *(float *)(param_1 + 0x482c) = (float)lVar18 + 2.0;
      }
      if (*(float *)(param_1 + 0x4828) != 2.0) {
        (**(code **)(*(int *)(param_1 + 0x4824) + 4))(param_1 + 0x4824,param_1 + 0x4828);
        *(undefined4 *)(param_1 + 0x4828) = 0x40000000;
      }
      iVar16 = (int)param_2 + 0x4028;
      local_2c = &PTR_operator___00d09770;
      local_28 = iVar16;
      local_24 = (**(code **)(*(int *)((int)param_2 + 0x4028) + 0xc0))(iVar16);
      piVar11 = (int *)(**(code **)(*(int *)((int)param_2 + 0x4028) + 200))(iVar16);
      iVar12 = (**(code **)(*piVar11 + 0xb8))(piVar11,iVar16);
      iVar16 = *(int *)(param_1 + 0x4814);
      local_1f = 0;
      local_20 = iVar12 != 0;
      local_5c = 0;
      local_58 = 0;
      pVVar1 = (Vector *)(iVar16 + 0x2c);
      this_00 = (Path *)(param_1 + 0x34);
      if (_towlower == 0) {
        local_48 = 0;
      }
      else {
        (**(code **)(_towlower + 0x50))
                  (_towlower,&local_5c,0,0,0,0,"/data/src/game/server/nextbot/path/nextbotpath.h",
                   0x113,&Path::
                          Compute<SurvivorBotPathCost>(INextBot*,Vector_const&,SurvivorBotPathCost&,float)
                          ::tm_fmt,"(%s)%s","NextBotSpiky","Path::Compute(goal)");
        local_48 = _towlower;
      }
      iVar12 = _DAT_0105db00;
      local_50 = local_5c;
      local_4c = local_58;
                    /* try { // try from 0094efd9 to 0094efdd has its CatchHandler @ 0094f542 */
      if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
         (iVar13 = ThreadGetCurrentId(), iVar12 == iVar13)) {
        if ((char *)*_DAT_0105d15c != "Path::Compute(goal)") {
                    /* try { // try from 0094f432 to 0094f455 has its CatchHandler @ 0094f542 */
          _DAT_0105d15c =
               (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xbfa1b7,(char *)0x0,0xbfa1cb);
        }
        puVar3 = (uint *)(_DAT_0105d1e8 + 4 + _DAT_0105d15c[0x1c] * 8);
        *puVar3 = *puVar3 | 4;
        CVProfNode::EnterScope();
        DAT_0105d158 = '\0';
      }
                    /* try { // try from 0094eff0 to 0094f2b5 has its CatchHandler @ 0094f521 */
      (**(code **)(*(int *)(param_1 + 0x34) + 0x48))(this_00);
      pIVar2 = (INextBot *)((int)param_2 + 0x4028);
      pVVar14 = (Vector *)(**(code **)(*(int *)pIVar2 + 0xd4))(pIVar2);
      piVar11 = (int *)(**(code **)(*(int *)((int)param_2 + 0x4028) + 0xb4))(pIVar2);
      pCVar8 = (CNavArea *)(**(code **)(*piVar11 + 0x52c))(piVar11);
      local_81 = false;
      if (pCVar8 == (CNavArea *)0x0) {
                    /* try { // try from 0094f4a7 to 0094f517 has its CatchHandler @ 0094f521 */
        (**(code **)(*(int *)(param_1 + 0x34) + 100))(this_00,pIVar2,2);
      }
      else {
        pCVar9 = (CNavArea *)
                 CNavMesh::GetNearestNavArea(TheNavMesh,pVVar1,true,200.0,true,true,false);
        if (pCVar8 == pCVar9) {
          Path::BuildTrivialPath(this_00,pIVar2,pVVar1);
          local_81 = true;
        }
        else {
          local_44 = *(float *)(iVar16 + 0x2c);
          local_40 = *(float *)(iVar16 + 0x30);
          local_3c = *(float *)(iVar16 + 0x34);
          if (pCVar9 == (CNavArea *)0x0) {
            CNavMesh::GetGroundHeight(TheNavMesh,(Vector *)&local_44,&local_3c,(Vector *)0x0);
          }
          else {
            lVar18 = (longdouble)CNavArea::GetZ(pCVar9,local_44,local_40);
            local_3c = (float)lVar18;
          }
          pCVar15 = (CBaseEntity *)(**(code **)(*(int *)((int)param_2 + 0x4028) + 0xb4))(pIVar2);
          if (((byte)pCVar15[0x14d] & 8) != 0) {
            CBaseEntity::CalcAbsolutePosition(pCVar15);
          }
          local_38 = *(undefined4 *)(pCVar15 + 0x2e0);
          local_60 = (CNavArea *)0x0;
          local_34 = *(undefined4 *)(pCVar15 + 0x2e4);
          local_30 = *(undefined4 *)(pCVar15 + 0x2e8);
          pCVar15 = (CBaseEntity *)(**(code **)(*(int *)((int)param_2 + 0x4028) + 0xb4))(pIVar2);
          iVar16 = CBaseEntity::GetTeamNumber(pCVar15);
          bVar7 = NavAreaBuildPath<SurvivorBotPathCost>
                            (pCVar8,pCVar9,(Vector *)&local_38,pVVar1,
                             (SurvivorBotPathCost *)&local_2c,&local_60,0.0,iVar16,false);
          if (local_60 != (CNavArea *)0x0) {
            if (pCVar8 == local_60) {
LAB_0094f4d7:
              Path::BuildTrivialPath(this_00,pIVar2,pVVar1);
              local_81 = bVar7;
            }
            else {
              iVar16 = 1;
              pCVar9 = local_60;
              do {
                pCVar9 = *(CNavArea **)(pCVar9 + 0x78);
                if (pCVar9 == (CNavArea *)0x0) break;
                iVar16 = iVar16 + 1;
              } while (pCVar8 != pCVar9);
              if (iVar16 < 0x100) {
                if (iVar16 == 1) goto LAB_0094f4d7;
                *(int *)(param_1 + 0x4438) = iVar16;
              }
              else {
                *(undefined4 *)(param_1 + 0x4438) = 0xff;
                iVar16 = 0xff;
              }
              pCVar8 = local_60;
              iVar12 = iVar16;
              pSVar17 = param_1 + (iVar16 + -1) * 0x44 + 0x38;
              do {
                *(CNavArea **)pSVar17 = pCVar8;
                iVar12 = iVar12 + -1;
                CVar5 = pCVar8[0x7c];
                *(undefined4 *)(pSVar17 + 0x18) = 0;
                *(uint *)(pSVar17 + 4) = (byte)CVar5 & 0xf;
                pCVar8 = *(CNavArea **)(pCVar8 + 0x78);
                if (pCVar8 == (CNavArea *)0x0) break;
                pSVar17 = pSVar17 + -0x44;
              } while (iVar12 != 0);
              iVar16 = iVar16 * 0x44;
              *(CNavArea **)(param_1 + iVar16 + 0x38) = local_60;
              *(float *)(this_00 + iVar16 + 0xc) = local_44;
              *(float *)(this_00 + iVar16 + 0x10) = local_40;
              *(float *)(this_00 + iVar16 + 0x14) = local_3c;
              iVar16 = *(int *)(param_1 + 0x4438);
              *(undefined4 *)(param_1 + iVar16 * 0x44 + 0x4c) = 0;
              *(undefined4 *)(param_1 + iVar16 * 0x44 + 0x3c) = 9;
              *(undefined4 *)(param_1 + iVar16 * 0x44 + 0x50) = 0;
              *(int *)(param_1 + 0x4438) = iVar16 + 1;
              cVar6 = Path::ComputePathDetails(this_00,pIVar2,pVVar14);
              if (cVar6 == '\0') {
                (**(code **)(*(int *)(param_1 + 0x34) + 0x48))(this_00);
                (**(code **)(*(int *)(param_1 + 0x34) + 100))(this_00,pIVar2,2);
              }
              else {
                    /* try { // try from 0094f399 to 0094f3c3 has its CatchHandler @ 0094f521 */
                Path::Optimize((INextBot *)this_00);
                Path::PostProcess(this_00);
                (**(code **)(*(int *)(param_1 + 0x34) + 100))(this_00,pIVar2,!bVar7);
                local_81 = bVar7;
              }
            }
          }
        }
      }
      iVar16 = _DAT_0105db00;
      if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
         (iVar12 = ThreadGetCurrentId(), iVar16 == iVar12)) {
        cVar6 = CVProfNode::ExitScope();
        if (cVar6 != '\0') {
          _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
        }
        DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
      }
      if (local_48 != 0) {
        (**(code **)(local_48 + 0x54))(local_48,local_50,local_4c,0,0,0);
      }
      if (local_81 == false) {
        *(undefined4 *)this = 3;
        *(undefined4 *)(this + 4) = 0;
        *(char **)(this + 8) = "No path to battlestation";
        return this;
      }
    }
  }
  local_74 = (PathFollower *)(param_1 + 0x34);
  PathFollower::Update(local_74,(INextBot *)((int)param_2 + 0x4028));
  lVar18 = (longdouble)RandomFloat(0x40a00000,0x41200000);
  fVar4 = (float)lVar18;
  lVar18 = (longdouble)CountdownTimer::Now();
  if ((float)lVar18 + fVar4 != *(float *)(param_1 + 0x4820)) {
    (**(code **)(*(int *)(param_1 + 0x4818) + 4))(param_1 + 0x4818,param_1 + 0x4820);
    *(float *)(param_1 + 0x4820) = (float)lVar18 + fVar4;
  }
  if (fVar4 != *(float *)(param_1 + 0x481c)) {
    (**(code **)(*(int *)(param_1 + 0x4818) + 4))(param_1 + 0x4818,param_1 + 0x481c);
    *(float *)(param_1 + 0x481c) = fVar4;
  }
LAB_0094ec71:
  *(undefined4 *)this = 0;
  *(undefined4 *)(this + 4) = 0;
  *(undefined4 *)(this + 8) = 0;
  return this;
}

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)