L L4D2node

InfectedAmbientMob::Update

0x00a26740 · 2471 bytes · __thiscall

_ZN18InfectedAmbientMob6UpdateEP8Infectedf

Decompiled

undefined (3 params)

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

InfectedAmbientMob * __thiscall
InfectedAmbientMob::Update(InfectedAmbientMob *this,Infected *param_1,float param_2)

{
  Path *this_00;
  INextBot *pIVar1;
  Vector *pVVar2;
  uint *puVar3;
  CNavArea CVar4;
  char cVar5;
  CBaseEntity *pCVar6;
  CBaseEntity *pCVar7;
  int iVar8;
  Vector *pVVar9;
  int *piVar10;
  CNavArea *pCVar11;
  CNavArea *pCVar12;
  int iVar13;
  Infected *pIVar14;
  bool bVar15;
  longdouble lVar16;
  float fVar17;
  float fVar18;
  char *pcVar19;
  int local_8c;
  CNavArea *local_78;
  undefined4 local_74;
  undefined4 local_70;
  undefined4 local_6c;
  undefined4 local_68;
  undefined4 local_60;
  undefined4 local_5c;
  int local_58;
  undefined4 local_54;
  undefined4 local_50;
  int local_4c;
  float local_48;
  float local_44;
  float local_40;
  undefined4 local_3c;
  undefined4 local_38;
  undefined4 local_34;
  undefined **local_30;
  INextBot *local_2c;
  undefined4 local_24;
  float local_20;
  
  local_74 = 0;
  local_70 = 0;
  if (_towlower == 0) {
    local_58 = 0;
  }
  else {
    (**(code **)(_towlower + 0x50))
              (_towlower,&local_74,0,0,0,0,
               "/data/src/game/server/terror/zombiebot/infected/infectedambientmob.cpp",0x99,
               &Update(Infected*,float)::tm_fmt,"(%s)%s","NextBot","InfectedAmbientMob::Update");
    local_58 = _towlower;
  }
  iVar13 = _DAT_0105db00;
  local_60 = local_74;
  local_5c = local_70;
  if ((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) {
                    /* try { // try from 00a26956 to 00a269b6 has its CatchHandler @ 00a27149 */
    iVar8 = ThreadGetCurrentId();
    if (iVar13 == iVar8) {
      if ((char *)*_DAT_0105d15c != "InfectedAmbientMob::Update") {
        _DAT_0105d15c =
             (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xd21ec3,(char *)0x0,0xca8906);
      }
      puVar3 = (uint *)(_DAT_0105d1e8 + 4 + _DAT_0105d15c[0x1c] * 8);
      *puVar3 = *puVar3 | 4;
      CVProfNode::EnterScope();
      DAT_0105d158 = '\0';
    }
  }
                    /* try { // try from 00a267fe to 00a26841 has its CatchHandler @ 00a27151 */
  pCVar6 = (CBaseEntity *)(**(code **)(*(int *)param_2 + 0x590))(param_2);
  pCVar7 = (CBaseEntity *)(**(code **)(*(int *)param_2 + 0x594))(param_2);
  if (0 < *(int *)(param_1 + 0x4448)) {
    PathFollower::Update((PathFollower *)(param_1 + 0x44),(INextBot *)((int)param_2 + 0x1a3c));
    pcVar19 = (char *)pCVar6;
    cVar5 = (**(code **)(*(int *)pCVar6 + 200))(pCVar6);
    if (cVar5 == '\0') {
      pcVar19 = (char *)pCVar6;
      cVar5 = (**(code **)(*(int *)pCVar6 + 0x114))(pCVar6);
      if (cVar5 == '\0') {
        cVar5 = (**(code **)(*(int *)pCVar6 + 0xf8))(pCVar6);
        pcVar19 = (char *)pCVar6;
        if (cVar5 != '\0') {
          pcVar19 = (char *)pCVar7;
          cVar5 = (**(code **)(*(int *)pCVar7 + 0xe4))(pCVar7,0x255);
          if (cVar5 == '\0') {
            (**(code **)(*(int *)pCVar7 + 0xd8))(pCVar7,0x255,0);
            pcVar19 = (char *)pCVar7;
          }
        }
      }
    }
    pCVar6 = *(CBaseEntity **)(param_1 + 0x40);
    if (((byte)pCVar6[0x14d] & 8) != 0) {
      pcVar19 = (char *)pCVar6;
      CBaseEntity::CalcAbsolutePosition(pCVar6);
    }
    if ((*(byte *)((int)param_2 + 0x14d) & 8) != 0) {
      pcVar19 = (char *)param_2;
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_2);
    }
    fVar18 = *(float *)((int)param_2 + 0x2e0) - *(float *)(pCVar6 + 0x2e0);
    fVar17 = *(float *)((int)param_2 + 0x2e4) - *(float *)(pCVar6 + 0x2e4);
    if (fVar17 * fVar17 + fVar18 * fVar18 <= 576.0) {
                    /* try { // try from 00a269cb to 00a26af9 has its CatchHandler @ 00a27151 */
      UTIL_Remove((CBaseEntity *)param_2);
      pcVar19 = (char *)param_2;
    }
    goto LAB_00a268a4;
  }
  if (0.0 < *(float *)(param_1 + 0x3c)) {
    pCVar6 = (CBaseEntity *)(param_1 + 0x34);
    lVar16 = (longdouble)CountdownTimer::Now();
    if (*(float *)(param_1 + 0x3c) <= (float)lVar16) {
      pIVar1 = (INextBot *)((int)param_2 + 0x1a3c);
      local_30 = &PTR_operator___00d22370;
      local_2c = pIVar1;
      local_24 = (**(code **)(*(int *)((int)param_2 + 0x1a3c) + 0xc0))(pIVar1);
      lVar16 = (longdouble)RandomFloat(0,0x3f400000);
      pCVar7 = *(CBaseEntity **)(param_1 + 0x40);
      local_20 = (float)lVar16;
      if (((byte)pCVar7[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition(pCVar7);
      }
      pVVar2 = (Vector *)(pCVar7 + 0x2e0);
      local_6c = 0;
      this_00 = (Path *)(param_1 + 0x44);
      local_68 = 0;
      if (_towlower == 0) {
        local_4c = 0;
      }
      else {
        (**(code **)(_towlower + 0x50))
                  (_towlower,&local_6c,0,0,0,0,"/data/src/game/server/nextbot/path/nextbotpath.h",
                   0x113,&Path::
                          Compute<InfectedAmbientMobPathCost>(INextBot*,Vector_const&,InfectedAmbientMobPathCost&,float)
                          ::tm_fmt,"(%s)%s","NextBotSpiky","Path::Compute(goal)");
        local_4c = _towlower;
      }
      iVar13 = _DAT_0105db00;
      local_54 = local_6c;
      local_50 = local_68;
      if ((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) {
                    /* try { // try from 00a26b2d to 00a26b31 has its CatchHandler @ 00a2714d */
        iVar8 = ThreadGetCurrentId();
        if (iVar13 == iVar8) {
          if ((char *)*_DAT_0105d15c != "Path::Compute(goal)") {
                    /* try { // try from 00a2706a to 00a2708d has its CatchHandler @ 00a2714d */
            _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 00a26b47 to 00a26ce3 has its CatchHandler @ 00a27111 */
      (**(code **)(*(int *)(param_1 + 0x44) + 0x48))(this_00);
      pVVar9 = (Vector *)(**(code **)(*(int *)((int)param_2 + 0x1a3c) + 0xd4))(pIVar1);
      piVar10 = (int *)(**(code **)(*(int *)((int)param_2 + 0x1a3c) + 0xb4))(pIVar1);
      pCVar11 = (CNavArea *)(**(code **)(*piVar10 + 0x52c))(piVar10);
      if (pCVar11 == (CNavArea *)0x0) {
                    /* try { // try from 00a270e1 to 00a2710b has its CatchHandler @ 00a27111 */
        (**(code **)(*(int *)(param_1 + 0x44) + 100))(this_00,pIVar1,2);
      }
      else {
        pCVar12 = (CNavArea *)
                  CNavMesh::GetNearestNavArea(TheNavMesh,pVVar2,true,200.0,true,true,false);
        if (pCVar11 == pCVar12) {
LAB_00a27019:
          Path::BuildTrivialPath(this_00,pIVar1,pVVar2);
        }
        else {
          local_48 = *(float *)(pCVar7 + 0x2e0);
          local_44 = *(float *)(pCVar7 + 0x2e4);
          local_40 = *(float *)(pCVar7 + 0x2e8);
          if (pCVar12 == (CNavArea *)0x0) {
            CNavMesh::GetGroundHeight(TheNavMesh,(Vector *)&local_48,&local_40,(Vector *)0x0);
          }
          else {
            lVar16 = (longdouble)CNavArea::GetZ(pCVar12,local_48,local_44);
            local_40 = (float)lVar16;
          }
          pCVar7 = (CBaseEntity *)(**(code **)(*(int *)((int)param_2 + 0x1a3c) + 0xb4))(pIVar1);
          if (((byte)pCVar7[0x14d] & 8) != 0) {
            CBaseEntity::CalcAbsolutePosition(pCVar7);
          }
          local_3c = *(undefined4 *)(pCVar7 + 0x2e0);
          local_78 = (CNavArea *)0x0;
          local_38 = *(undefined4 *)(pCVar7 + 0x2e4);
          local_34 = *(undefined4 *)(pCVar7 + 0x2e8);
          pCVar7 = (CBaseEntity *)(**(code **)(*(int *)((int)param_2 + 0x1a3c) + 0xb4))(pIVar1);
          iVar13 = CBaseEntity::GetTeamNumber(pCVar7);
          bVar15 = NavAreaBuildPath<InfectedAmbientMobPathCost>
                             (pCVar11,pCVar12,(Vector *)&local_3c,pVVar2,
                              (InfectedAmbientMobPathCost *)&local_30,&local_78,0.0,iVar13,false);
          if (local_78 != (CNavArea *)0x0) {
            if (pCVar11 == local_78) goto LAB_00a27019;
            local_8c = 1;
            pCVar12 = local_78;
            do {
              pCVar12 = *(CNavArea **)(pCVar12 + 0x78);
              if (pCVar12 == (CNavArea *)0x0) break;
              local_8c = local_8c + 1;
            } while (pCVar11 != pCVar12);
            if (local_8c < 0x100) {
              if (local_8c == 1) goto LAB_00a27019;
              *(int *)(param_1 + 0x4448) = local_8c;
            }
            else {
              *(undefined4 *)(param_1 + 0x4448) = 0xff;
              local_8c = 0xff;
            }
            pCVar11 = local_78;
            iVar13 = local_8c;
            pIVar14 = param_1 + (local_8c + -1) * 0x44 + 0x48;
            do {
              *(CNavArea **)pIVar14 = pCVar11;
              iVar13 = iVar13 + -1;
              CVar4 = pCVar11[0x7c];
              *(undefined4 *)(pIVar14 + 0x18) = 0;
              *(uint *)(pIVar14 + 4) = (byte)CVar4 & 0xf;
              pCVar11 = *(CNavArea **)(pCVar11 + 0x78);
              if (pCVar11 == (CNavArea *)0x0) break;
              pIVar14 = pIVar14 + -0x44;
            } while (iVar13 != 0);
            local_8c = local_8c * 0x44;
            *(CNavArea **)(param_1 + local_8c + 0x48) = local_78;
            *(float *)(this_00 + local_8c + 0xc) = local_48;
            *(float *)(this_00 + local_8c + 0x10) = local_44;
            *(float *)(this_00 + local_8c + 0x14) = local_40;
            iVar13 = *(int *)(param_1 + 0x4448);
            *(undefined4 *)(param_1 + iVar13 * 0x44 + 0x5c) = 0;
            *(undefined4 *)(param_1 + iVar13 * 0x44 + 0x4c) = 9;
            *(undefined4 *)(param_1 + iVar13 * 0x44 + 0x60) = 0;
            *(int *)(param_1 + 0x4448) = iVar13 + 1;
                    /* try { // try from 00a26ec1 to 00a26ef1 has its CatchHandler @ 00a27111 */
            cVar5 = Path::ComputePathDetails(this_00,pIVar1,pVVar9);
            if (cVar5 == '\0') {
              (**(code **)(*(int *)(param_1 + 0x44) + 0x48))(this_00);
              (**(code **)(*(int *)(param_1 + 0x44) + 100))(this_00,pIVar1,2);
            }
            else {
                    /* try { // try from 00a26fe9 to 00a27034 has its CatchHandler @ 00a27111 */
              Path::Optimize((INextBot *)this_00);
              Path::PostProcess(this_00);
              (**(code **)(*(int *)(param_1 + 0x44) + 100))(this_00,pIVar1,!bVar15);
            }
          }
        }
      }
      iVar13 = _DAT_0105db00;
      if ((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) {
        iVar8 = ThreadGetCurrentId();
        if (iVar13 == iVar8) {
          cVar5 = CVProfNode::ExitScope();
          if (cVar5 != '\0') {
            _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
          }
          DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
        }
      }
      if (local_4c != 0) {
        (**(code **)(local_4c + 0x54))(local_4c,local_54,local_50,0,0,0);
      }
      pcVar19 = (char *)pCVar6;
                    /* try { // try from 00a26f54 to 00a26fd6 has its CatchHandler @ 00a27151 */
      lVar16 = (longdouble)CountdownTimer::Now();
      if ((float)lVar16 + 2.0 != *(float *)(param_1 + 0x3c)) {
        pcVar19 = (char *)pCVar6;
        (**(code **)(*(int *)(param_1 + 0x34) + 4))(pCVar6,param_1 + 0x3c);
        *(float *)(param_1 + 0x3c) = (float)lVar16 + 2.0;
      }
      if (*(float *)(param_1 + 0x38) != 2.0) {
        (**(code **)(*(int *)(param_1 + 0x34) + 4))(pCVar6,param_1 + 0x38);
        *(undefined4 *)(param_1 + 0x38) = 0x40000000;
        pcVar19 = (char *)pCVar6;
      }
      goto LAB_00a268a4;
    }
  }
  pcVar19 = "Ambient Mob has no path to the destination!\n";
                    /* try { // try from 00a26d4f to 00a26de1 has its CatchHandler @ 00a27151 */
  DevWarning("Ambient Mob has no path to the destination!\n");
LAB_00a268a4:
  bVar15 = DAT_0105d158 == '\0';
  *(undefined4 *)this = 0;
  *(undefined4 *)(this + 4) = 0;
  *(undefined4 *)(this + 8) = 0;
  iVar13 = _DAT_0105db00;
  if ((bVar15) || (_DAT_0105d154 != 0)) {
    iVar8 = ThreadGetCurrentId(pcVar19);
    if (iVar13 == iVar8) {
      cVar5 = CVProfNode::ExitScope();
      if (cVar5 != '\0') {
        _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
      }
      DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
    }
  }
  if (local_58 != 0) {
    (**(code **)(local_58 + 0x54))(local_58,local_60,local_5c,0,0,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)