L L4D2node

SurvivorIntention::OnSound

0x0094c600 · 665 bytes · __thiscall

_ZN17SurvivorIntention7OnSoundEP11CBaseEntityRK6VectorP9KeyValues

Decompiled

undefined (4 params)

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

void __thiscall
SurvivorIntention::OnSound
          (SurvivorIntention *this,CBaseEntity *param_1,Vector *param_2,KeyValues *param_3)

{
  uint uVar1;
  char cVar2;
  CBaseEntity *this_00;
  int *piVar3;
  int iVar4;
  int iVar5;
  undefined4 *puVar6;
  undefined *puVar7;
  int iVar8;
  longdouble lVar9;
  float fVar10;
  undefined4 local_24;
  float local_20;
  
  this_00 = (CBaseEntity *)(**(code **)(*(int *)param_1 + 0x144))(param_1);
  if ((((this_00 != (CBaseEntity *)0x0) &&
       (cVar2 = CTerrorGameRules::HasPlayerControlledZombies(), cVar2 == '\0')) &&
      (iVar4 = CBaseEntity::GetTeamNumber(this_00), iVar4 == 3)) &&
     (cVar2 = (**(code **)(*(int *)this_00 + 0x558))(this_00), cVar2 == '\0')) {
    piVar3 = (int *)(**(code **)(*(int *)this + 0xb0))(this);
    cVar2 = (**(code **)(*piVar3 + 0x114))
                      (piVar3,param_1,*(undefined4 *)(SurvivorBotFarHearingRange._28_4_ + 0x2c));
    if (cVar2 != '\0') {
      piVar3 = (int *)(**(code **)(*(int *)this + 0xb0))(this);
      cVar2 = (**(code **)(*piVar3 + 0x114))
                        (piVar3,param_1,*(undefined4 *)(SurvivorBotNearHearingRange._28_4_ + 0x2c));
      fVar10 = 100.0;
      if (cVar2 == '\0') {
        piVar3 = (int *)(**(code **)(*(int *)this + 0xb0))(this);
        lVar9 = (longdouble)(**(code **)(*piVar3 + 0x124))(piVar3,this_00);
        fVar10 = (((float)lVar9 - *(float *)(SurvivorBotNearHearingRange._28_4_ + 0x2c)) /
                  (*(float *)(SurvivorBotNearHearingRange._28_4_ + 0x2c) -
                  *(float *)(SurvivorBotFarHearingRange._28_4_ + 0x2c)) + 1.0) * 100.0;
      }
      lVar9 = (longdouble)RandomFloat(0,0x42c80000);
      if ((float)lVar9 < fVar10) {
        if (0 < *(int *)(this + 0x84)) {
          iVar4 = 0;
          do {
            uVar1 = *(uint *)(*(int *)(this + 0x78) + iVar4 * 8);
            if (((uVar1 != 0xffffffff) &&
                (puVar7 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar7 != (undefined *)0xfffffffc)
                ) && ((*(uint *)(puVar7 + 8) == uVar1 >> 0xc && (*(int *)(puVar7 + 4) != 0)))) {
              iVar8 = *(int *)(*(int *)(puVar7 + 4) + 0x30);
              if (iVar8 == 0) {
                iVar8 = 0;
              }
              else {
                iVar8 = iVar8 - *(int *)(gpGlobals + 0x58) >> 4;
              }
              if (*(int *)(this_00 + 0x30) == 0) {
                iVar5 = 0;
              }
              else {
                iVar5 = *(int *)(this_00 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
              }
              if (iVar8 == iVar5) goto LAB_0094c62a;
            }
            iVar4 = iVar4 + 1;
          } while (iVar4 != *(int *)(this + 0x84));
        }
        local_24 = 0xffffffff;
        puVar6 = (undefined4 *)(**(code **)(*(int *)this_00 + 0xc))(this_00);
        local_24 = *puVar6;
        fVar10 = *(float *)(gpGlobals + 0xc);
        lVar9 = (longdouble)RandomFloat(0x3e99999a,0x3f800000);
        local_20 = (float)lVar9 + fVar10;
        CUtlVector<SurvivorIntention::AudibleThreat,CUtlMemory<SurvivorIntention::AudibleThreat,int>>
        ::InsertBefore((CUtlVector<SurvivorIntention::AudibleThreat,CUtlMemory<SurvivorIntention::AudibleThreat,int>>
                        *)(this + 0x78),*(int *)(this + 0x84),(AudibleThreat *)&local_24);
      }
    }
  }
LAB_0094c62a:
  for (piVar3 = (int *)(**(code **)(*(int *)this + 8))(this); piVar3 != (int *)0x0;
      piVar3 = (int *)(**(code **)(*(int *)this + 0xc))(this,piVar3)) {
    (**(code **)(*piVar3 + 0x5c))(piVar3,param_1,param_2,param_3);
  }
  return;
}

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)