L L4D2node

CSoundEnt::GetLoudestSoundOfType

0x0082da50 · 312 bytes · __cdecl

_ZN9CSoundEnt21GetLoudestSoundOfTypeEiRK6Vector

Decompiled

undefined (2 params)

/* CSoundEnt::GetLoudestSoundOfType(int, Vector const&) */

CSound * CSoundEnt::GetLoudestSoundOfType(int param_1,Vector *param_2)

{
  uint uVar1;
  CSound *this;
  float *pfVar2;
  int iVar3;
  undefined *puVar4;
  float fVar5;
  CSound *local_24;
  float local_20;
  
  if ((g_pSoundEnt == 0) || (iVar3 = *(int *)(g_pSoundEnt + 0x444), iVar3 == -1)) {
    return (CSound *)0x0;
  }
  local_24 = (CSound *)0x0;
  local_20 = 2.6843546e+08;
LAB_0082da9d:
  do {
    this = (CSound *)SoundPointerForIndex(iVar3);
    if (((this != (CSound *)0x0) && (*(int *)(this + 0x10) == param_1)) &&
       ((this[0x30] == (CSound)0x0 ||
        ((((uVar1 = *(uint *)this, uVar1 != 0xffffffff &&
           (puVar4 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar4 != (undefined *)0xfffffffc)) &&
          (*(uint *)(puVar4 + 8) == uVar1 >> 0xc)) && (*(int *)(puVar4 + 4) != 0)))))) {
      pfVar2 = (float *)CSound::GetSoundOrigin(this);
      fVar5 = SQRT((pfVar2[1] - *(float *)(param_2 + 4)) * (pfVar2[1] - *(float *)(param_2 + 4)) +
                   (*pfVar2 - *(float *)param_2) * (*pfVar2 - *(float *)param_2) +
                   (pfVar2[2] - *(float *)(param_2 + 8)) * (pfVar2[2] - *(float *)(param_2 + 8)));
      if ((fVar5 <= (float)*(int *)(this + 8)) && (fVar5 < local_20)) {
        iVar3 = (int)*(short *)(this + 0x1c);
        local_24 = this;
        local_20 = fVar5;
        if (iVar3 == -1) {
          return this;
        }
        goto LAB_0082da9d;
      }
    }
    iVar3 = (int)*(short *)(this + 0x1c);
    if (iVar3 == -1) {
      return local_24;
    }
  } while( true );
}

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)