L L4D2node

WitchAttack::Update

0x00a3d300 · 3435 bytes · __thiscall

_ZN11WitchAttack6UpdateEP8Infectedf

Decompiled

undefined (3 params)

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

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

{
  uint *puVar1;
  float fVar2;
  code *pcVar3;
  char cVar4;
  Infected IVar5;
  int *piVar6;
  int *piVar7;
  CBaseEntity *this_00;
  CBaseEntity *this_01;
  int iVar8;
  Infected *pIVar9;
  int *piVar10;
  int iVar11;
  undefined4 *puVar12;
  int iVar13;
  WitchKillIncapVictim *this_02;
  Vector *pVVar14;
  float *pfVar15;
  longdouble lVar16;
  int *local_70;
  int local_54;
  int local_50;
  int local_4c;
  int local_48;
  int local_44;
  int local_40;
  int local_3c;
  int local_38;
  undefined **local_34;
  int local_30;
  CBaseEntity *local_2c;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  
  pfVar15 = (float *)&stack0xffffff54;
  piVar6 = (int *)(**(code **)(*(int *)param_2 + 0x590))();
  piVar7 = (int *)(**(code **)(*(int *)param_2 + 0x594))();
  this_00 = (CBaseEntity *)GetVictim((WitchAttack *)param_1);
  if ((this_00 == (CBaseEntity *)0x0) ||
     (cVar4 = (**(code **)(*(int *)this_00 + 0x16c))(), cVar4 == '\0')) {
    if ((*(byte *)((int)param_2 + 0x153) & 8) != 0) {
      *(undefined4 *)this = 3;
      *(undefined4 *)(this + 4) = 0;
      *(char **)(this + 8) = "Lost our victim";
      return this;
    }
    puVar12 = ::operator_new(0x485c);
    puVar12[8] = 0;
    puVar12[9] = 0;
    puVar12[10] = 0;
    puVar12[3] = 0;
    puVar12[4] = 0;
    puVar12[5] = 0;
    puVar12[6] = 0;
    puVar12[7] = 0;
    puVar12[2] = 0;
    *(undefined1 *)(puVar12 + 0xc) = 0;
    *(undefined1 *)((int)puVar12 + 0x31) = 0;
    puVar12[0xb] = 0;
    *puVar12 = &PTR__WitchRetreat_00d26aa8;
    puVar12[1] = &PTR__WitchRetreat_00d26c0c;
                    /* try { // try from 00a3d740 to 00a3d744 has its CatchHandler @ 00a3e0b8 */
    PathFollower::PathFollower((PathFollower *)(puVar12 + 0xd));
    *(undefined4 *)this = 2;
    puVar12[0x1205] = &PTR_NetworkStateChanged_00c0b6e0;
    puVar12[0x1206] = 0;
    puVar12[0x1207] = 0xbf800000;
    puVar12[0x1208] = &PTR_NetworkStateChanged_00c0b6e0;
    puVar12[0x1209] = 0;
    puVar12[0x120a] = 0xbf800000;
    puVar12[0x120b] = &PTR_NetworkStateChanged_00c23e10;
    puVar12[0x120c] = 0xbf800000;
    puVar12[0x120d] = &PTR_NetworkStateChanged_00c23e10;
    puVar12[0x120e] = 0xbf800000;
    puVar12[0x120f] = &PTR_NetworkStateChanged_00c0b6e0;
    puVar12[0x1210] = 0;
    puVar12[0x1211] = 0xbf800000;
    puVar12[0x1212] = 0;
    puVar12[0x1213] = 0;
    puVar12[0x1214] = 0;
    puVar12[0x1215] = 0;
    puVar12[0x1216] = 0;
    *(undefined4 **)(this + 4) = puVar12;
    *(undefined4 *)(param_1 + 0x20) = 0;
    *(undefined4 *)(param_1 + 0x24) = 0;
    *(undefined4 *)(param_1 + 0x28) = 0;
    *(undefined4 *)(param_1 + 0x2c) = 0;
    *(char **)(this + 8) = "Lost our victim";
    return this;
  }
  (**(code **)(*piVar7 + 0xc4))();
  cVar4 = (**(code **)(*(int *)this_00 + 300))();
  if (cVar4 == '\0') {
    iVar13 = CBaseEntity::GetTeamNumber(this_00);
    cVar4 = IsASurvivorTeam(iVar13);
    if (cVar4 == '\0') {
      *(undefined4 *)this = 3;
      *(undefined4 *)(this + 4) = 0;
      *(char **)(this + 8) = "Killed Infected that was harrassing me";
      return this;
    }
    if ((*(byte *)((int)param_2 + 0x153) & 8) != 0) {
      *(undefined4 *)this = 3;
      *(undefined4 *)(this + 4) = 0;
      *(char **)(this + 8) = "Killed our Survivor victim";
      return this;
    }
    puVar12 = ::operator_new(0x485c);
    puVar12[8] = 0;
    puVar12[9] = 0;
    puVar12[10] = 0;
    puVar12[3] = 0;
    puVar12[4] = 0;
    puVar12[5] = 0;
    puVar12[6] = 0;
    puVar12[7] = 0;
    puVar12[2] = 0;
    *(undefined1 *)(puVar12 + 0xc) = 0;
    *(undefined1 *)((int)puVar12 + 0x31) = 0;
    puVar12[0xb] = 0;
    *puVar12 = &PTR__WitchRetreat_00d26aa8;
    puVar12[1] = &PTR__WitchRetreat_00d26c0c;
                    /* try { // try from 00a3dc08 to 00a3dc0c has its CatchHandler @ 00a3e09e */
    PathFollower::PathFollower((PathFollower *)(puVar12 + 0xd));
    puVar12[0x1205] = &PTR_NetworkStateChanged_00c0b6e0;
    puVar12[0x1206] = 0;
    puVar12[0x1207] = 0xbf800000;
    puVar12[0x1208] = &PTR_NetworkStateChanged_00c0b6e0;
    puVar12[0x1209] = 0;
    puVar12[0x120a] = 0xbf800000;
    puVar12[0x120b] = &PTR_NetworkStateChanged_00c23e10;
    puVar12[0x120c] = 0xbf800000;
    puVar12[0x120d] = &PTR_NetworkStateChanged_00c23e10;
    puVar12[0x120e] = 0xbf800000;
    puVar12[0x120f] = &PTR_NetworkStateChanged_00c0b6e0;
    puVar12[0x1210] = 0;
    puVar12[0x1211] = 0xbf800000;
    puVar12[0x1212] = 0;
    puVar12[0x1213] = 0;
    puVar12[0x1214] = 0;
    puVar12[0x1215] = 0;
    puVar12[0x1216] = 0;
    *(undefined4 *)this = 1;
    *(undefined4 **)(this + 4) = puVar12;
    *(char **)(this + 8) = "Retreating in horror from killing a Survivor";
    return this;
  }
  Witch::ChangeRageLevel((Witch *)param_2,1.0);
  lVar16 = (longdouble)CountdownTimer::Now();
  if (*(float *)(param_1 + 0x4854) <= (float)lVar16) {
    CBaseEntity::EmitSound((CBaseEntity *)param_2,"WitchZombie.Rage",0.0,(float *)0x0);
    lVar16 = (longdouble)RandomFloat();
    fVar2 = (float)lVar16;
    lVar16 = (longdouble)CountdownTimer::Now();
    if ((float)lVar16 + fVar2 != *(float *)(param_1 + 0x4854)) {
      (**(code **)(*(int *)(param_1 + 0x484c) + 4))();
      *(float *)(param_1 + 0x4854) = (float)lVar16 + fVar2;
    }
    if (fVar2 != *(float *)(param_1 + 0x4850)) {
      (**(code **)(*(int *)(param_1 + 0x484c) + 4))();
      *(float *)(param_1 + 0x4850) = fVar2;
    }
  }
  cVar4 = CTerrorPlayer::IsStill();
  iVar13 = (int)param_2 + 0x1a3c;
  if (((cVar4 != '\0') && (cVar4 = (**(code **)(*piVar6 + 0xd4))(), cVar4 == '\0')) &&
     (cVar4 = (**(code **)(*(int *)((int)param_2 + 0x1a3c) + 0x11c))(), cVar4 == '\0')) {
    CBaseEntity::SetAbsVelocity((CBaseEntity *)param_2,(Vector *)&vec3_origin);
    pcVar3 = *(code **)(*piVar6 + 0x120);
    if (((byte)this_00[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition(this_00);
    }
    (*pcVar3)();
    cVar4 = (**(code **)(*(int *)this_00 + 0x7e8))();
    if (cVar4 != '\0') {
      CBaseEntity::EmitSound
                ((CBaseEntity *)param_2,"WitchZombie.RageBeforeKillingFrenzy",0.0,(float *)0x0);
      this_02 = ::operator_new(0x4c);
                    /* try { // try from 00a3d968 to 00a3d96c has its CatchHandler @ 00a3e0df */
      WitchKillIncapVictim::WitchKillIncapVictim(this_02,this_00);
      puVar12 = ::operator_new(0x4c);
      *(undefined4 *)this = 2;
      puVar12[8] = 0;
      puVar12[9] = 0;
      puVar12[10] = 0;
      puVar12[3] = 0;
      puVar12[4] = 0;
      puVar12[5] = 0;
      puVar12[6] = 0;
      puVar12[7] = 0;
      puVar12[2] = 0;
      *(undefined1 *)(puVar12 + 0xc) = 0;
      *(undefined1 *)((int)puVar12 + 0x31) = 0;
      puVar12[0xb] = 0;
      *puVar12 = &PTR__InfectedStandingActivity_00d24c08;
      puVar12[1] = &PTR__InfectedStandingActivity_00d24d6c;
      puVar12[0xe] = &PTR_NetworkStateChanged_00c0b6e0;
      puVar12[0xf] = 0;
      puVar12[0x10] = 0xbf800000;
      puVar12[0xd] = 0x2af;
      puVar12[0x11] = this_02;
      *(undefined1 *)(puVar12 + 0x12) = 0;
      *(undefined4 **)(this + 4) = puVar12;
      *(undefined4 *)(param_1 + 0x20) = 0;
      *(undefined4 *)(param_1 + 0x24) = 0;
      *(undefined4 *)(param_1 + 0x28) = 0;
      *(undefined4 *)(param_1 + 0x2c) = 0;
      *(char **)(this + 8) = "Victim is incapacitated - going in for the kill";
      return this;
    }
    goto LAB_00a3d696;
  }
  cVar4 = (**(code **)(*(int *)this_00 + 0x7e8))();
  if (cVar4 == '\0') {
    (**(code **)(*piVar6 + 0xd8))();
  }
  else {
    (**(code **)(*piVar6 + 0xdc))();
  }
  local_34 = &PTR_operator___00d20e60;
  local_30 = iVar13;
  local_28 = (**(code **)(*(int *)((int)param_2 + 0x1a3c) + 0xc0))();
  this_01 = (CBaseEntity *)(**(code **)(*(int *)((int)param_2 + 0x1a3c) + 0xb4))();
  iVar8 = (**(code **)(*(int *)this_01 + 0x14c))();
  if (iVar8 == 0) {
    local_24 = 0x3f800000;
  }
  else {
    local_24 = *(undefined4 *)(iVar8 + 0x1cec);
  }
  cVar4 = (**(code **)(*(int *)this_01 + 0x16c))();
  local_2c = (CBaseEntity *)0x0;
  if (cVar4 != '\0') {
    local_2c = this_01;
  }
  iVar8 = CBaseEntity::GetTeamNumber(this_01);
  local_20 = 9;
  if (iVar8 == 3) {
    local_20 = (**(code **)(*(int *)this_01 + 0x544))();
  }
  pIVar9 = param_1 + 0x3c;
  piVar10 = (int *)(**(code **)(*(int *)((int)param_2 + 0x1a3c) + 0xc0))();
  cVar4 = (**(code **)(*(int *)((int)param_2 + 0x1a3c) + 0x104))();
  if (((cVar4 == '\0') && (cVar4 = (**(code **)(*piVar10 + 0xd4))(), cVar4 == '\0')) &&
     ((cVar4 = (**(code **)(*(int *)(param_1 + 0x3c) + 0x80))(), cVar4 == '\0' &&
      (cVar4 = (**(code **)(*(int *)(param_1 + 0x3c) + 0x80))(), cVar4 == '\0')))) {
    (**(code **)(*(int *)(param_1 + 0x3c) + 0x90))();
    pfVar15 = (float *)&stack0xffffff50;
    local_4c = local_40;
    local_48 = local_3c;
    local_44 = local_38;
    pcVar3 = *(code **)(*piVar10 + 0x158);
    (**(code **)(*piVar10 + 300))();
    cVar4 = (*pcVar3)();
    if (cVar4 == '\0') {
LAB_00a3e093:
      local_70 = &local_4c;
      pfVar15 = (float *)&stack0xffffff50;
      goto LAB_00a3d521;
    }
    if (*(int *)(DirectChaseNavCheck._28_4_ + 0x30) != 0) {
      pVVar14 = (Vector *)(**(code **)(*piVar10 + 300))();
      cVar4 = CNavMesh::DoesRayStayWithinMesh(TheNavMesh,pVVar14,(Vector *)&local_40);
      if (cVar4 == '\0') goto LAB_00a3e093;
    }
    (**(code **)(*piVar10 + 0x120))();
    (**(code **)(*piVar10 + 0xb4))();
    piVar10 = (int *)(**(code **)(*(int *)((int)param_2 + 0x1a3c) + 0xc4))();
    (**(code **)(*piVar10 + 0xc4))();
    (**(code **)(*(int *)(param_1 + 0x3c) + 0x48))();
    param_1[0x4848] = (Infected)0x1;
  }
  else {
    local_70 = (int *)0x0;
    pfVar15 = (float *)&stack0xffffff54;
LAB_00a3d521:
    local_54 = 0;
    local_50 = 0;
    if (_towlower == 0) {
      local_38 = 0;
    }
    else {
      *pfVar15 = (float)_towlower;
      pfVar15[1] = (float)&local_54;
      pfVar15[0xb] = (float)"ChasePath::Update";
      pfVar15[10] = (float)"NextBot";
      pfVar15[9] = (float)"(%s)%s";
      pfVar15[8] = (float)&ChasePath::Update(INextBot*,CBaseEntity*,IPathCost_const&,Vector*)::
                           tm_fmt;
      pfVar15[7] = 1.45735e-43;
      pfVar15[6] = (float)"/data/src/game/server/nextbot/path/nextbotchasepath.h";
      pfVar15[5] = 0.0;
      pfVar15[3] = 0.0;
      pfVar15[4] = 0.0;
      pfVar15[2] = 0.0;
      pcVar3 = *(code **)(_towlower + 0x50);
      pfVar15[-1] = 1.504581e-38;
      (*pcVar3)();
      local_38 = _towlower;
    }
    iVar8 = _DAT_0105db00;
    local_40 = local_54;
    local_3c = local_50;
    if ((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) {
                    /* try { // try from 00a3d5c9 to 00a3d5cd has its CatchHandler @ 00a3e0ba */
      pfVar15[-1] = 1.5045885e-38;
      iVar11 = ThreadGetCurrentId();
      if (iVar8 == iVar11) {
        if ((char *)*_DAT_0105d15c != "ChasePath::Update") {
          pfVar15[4] = 5.60519e-45;
          pfVar15[3] = (float)"NextBot";
          pfVar15[2] = 0.0;
          pfVar15[1] = (float)"ChasePath::Update";
          *pfVar15 = (float)_DAT_0105d15c;
                    /* try { // try from 00a3e006 to 00a3e029 has its CatchHandler @ 00a3e0ba */
          pfVar15[-1] = 1.5049557e-38;
          _DAT_0105d15c =
               (int *)CVProfNode::GetSubNode
                                ((char *)*pfVar15,(int)pfVar15[1],(char *)pfVar15[2],(int)pfVar15[3]
                                );
        }
        puVar1 = (uint *)(_DAT_0105d1e8 + 4 + _DAT_0105d15c[0x1c] * 8);
        *puVar1 = *puVar1 | 4;
        *pfVar15 = (float)_DAT_0105d15c;
        pfVar15[-1] = 1.5049601e-38;
        CVProfNode::EnterScope();
        DAT_0105d158 = '\0';
      }
    }
    pfVar15[2] = (float)this_00;
    pfVar15[4] = (float)local_70;
    pfVar15[3] = (float)&local_34;
    *pfVar15 = (float)pIVar9;
    pfVar15[1] = (float)iVar13;
                    /* try { // try from 00a3d5f6 to 00a3d60c has its CatchHandler @ 00a3e0cf */
    pfVar15[-1] = 1.5045948e-38;
    ChasePath::RefreshPath
              ((ChasePath *)*pfVar15,(INextBot *)pfVar15[1],(CBaseEntity *)pfVar15[2],
               (IPathCost *)pfVar15[3],(Vector *)pfVar15[4]);
    pfVar15[1] = (float)iVar13;
    *pfVar15 = (float)pIVar9;
    pfVar15[-1] = 1.5045973e-38;
    PathFollower::Update((PathFollower *)*pfVar15,(INextBot *)pfVar15[1]);
    iVar8 = _DAT_0105db00;
    if ((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) {
      pfVar15[-1] = 1.5046016e-38;
      iVar11 = ThreadGetCurrentId();
      if (iVar8 == iVar11) {
        *pfVar15 = (float)_DAT_0105d15c;
        pfVar15[-1] = 1.5049636e-38;
        cVar4 = CVProfNode::ExitScope();
        if (cVar4 != '\0') {
          _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
        }
        DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
      }
    }
    if (local_38 != 0) {
      pfVar15[5] = 0.0;
      pfVar15[4] = 0.0;
      pfVar15[3] = 0.0;
      *pfVar15 = (float)local_38;
      pfVar15[1] = (float)local_40;
      pfVar15[2] = (float)local_3c;
      pcVar3 = *(code **)(local_38 + 0x54);
      pfVar15[-1] = 1.50461e-38;
      (*pcVar3)();
    }
    iVar8 = *(int *)(param_1 + 0x3c);
    *pfVar15 = (float)pIVar9;
    pcVar3 = *(code **)(iVar8 + 0x44);
    pfVar15[-1] = 1.5046121e-38;
    IVar5 = (Infected)(*pcVar3)();
    param_1[0x4848] = IVar5;
  }
  pfVar15[2] = (float)this_00;
  pfVar15[1] = (float)iVar13;
  *pfVar15 = (float)pIVar9;
  pfVar15[-1] = 1.5046165e-38;
  DirectChasePath::NotifyVictim
            ((DirectChasePath *)*pfVar15,(INextBot *)pfVar15[1],(CBaseEntity *)pfVar15[2]);
LAB_00a3d696:
  iVar8 = *piVar6;
  *pfVar15 = (float)piVar6;
  pcVar3 = *(code **)(iVar8 + 0xd4);
  pfVar15[-1] = 1.5046184e-38;
  cVar4 = (*pcVar3)();
  if (cVar4 == '\0') {
    iVar8 = *(int *)((int)param_2 + 0x1a3c);
    fVar2 = *(float *)(ZombieWitchAttackRange._28_4_ + 0x2c);
    pfVar15[1] = (float)this_00;
    *pfVar15 = (float)iVar13;
    pfVar15[2] = fVar2 * 1.5;
    pcVar3 = *(code **)(iVar8 + 0x114);
    pfVar15[-1] = 1.5047792e-38;
    cVar4 = (*pcVar3)();
    if (cVar4 != '\0') {
      pfVar15[1] = 8.58996e-43;
      *pfVar15 = param_2;
      pfVar15[-1] = 1.5049354e-38;
      cVar4 = CBaseAnimatingOverlay::IsPlayingGesture();
      if (cVar4 == '\0') {
        iVar13 = *(int *)param_2;
        *pfVar15 = param_2;
        pcVar3 = *(code **)(iVar13 + 0x59c);
        pfVar15[-1] = 1.5049381e-38;
        piVar6 = (int *)(*pcVar3)();
        iVar13 = *piVar6;
        pfVar15[2] = 0.0;
        pfVar15[1] = (float)this_00;
        *pfVar15 = (float)piVar6;
        pcVar3 = *(code **)(iVar13 + 0xf8);
        pfVar15[-1] = 1.5049413e-38;
        cVar4 = (*pcVar3)();
        if (cVar4 != '\0') {
          pfVar15[2] = 1.4013e-45;
          pfVar15[1] = 8.58996e-43;
          *pfVar15 = param_2;
          pfVar15[-1] = 1.5049458e-38;
          CBaseAnimatingOverlay::AddGesture();
          *(undefined4 *)(param_1 + 0x486c) = 0;
        }
      }
    }
    iVar13 = *piVar7;
    pfVar15[1] = 0.0;
    *pfVar15 = (float)piVar7;
    pcVar3 = *(code **)(iVar13 + 0x100);
    pfVar15[-1] = 1.5047834e-38;
    cVar4 = (*pcVar3)();
    if (cVar4 == '\0') {
      iVar13 = *piVar7;
      pfVar15[1] = 8.51989e-43;
      *pfVar15 = (float)piVar7;
      pcVar3 = *(code **)(iVar13 + 0xe4);
      pfVar15[-1] = 1.5049271e-38;
      cVar4 = (*pcVar3)();
      if (cVar4 == '\0') {
        iVar13 = *piVar7;
        pfVar15[2] = 0.0;
        pfVar15[1] = 8.51989e-43;
        *pfVar15 = (float)piVar7;
        pcVar3 = *(code **)(iVar13 + 0xd8);
        pfVar15[-1] = 1.5049325e-38;
        (*pcVar3)();
      }
    }
    else if ((*(byte *)((int)param_2 + 0x153) & 8) == 0) {
      iVar13 = *piVar7;
      pfVar15[1] = 8.36575e-43;
      *pfVar15 = (float)piVar7;
      pcVar3 = *(code **)(iVar13 + 0xe4);
      pfVar15[-1] = 1.5049087e-38;
      cVar4 = (*pcVar3)();
      if (cVar4 == '\0') {
        iVar13 = *piVar7;
        pfVar15[2] = 0.0;
        pfVar15[1] = 8.36575e-43;
        *pfVar15 = (float)piVar7;
        pcVar3 = *(code **)(iVar13 + 0xd8);
        pfVar15[-1] = 1.504914e-38;
        (*pcVar3)();
      }
    }
    else {
      iVar13 = *piVar7;
      pfVar15[1] = 8.37976e-43;
      *pfVar15 = (float)piVar7;
      pcVar3 = *(code **)(iVar13 + 0xe4);
      pfVar15[-1] = 1.5047894e-38;
      cVar4 = (*pcVar3)();
      if (cVar4 == '\0') {
        iVar13 = *piVar7;
        pfVar15[2] = 0.0;
        pfVar15[1] = 8.37976e-43;
        *pfVar15 = (float)piVar7;
        pcVar3 = *(code **)(iVar13 + 0xd8);
        pfVar15[-1] = 1.5047947e-38;
        (*pcVar3)();
      }
    }
  }
  *(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)