L L4D2node

SpitterPrepareAmbush::Update

0x00adb800 · 2531 bytes · __thiscall

_ZN20SpitterPrepareAmbush6UpdateEP7Spitterf

Decompiled

undefined (3 params)

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

SpitterPrepareAmbush * __thiscall
SpitterPrepareAmbush::Update(SpitterPrepareAmbush *this,Spitter *param_1,float param_2)

{
  Vector *pVVar1;
  Path *this_00;
  uint *puVar2;
  CNavArea CVar3;
  char cVar4;
  bool bVar5;
  int *piVar6;
  int *piVar7;
  int iVar8;
  SpitterAttack *pSVar9;
  CBaseEntity *pCVar10;
  int iVar11;
  Vector *pVVar12;
  int *piVar13;
  CNavArea *pCVar14;
  CNavArea *pCVar15;
  SpitterWaitInAmbush *pSVar16;
  int iVar17;
  Spitter *pSVar18;
  longdouble lVar19;
  PathFollower *local_78;
  INextBot *local_74;
  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;
  int local_30;
  CBaseEntity *local_2c;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  
  piVar6 = (int *)(**(code **)(*(int *)param_2 + 0x9b0))(param_2);
  piVar7 = (int *)(**(code **)(*(int *)param_2 + 0x9b4))(param_2);
  cVar4 = CDirector::IsFinale(TheDirector);
  if (((cVar4 != '\0') || (cVar4 = (**(code **)(*(int *)param_2 + 0x998))(param_2), cVar4 != '\0'))
     && (cVar4 = CTerrorPlayer::IsCustomAbilityReadyToFire((CTerrorPlayer *)param_2), cVar4 != '\0')
     ) {
    pSVar9 = ::operator_new(0x4858);
                    /* try { // try from 00adb969 to 00adb96d has its CatchHandler @ 00adc223 */
    SpitterAttack::SpitterAttack(pSVar9);
    *(undefined4 *)this = 1;
    *(SpitterAttack **)(this + 4) = pSVar9;
    *(char **)(this + 8) = "Finale started";
    return this;
  }
  if (*(int *)(param_1 + 0x34) == 0) {
    iVar8 = FindAmbushTargetArea
                      ((SpitterPrepareAmbush *)param_1,(Spitter *)param_2,
                       *(float *)(z_spitter_range._28_4_ + 0x2c) * 1.5);
    *(int *)(param_1 + 0x34) = iVar8;
    if (iVar8 == 0) {
      cVar4 = CDirectorTacticalServices::IsVisibleToTeam
                        (*(CDirectorTacticalServices **)(TheDirector + 0x628),(CBaseEntity *)param_2
                         ,2,0,0.0,(TerrorNavArea *)0x0);
      if (cVar4 != '\0') {
        pSVar9 = ::operator_new(0x4858);
                    /* try { // try from 00adc007 to 00adc00b has its CatchHandler @ 00adc1fc */
        SpitterAttack::SpitterAttack(pSVar9);
        *(undefined4 *)this = 1;
        *(SpitterAttack **)(this + 4) = pSVar9;
        *(char **)(this + 8) = "Did not locate an ambush spot - EXPOSED";
        return this;
      }
      pSVar16 = ::operator_new(0x44);
      SpitterWaitInAmbush::SpitterWaitInAmbush(pSVar16);
      *(undefined4 *)this = 1;
      *(SpitterWaitInAmbush **)(this + 4) = pSVar16;
      *(char **)(this + 8) = "Did not locate an ambush spot but still hidden";
      return this;
    }
  }
  iVar8 = (**(code **)(*(int *)param_2 + 0x52c))(param_2);
  if (iVar8 == *(int *)(param_1 + 0x34)) {
    PathFollower::Invalidate((PathFollower *)(param_1 + 0x38));
    cVar4 = (**(code **)(*piVar7 + 0xe4))(piVar7,1);
    if (cVar4 == '\0') {
      (**(code **)(*piVar7 + 0xd8))(piVar7,1,0);
    }
    pSVar16 = ::operator_new(0x44);
    SpitterWaitInAmbush::SpitterWaitInAmbush(pSVar16);
    *(undefined4 *)this = 1;
    *(SpitterWaitInAmbush **)(this + 4) = pSVar16;
    *(char **)(this + 8) = "Made it to my ambush spot. Waiting.";
    return this;
  }
  if (*(int *)(param_1 + 0x443c) < 1) {
    iVar8 = (int)param_2 + 0x4028;
    local_34 = &PTR_operator___00d20e60;
    local_30 = iVar8;
    local_28 = (**(code **)(*(int *)((int)param_2 + 0x4028) + 0xc0))(iVar8);
    pCVar10 = (CBaseEntity *)(**(code **)(*(int *)((int)param_2 + 0x4028) + 0xb4))(iVar8);
    iVar8 = (**(code **)(*(int *)pCVar10 + 0x14c))(pCVar10);
    if (iVar8 == 0) {
      local_24 = 0x3f800000;
    }
    else {
      local_24 = *(undefined4 *)(iVar8 + 0x1cec);
    }
    cVar4 = (**(code **)(*(int *)pCVar10 + 0x16c))(pCVar10);
    local_2c = (CBaseEntity *)0x0;
    if (cVar4 != '\0') {
      local_2c = pCVar10;
    }
    iVar8 = CBaseEntity::GetTeamNumber(pCVar10);
    local_20 = 9;
    if (iVar8 == 3) {
      local_20 = (**(code **)(*(int *)pCVar10 + 0x544))(pCVar10);
    }
    local_74 = (INextBot *)((int)param_2 + 0x4028);
    local_64 = 0;
    local_60 = 0;
    iVar8 = *(int *)(param_1 + 0x34);
    pVVar1 = (Vector *)(iVar8 + 0x2c);
    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;
    }
    iVar17 = _DAT_0105db00;
    local_58 = local_64;
    local_54 = local_60;
                    /* try { // try from 00adbcc1 to 00adbcc5 has its CatchHandler @ 00adc20e */
    if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
       (iVar11 = ThreadGetCurrentId(), iVar17 == iVar11)) {
      if ((char *)*_DAT_0105d15c != "Path::Compute(goal)") {
                    /* try { // try from 00adc127 to 00adc14a has its CatchHandler @ 00adc20e */
        _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';
    }
    this_00 = (Path *)(param_1 + 0x38);
                    /* try { // try from 00adbcda to 00adbe4d has its CatchHandler @ 00adc225 */
    (**(code **)(*(int *)this_00 + 0x48))(this_00);
    pVVar12 = (Vector *)(**(code **)(*(int *)((int)param_2 + 0x4028) + 0xd4))(local_74);
    piVar13 = (int *)(**(code **)(*(int *)((int)param_2 + 0x4028) + 0xb4))(local_74);
    pCVar14 = (CNavArea *)(**(code **)(*piVar13 + 0x52c))(piVar13);
    if (pCVar14 == (CNavArea *)0x0) {
                    /* try { // try from 00adc179 to 00adc1b0 has its CatchHandler @ 00adc225 */
      (**(code **)(*(int *)(param_1 + 0x38) + 100))(this_00,local_74,2);
LAB_00adba9e:
      bVar5 = false;
    }
    else {
      pCVar15 = (CNavArea *)
                CNavMesh::GetNearestNavArea(TheNavMesh,pVVar1,true,200.0,true,true,false);
      if (pCVar14 == pCVar15) {
                    /* try { // try from 00adc1ed to 00adc1f1 has its CatchHandler @ 00adc225 */
        Path::BuildTrivialPath(this_00,local_74,pVVar1);
        bVar5 = true;
      }
      else {
        local_4c = *(float *)(iVar8 + 0x2c);
        local_48 = *(float *)(iVar8 + 0x30);
        local_44 = *(float *)(iVar8 + 0x34);
        if (pCVar15 == (CNavArea *)0x0) {
          CNavMesh::GetGroundHeight(TheNavMesh,(Vector *)&local_4c,&local_44,(Vector *)0x0);
        }
        else {
          lVar19 = (longdouble)CNavArea::GetZ(pCVar15,local_4c,local_48);
          local_44 = (float)lVar19;
        }
        pCVar10 = (CBaseEntity *)(**(code **)(*(int *)((int)param_2 + 0x4028) + 0xb4))(local_74);
        if (((byte)pCVar10[0x14d] & 8) != 0) {
          CBaseEntity::CalcAbsolutePosition(pCVar10);
        }
        local_40 = *(undefined4 *)(pCVar10 + 0x2e0);
        local_68 = (CNavArea *)0x0;
        local_3c = *(undefined4 *)(pCVar10 + 0x2e4);
        local_38 = *(undefined4 *)(pCVar10 + 0x2e8);
        pCVar10 = (CBaseEntity *)(**(code **)(*(int *)((int)param_2 + 0x4028) + 0xb4))(local_74);
        iVar8 = CBaseEntity::GetTeamNumber(pCVar10);
        bVar5 = NavAreaBuildPath<InfectedPathCost>
                          (pCVar14,pCVar15,(Vector *)&local_40,pVVar1,(InfectedPathCost *)&local_34,
                           &local_68,0.0,iVar8,false);
        if (local_68 == (CNavArea *)0x0) goto LAB_00adba9e;
        if (pCVar14 == local_68) {
LAB_00adbf6b:
          Path::BuildTrivialPath(this_00,local_74,pVVar1);
        }
        else {
          iVar8 = 1;
          pCVar15 = local_68;
          do {
            pCVar15 = *(CNavArea **)(pCVar15 + 0x78);
            if (pCVar15 == (CNavArea *)0x0) break;
            iVar8 = iVar8 + 1;
          } while (pCVar14 != pCVar15);
          if (iVar8 < 0x100) {
            if (iVar8 == 1) goto LAB_00adbf6b;
            *(int *)(param_1 + 0x443c) = iVar8;
          }
          else {
            iVar8 = 0xff;
            *(undefined4 *)(param_1 + 0x443c) = 0xff;
          }
          pCVar14 = local_68;
          iVar17 = iVar8;
          pSVar18 = param_1 + (iVar8 + -1) * 0x44 + 0x3c;
          do {
            *(CNavArea **)pSVar18 = pCVar14;
            iVar17 = iVar17 + -1;
            CVar3 = pCVar14[0x7c];
            *(int *)(pSVar18 + 0x18) = 0;
            *(uint *)(pSVar18 + 4) = (byte)CVar3 & 0xf;
            pCVar14 = *(CNavArea **)(pCVar14 + 0x78);
            if (pCVar14 == (CNavArea *)0x0) break;
            pSVar18 = pSVar18 + -0x44;
          } while (iVar17 != 0);
          iVar8 = iVar8 * 0x44;
          *(CNavArea **)(param_1 + iVar8 + 0x3c) = local_68;
          *(float *)(this_00 + iVar8 + 0xc) = local_4c;
          *(float *)(this_00 + iVar8 + 0x10) = local_48;
          *(float *)(this_00 + iVar8 + 0x14) = local_44;
          iVar8 = *(int *)(param_1 + 0x443c);
          *(undefined4 *)(param_1 + iVar8 * 0x44 + 0x50) = 0;
          *(undefined4 *)(param_1 + iVar8 * 0x44 + 0x40) = 9;
          *(undefined4 *)(param_1 + iVar8 * 0x44 + 0x54) = 0;
          *(int *)(param_1 + 0x443c) = iVar8 + 1;
                    /* try { // try from 00adba67 to 00adba9d has its CatchHandler @ 00adc225 */
          cVar4 = Path::ComputePathDetails(this_00,local_74,pVVar12);
          if (cVar4 == '\0') {
            (**(code **)(*(int *)(param_1 + 0x38) + 0x48))(this_00);
            (**(code **)(*(int *)(param_1 + 0x38) + 100))(this_00,local_74,2);
            goto LAB_00adba9e;
          }
                    /* try { // try from 00adbf2a to 00adbf83 has its CatchHandler @ 00adc225 */
          Path::Optimize((INextBot *)this_00);
          Path::PostProcess(this_00);
          (**(code **)(*(int *)(param_1 + 0x38) + 100))(this_00,local_74,!bVar5);
        }
      }
    }
    iVar8 = _DAT_0105db00;
    if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
       (iVar17 = ThreadGetCurrentId(), iVar8 == iVar17)) {
      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);
    }
    if (bVar5 == false) {
      *(int *)(param_1 + 0x4818) = *(int *)(param_1 + 0x4818) + 1;
      *(undefined4 *)(param_1 + 0x34) = 0;
    }
    if (*(int *)(param_1 + 0x443c) < 1) goto LAB_00adbb21;
  }
  local_78 = (PathFollower *)(param_1 + 0x38);
  local_74 = (INextBot *)((int)param_2 + 0x4028);
  *(undefined4 *)(param_1 + 0x4818) = 0;
  PathFollower::Update(local_78,local_74);
  cVar4 = (**(code **)(*piVar6 + 200))(piVar6);
  if ((((cVar4 == '\0') && (cVar4 = (**(code **)(*piVar6 + 0x114))(piVar6), cVar4 == '\0')) &&
      (cVar4 = (**(code **)(*piVar6 + 0xf8))(piVar6), cVar4 != '\0')) &&
     (cVar4 = (**(code **)(*piVar7 + 0xe4))(piVar7,10), cVar4 == '\0')) {
    (**(code **)(*piVar7 + 0xd8))(piVar7,10,0);
  }
  cVar4 = (**(code **)(*piVar6 + 0x168))(piVar6);
  if (cVar4 != '\0') {
    if (*(int *)((int)param_2 + 0x30) == 0) {
      iVar8 = 0;
    }
    else {
      iVar8 = *(int *)((int)param_2 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
    }
    Msg("Spitter %d mover is STUCK\n",iVar8);
    pSVar9 = ::operator_new(0x4858);
                    /* try { // try from 00adb91b to 00adb91f has its CatchHandler @ 00adc235 */
    SpitterAttack::SpitterAttack(pSVar9);
    *(undefined4 *)this = 1;
    *(SpitterAttack **)(this + 4) = pSVar9;
    *(char **)(this + 8) = "Mover got stuck - attacking";
    return this;
  }
LAB_00adbb21:
  if (10 < *(int *)(param_1 + 0x4818)) {
    if (*(int *)((int)param_2 + 0x30) == 0) {
      iVar8 = 0;
    }
    else {
      iVar8 = *(int *)((int)param_2 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
    }
    Msg("Spitter %d is failing excessively\n",iVar8);
  }
  *(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)