L L4D2node

InfectedWander::OnSound

0x00a3a9e0 · 1365 bytes · __cdecl

_ZN14InfectedWander7OnSoundEP8InfectedP11CBaseEntityRK6VectorP9KeyValues

Decompiled

undefined (4 params)

/* InfectedWander::OnSound(Infected*, CBaseEntity*, Vector const&, KeyValues*) */

Infected *
InfectedWander::OnSound(Infected *param_1,CBaseEntity *param_2,Vector *param_3,KeyValues *param_4)

{
  float fVar1;
  uint uVar2;
  char cVar3;
  KeyValues *this;
  char *pcVar4;
  int iVar5;
  InfectedAttack *this_00;
  undefined *puVar6;
  CBaseEntity *this_01;
  undefined4 uVar7;
  longdouble lVar8;
  longdouble lVar9;
  KeyValues *in_stack_00000018;
  Infected *pIVar10;
  Vector *in_stack_ffffffac;
  float local_34;
  float local_30;
  float local_2c;
  float local_28;
  float local_24;
  float local_20;
  
  if ((in_stack_00000018 != (KeyValues *)0x0) && (((byte)param_3[0x1c74] & 8) == 0)) {
    in_stack_ffffffac = (Vector *)0x0;
    this = (KeyValues *)KeyValues::FindKey(in_stack_00000018,"Reaction",false);
    if (this != (KeyValues *)0x0) {
      pcVar4 = (char *)KeyValues::GetString(this,(char *)0x0,"");
      if (((pcVar4 != "SeekAndDestroy") && (iVar5 = _V_stricmp("SeekAndDestroy",pcVar4), iVar5 != 0)
          ) || (cVar3 = (**(code **)(*(int *)(param_3 + 0x1a3c) + 0x114))
                                  (param_3 + 0x1a3c,param_4,
                                   *(undefined4 *)(ZombieForceAttackFromSoundRange._28_4_ + 0x2c)),
               cVar3 == '\0')) {
        in_stack_ffffffac = (Vector *)&DAT_00d539c2;
        pcVar4 = (char *)KeyValues::GetString(this,(char *)0x0,"");
        if ((pcVar4 != "ChaseFromAnywhere") &&
           (iVar5 = _V_stricmp("ChaseFromAnywhere",pcVar4), iVar5 != 0)) goto LAB_00a3ab00;
      }
      uVar2 = *(uint *)(param_4 + 0x180);
      if (((uVar2 != 0xffffffff) &&
          ((puVar6 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar6 != (undefined *)0xfffffffc &&
           (*(uint *)(puVar6 + 8) == uVar2 >> 0xc)))) &&
         (*(CBaseEntity **)(puVar6 + 4) != (CBaseEntity *)0x0)) {
        iVar5 = CBaseEntity::GetGender(*(CBaseEntity **)(puVar6 + 4));
        if (iVar5 != 0x10) {
          uVar2 = *(uint *)(param_4 + 0x180);
          this_01 = (CBaseEntity *)0x0;
          if (((uVar2 != 0xffffffff) &&
              (puVar6 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar6 != (undefined *)0xfffffffc))
             && (*(uint *)(puVar6 + 8) == uVar2 >> 0xc)) {
            this_01 = *(CBaseEntity **)(puVar6 + 4);
          }
          iVar5 = CBaseEntity::GetGender(this_01);
          if (iVar5 != 0x11) goto LAB_00a3aacb;
        }
        iVar5 = CBaseEntity::GetGender((CBaseEntity *)param_3);
        if (iVar5 != 0x10) {
          uVar7 = 0;
          uVar2 = *(uint *)(param_4 + 0x180);
          if (((uVar2 != 0xffffffff) &&
              (puVar6 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar6 != (undefined *)0xfffffffc))
             && (*(uint *)(puVar6 + 8) == uVar2 >> 0xc)) {
            uVar7 = *(undefined4 *)(puVar6 + 4);
          }
          cVar3 = (**(code **)(*(int *)param_3 + 0x42c))(param_3,uVar7,0);
          if (cVar3 != '\0') goto LAB_00a3aacb;
        }
        *(undefined4 *)param_1 = 4;
        *(undefined4 *)(param_1 + 4) = 0;
        *(undefined4 *)(param_1 + 8) = 0;
        *(undefined4 *)(param_1 + 0xc) = 1;
        return param_1;
      }
LAB_00a3aacb:
      this_00 = ::operator_new(0x48);
                    /* try { // try from 00a3aae0 to 00a3aae4 has its CatchHandler @ 00a3af4c */
      InfectedAttack::InfectedAttack(this_00,(CBaseEntity *)param_4);
      *(undefined4 *)param_1 = 1;
      *(InfectedAttack **)(param_1 + 4) = this_00;
      *(char **)(param_1 + 8) = "Heard a sound that forced me to attack its source";
      *(undefined4 *)(param_1 + 0xc) = 2;
      return param_1;
    }
  }
LAB_00a3ab00:
  if (((param_4 == (KeyValues *)0x0) ||
      (cVar3 = (**(code **)(*(int *)param_4 + 0x16c))(param_4), cVar3 == '\0')) ||
     (cVar3 = (**(code **)(*(int *)param_4 + 300))(param_4), cVar3 == '\0')) goto LAB_00a3ab13;
  iVar5 = CBaseEntity::GetTeamNumber((CBaseEntity *)param_4);
  cVar3 = IsASurvivorTeam(iVar5);
  if ((cVar3 == '\0') || (cVar3 = (**(code **)(*(int *)param_3 + 0x588))(param_3), cVar3 == '\0'))
  goto LAB_00a3ab13;
  lVar8 = (longdouble)CTerrorPlayer::GetTimeSinceLastFiredWeapon((CTerrorPlayer *)param_4);
  if ((float)lVar8 < 1.0) {
    lVar8 = (longdouble)(**(code **)(*(int *)(param_3 + 0x1a3c) + 0x124))(param_3 + 0x1a3c,param_4);
    pIVar10 = (Infected *)param_3;
    lVar9 = (longdouble)GetAttentionModifier((InfectedWander *)param_2,(Infected *)param_3);
    if ((float)lVar9 * *(float *)(ZombieHearGunfireRange._28_4_ + 0x2c) <= (float)lVar8)
    goto LAB_00a3ab99;
    (**(code **)(*(int *)param_4 + 0x288))();
    fVar1 = *(float *)(param_2 + 0x4c);
  }
  else {
LAB_00a3ab99:
    cVar3 = (**(code **)(*(int *)param_4 + 0x5c8))(param_4);
    if ((cVar3 == '\0') ||
       ((0.0 < *(float *)(param_4 + 0x2ecc) &&
        (lVar8 = (longdouble)IntervalTimer::Now(),
        (float)lVar8 - *(float *)(param_4 + 0x2ecc) <= 2.0)))) goto LAB_00a3ab13;
    pIVar10 = (Infected *)param_4;
    lVar8 = (longdouble)(**(code **)(*(int *)(param_3 + 0x1a3c) + 0x124))(param_3 + 0x1a3c);
    if (*(float *)(ZombieHearRunnerNearRange._28_4_ + 0x2c) <= (float)lVar8) {
      pIVar10 = (Infected *)param_4;
      lVar8 = (longdouble)(**(code **)(*(int *)(param_3 + 0x1a3c) + 0x124))(param_3 + 0x1a3c);
      if (*(float *)(ZombieHearRunnerFarRange._28_4_ + 0x2c) <= (float)lVar8) goto LAB_00a3ab13;
      if (((byte)param_3[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_3);
      }
      if (((byte)param_4[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_4);
      }
      local_34 = *(float *)(param_4 + 0x2e0) - *(float *)(param_3 + 0x2e0);
      local_30 = *(float *)(param_4 + 0x2e4) - *(float *)(param_3 + 0x2e4);
      local_2c = *(float *)(param_4 + 0x2e8) - *(float *)(param_3 + 0x2e8);
      VectorNormalize((Vector *)&local_34);
      if (((byte)param_4[0x14d] & 0x10) != 0) {
        CBaseEntity::CalcAbsoluteVelocity((CBaseEntity *)param_4);
      }
      local_28 = *(float *)(param_4 + 0x274);
      local_24 = *(float *)(param_4 + 0x278);
      local_20 = *(float *)(param_4 + 0x27c);
      VectorNormalize((Vector *)&local_28);
      if (-0.9396 <= local_24 * local_30 + local_28 * local_34 + local_20 * local_2c)
      goto LAB_00a3ab13;
      (**(code **)(*(int *)param_4 + 0x288))();
      fVar1 = *(float *)(param_2 + 0x4c);
    }
    else {
      (**(code **)(*(int *)param_4 + 0x288))();
      fVar1 = *(float *)(param_2 + 0x4c);
    }
  }
  if (fVar1 <= 0.0) {
    BecomeAlert((InfectedWander *)param_4,pIVar10,in_stack_ffffffac);
  }
LAB_00a3ab13:
  *(undefined4 *)param_1 = 0;
  *(undefined4 *)(param_1 + 4) = 0;
  *(undefined4 *)(param_1 + 8) = 0;
  *(undefined4 *)(param_1 + 0xc) = 1;
  return param_1;
}

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)