L L4D2node

CEnvMicrophone::CanHearSound

0x00687ee0 · 473 bytes · __thiscall

_ZN14CEnvMicrophone12CanHearSoundEP6CSoundRf

Decompiled

undefined (3 params)

/* CEnvMicrophone::CanHearSound(CSound*, float&) */

undefined4 __thiscall
CEnvMicrophone::CanHearSound(CEnvMicrophone *this,CSound *param_1,float *param_2)

{
  uint uVar1;
  char cVar2;
  float *pfVar3;
  undefined *puVar4;
  undefined *puVar5;
  CBaseEntity *this_00;
  float fVar6;
  
  *param_2 = 0.0;
  if ((this[0x440] == (CEnvMicrophone)0x0) &&
     (((((uVar1 = *(uint *)(this + 0x46c), uVar1 == 0xffffffff ||
         (puVar4 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar4 == (undefined *)0xfffffffc)) ||
        (*(uint *)(puVar4 + 8) != uVar1 >> 0xc)) ||
       (*(CBaseFilter **)(puVar4 + 4) == (CBaseFilter *)0x0)) ||
      (((uVar1 = *(uint *)param_1, uVar1 != 0xffffffff &&
        (puVar5 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar5 != (undefined *)0xfffffffc)) &&
       ((*(uint *)(puVar5 + 8) == uVar1 >> 0xc &&
        ((*(CBaseEntity **)(puVar5 + 4) != (CBaseEntity *)0x0 &&
         (cVar2 = CBaseFilter::PassesFilter
                            (*(CBaseFilter **)(puVar4 + 4),(CBaseEntity *)this,
                             *(CBaseEntity **)(puVar5 + 4)), cVar2 != '\0')))))))))) {
    uVar1 = *(uint *)(this + 0x444);
    this_00 = (CBaseEntity *)0x0;
    if ((uVar1 != 0xffffffff) &&
       ((puVar4 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar4 != (undefined *)0xfffffffc &&
        (*(uint *)(puVar4 + 8) == uVar1 >> 0xc)))) {
      this_00 = *(CBaseEntity **)(puVar4 + 4);
    }
    if (((byte)this_00[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition(this_00);
    }
    pfVar3 = (float *)CSound::GetSoundOrigin(param_1);
    fVar6 = SQRT((*pfVar3 - *(float *)(this_00 + 0x2e0)) * (*pfVar3 - *(float *)(this_00 + 0x2e0)) +
                 (pfVar3[1] - *(float *)(this_00 + 0x2e4)) *
                 (pfVar3[1] - *(float *)(this_00 + 0x2e4)) +
                 (pfVar3[2] - *(float *)(this_00 + 0x2e8)) *
                 (pfVar3[2] - *(float *)(this_00 + 0x2e8)));
    if (fVar6 == 0.0) {
      *param_2 = 1.0;
      return 1;
    }
    if (((*(float *)(this + 0x454) == 0.0) || (fVar6 <= *(float *)(this + 0x454))) &&
       (fVar6 <= (float)*(int *)(param_1 + 8) * *(float *)(this + 0x44c))) {
      fVar6 = 1.0 - fVar6 / ((float)*(int *)(param_1 + 8) * *(float *)(this + 0x44c));
      if (fVar6 <= 0.0) {
        fVar6 = 0.0;
      }
      if (1.0 <= fVar6) {
        fVar6 = 1.0;
      }
      *param_2 = fVar6;
      return 1;
    }
  }
  return 0;
}

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)