L L4D2node

InfectedAlert::Update

0x00a19f60 · 1925 bytes · __thiscall

_ZN13InfectedAlert6UpdateEP8Infectedf

Decompiled

undefined (3 params)

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

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

{
  uint *puVar1;
  int iVar2;
  char cVar3;
  CBaseEntity *pCVar4;
  InfectedAttack *pIVar5;
  int iVar6;
  int *piVar7;
  longdouble lVar8;
  longdouble lVar9;
  longdouble lVar10;
  longdouble lVar11;
  float fVar12;
  float fVar13;
  InfectedAttack *pIVar14;
  undefined4 local_34;
  undefined4 local_30;
  undefined4 local_28;
  undefined4 local_24;
  int local_20;
  
  local_34 = 0;
  local_30 = 0;
  if (_towlower == 0) {
    local_20 = 0;
  }
  else {
    (**(code **)(_towlower + 0x50))
              (_towlower,&local_34,0,0,0,0,
               "/data/src/game/server/terror/zombiebot/infected/infectedalert.cpp",0x84,
               &Update(Infected*,float)::tm_fmt,"(%s)%s","NextBot","InfectedAlert::Update");
    local_20 = _towlower;
  }
  iVar2 = _DAT_0105db00;
  local_28 = local_34;
  local_24 = local_30;
  if ((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) {
                    /* try { // try from 00a1a0e6 to 00a1a146 has its CatchHandler @ 00a1a74e */
    iVar6 = ThreadGetCurrentId();
    if (iVar2 == iVar6) {
      if ((char *)*_DAT_0105d15c != "InfectedAlert::Update") {
        _DAT_0105d15c =
             (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xd2163a,(char *)0x0,0xca8906);
      }
      puVar1 = (uint *)(_DAT_0105d1e8 + 4 + _DAT_0105d15c[0x1c] * 8);
      *puVar1 = *puVar1 | 4;
      CVProfNode::EnterScope();
      DAT_0105d158 = '\0';
    }
  }
                    /* try { // try from 00a1a01f to 00a1a05f has its CatchHandler @ 00a1a71f */
  cVar3 = CDirector::IsFinale(TheDirector);
  if ((cVar3 == '\0') && (**(char **)(TheDirector + 0x640) == '\0')) {
LAB_00a1a1a0:
                    /* try { // try from 00a1a1a6 to 00a1a61b has its CatchHandler @ 00a1a71f */
    lVar8 = (longdouble)CountdownTimer::Now();
    if (*(float *)(param_1 + 100) <= (float)lVar8) {
      Infected::Vocalize((Infected *)param_2,"Zombie.Alert",false);
      lVar8 = (longdouble)RandomFloat(0x40000000,0x40800000);
      fVar13 = (float)lVar8;
      lVar8 = (longdouble)CountdownTimer::Now();
      if ((float)lVar8 + fVar13 != *(float *)(param_1 + 100)) {
        (**(code **)(*(int *)(param_1 + 0x5c) + 4))(param_1 + 0x5c,param_1 + 100);
        *(float *)(param_1 + 100) = (float)lVar8 + fVar13;
      }
      if (fVar13 != *(float *)(param_1 + 0x60)) {
        (**(code **)(*(int *)(param_1 + 0x5c) + 4))(param_1 + 0x5c,param_1 + 0x60);
        *(float *)(param_1 + 0x60) = fVar13;
      }
    }
    if (0.0 < *(float *)(param_1 + 0x7c)) {
      lVar8 = (longdouble)CountdownTimer::Now();
      if (*(float *)(param_1 + 0x7c) <= (float)lVar8) {
        LookTowardsDisturbance((InfectedAlert *)param_1,(Infected *)param_2);
        if (*(float *)(param_1 + 0x7c) != -1.0) {
          (**(code **)(*(int *)(param_1 + 0x74) + 4))(param_1 + 0x74,param_1 + 0x7c);
          *(undefined4 *)(param_1 + 0x7c) = 0xbf800000;
        }
      }
    }
    piVar7 = (int *)(**(code **)(*(int *)param_2 + 0x59c))(param_2);
    pCVar4 = (CBaseEntity *)(**(code **)(*piVar7 + 0xb4))(piVar7);
    if (pCVar4 == (CBaseEntity *)0x0) {
      if (0.0 < *(float *)(param_1 + 0x58)) {
        if (*(float *)(param_1 + 0x58) != -1.0) {
          (**(code **)(*(int *)(param_1 + 0x50) + 4))(param_1 + 0x50,param_1 + 0x58);
          *(undefined4 *)(param_1 + 0x58) = 0xbf800000;
        }
                    /* try { // try from 00a1a653 to 00a1a70f has its CatchHandler @ 00a1a71f */
        piVar7 = (int *)(**(code **)(*(int *)param_2 + 0x594))(param_2);
        if (piVar7 != (int *)0x0) {
          (**(code **)(*piVar7 + 0xd8))(piVar7,0x234,1);
        }
        Infected::SetIdleBodyGroupVariant((char *)param_2,"Head");
      }
    }
    else if (*(float *)(param_1 + 0x58) <= 0.0) {
      lVar8 = (longdouble)
              (**(code **)(*(int *)((int)param_2 + 0x1a3c) + 0x124))((int)param_2 + 0x1a3c,pCVar4);
      lVar9 = (longdouble)
              CDirector::GetScriptValue
                        (TheDirector,"NearAcquireRange",*(float *)(NearAcquireRange._28_4_ + 0x2c));
      lVar10 = (longdouble)
               CDirector::GetScriptValue
                         (TheDirector,"FarAcquireRange",*(float *)(FarAcquireRange._28_4_ + 0x2c));
      lVar11 = (longdouble)
               CDirector::GetScriptValue
                         (TheDirector,"NearAcquireRange",*(float *)(NearAcquireRange._28_4_ + 0x2c))
      ;
      fVar12 = ((float)lVar8 - (float)lVar9) / ((float)lVar10 - (float)lVar11);
      fVar13 = 0.0;
      if (0.0 <= fVar12) {
        fVar13 = fVar12;
      }
      fVar12 = 1.0;
      if (fVar13 <= 1.0) {
        fVar12 = fVar13;
      }
      lVar8 = (longdouble)
              CDirector::GetScriptValue
                        (TheDirector,"NearAcquireTime",*(float *)(NearAcquireTime._28_4_ + 0x2c));
      lVar9 = (longdouble)
              CDirector::GetScriptValue
                        (TheDirector,"FarAcquireTime",*(float *)(FarAcquireTime._28_4_ + 0x2c));
      lVar10 = (longdouble)
               CDirector::GetScriptValue
                         (TheDirector,"NearAcquireTime",*(float *)(NearAcquireTime._28_4_ + 0x2c));
      lVar11 = (longdouble)
               RandomFloat(1.0 - *(float *)(AcquireTimeVarianceFactor._28_4_ + 0x2c),
                           *(float *)(AcquireTimeVarianceFactor._28_4_ + 0x2c) + 1.0);
      fVar13 = (float)lVar11 * (((float)lVar9 - (float)lVar10) * fVar12 + (float)lVar8);
      lVar8 = (longdouble)CountdownTimer::Now();
      if ((float)lVar8 + fVar13 != *(float *)(param_1 + 0x58)) {
        (**(code **)(*(int *)(param_1 + 0x50) + 4))(param_1 + 0x50,param_1 + 0x58);
        *(float *)(param_1 + 0x58) = (float)lVar8 + fVar13;
      }
      if (fVar13 != *(float *)(param_1 + 0x54)) {
        (**(code **)(*(int *)(param_1 + 0x50) + 4))(param_1 + 0x50,param_1 + 0x54);
        *(float *)(param_1 + 0x54) = fVar13;
      }
      piVar7 = (int *)(**(code **)(*(int *)param_2 + 0x594))(param_2);
      cVar3 = (**(code **)(*piVar7 + 0xe4))(piVar7,0x23e);
      if (cVar3 == '\0') {
        (**(code **)(*piVar7 + 0xd8))(piVar7,0x23e,1);
      }
      Infected::SetAlertBodyGroupVariant((Infected *)param_2,"Head","Head");
    }
    else {
      piVar7 = (int *)(**(code **)(*(int *)param_2 + 0x594))(param_2);
      (**(code **)(*piVar7 + 0x13c))(piVar7,pCVar4,2,0x3dcccccd,0,"Watch our victim");
      lVar8 = (longdouble)CountdownTimer::Now();
      if (*(float *)(param_1 + 0x58) <= (float)lVar8) {
        pIVar5 = ::operator_new(0x48);
        pIVar14 = pIVar5;
                    /* try { // try from 00a1a625 to 00a1a629 has its CatchHandler @ 00a1a740 */
        InfectedAttack::InfectedAttack(pIVar5,pCVar4);
        goto LAB_00a1a06e;
      }
    }
    pIVar14 = (InfectedAttack *)(param_1 + 0x44);
    lVar8 = (longdouble)CountdownTimer::Now();
    if (*(float *)(param_1 + 0x4c) <= (float)lVar8) {
      pIVar5 = (InfectedAttack *)(**(code **)(*(int *)param_2 + 0x594))(param_2);
      pIVar14 = pIVar5;
      cVar3 = (**(code **)(*(int *)pIVar5 + 0xe4))(pIVar5,0x245);
      if (cVar3 == '\0') {
        (**(code **)(*(int *)pIVar5 + 0xd8))(pIVar5,0x245,1);
        pIVar14 = pIVar5;
      }
    }
    *(undefined4 *)this = 0;
    *(undefined4 *)(this + 4) = 0;
    *(undefined4 *)(this + 8) = 0;
  }
  else {
    pCVar4 = (CBaseEntity *)CDirectorTacticalServices::GetRandomSurvivor();
    if (pCVar4 == (CBaseEntity *)0x0) goto LAB_00a1a1a0;
    pIVar5 = ::operator_new(0x48);
    pIVar14 = pIVar5;
                    /* try { // try from 00a1a069 to 00a1a06d has its CatchHandler @ 00a1a752 */
    InfectedAttack::InfectedAttack(pIVar5,pCVar4);
LAB_00a1a06e:
    *(undefined4 *)this = 1;
    *(InfectedAttack **)(this + 4) = pIVar5;
    *(undefined4 *)(this + 8) = 0;
  }
  iVar2 = _DAT_0105db00;
  if ((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) {
    iVar6 = ThreadGetCurrentId(pIVar14);
    if (iVar2 == iVar6) {
      cVar3 = CVProfNode::ExitScope();
      if (cVar3 != '\0') {
        _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
      }
      DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
    }
  }
  if (local_20 != 0) {
    (**(code **)(local_20 + 0x54))(local_20,local_28,local_24,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)