L L4D2node

CAmbientGeneric::ComputeMaxAudibleDistance

0x005dd480 · 366 bytes · __thiscall

_ZN15CAmbientGeneric25ComputeMaxAudibleDistanceEv

Decompiled

undefined (1 param)

/* CAmbientGeneric::ComputeMaxAudibleDistance() */

void __thiscall CAmbientGeneric::ComputeMaxAudibleDistance(CAmbientGeneric *this)

{
  int iVar1;
  longdouble lVar2;
  float fVar3;
  float fVar4;
  float local_18;
  
  if ((*(int *)(this + 0x448) == 0) || (*(float *)(this + 0x440) == 0.0)) {
LAB_005dd4a6:
    *(undefined4 *)(this + 0x444) = 0xbf800000;
  }
  else {
    lVar2 = (longdouble)
            (**(code **)(*enginesound + 0x34))
                      (enginesound,*(int *)(this + 0x448),*(float *)(this + 0x440));
    if ((float)lVar2 <= 0.00101) {
      *(undefined4 *)(this + 0x444) = *(undefined4 *)(this + 0x440);
    }
    else {
      local_18 = *(float *)(this + 0x440);
      fVar4 = local_18 + local_18;
      while (fVar3 = fVar4,
            lVar2 = (longdouble)
                    (**(code **)(*enginesound + 0x34))
                              (enginesound,*(undefined4 *)(this + 0x448),fVar3),
            0.00101 < (float)lVar2) {
        if (100000.0 < fVar3) goto LAB_005dd4a6;
        fVar4 = fVar3 + fVar3;
        local_18 = fVar3;
      }
      iVar1 = 4;
      do {
        fVar4 = (local_18 + fVar3) * 0.5;
        lVar2 = (longdouble)
                (**(code **)(*enginesound + 0x34))(enginesound,*(undefined4 *)(this + 0x448),fVar4);
        if ((float)lVar2 <= 0.00101) {
          fVar3 = fVar4;
          fVar4 = local_18;
        }
        local_18 = fVar4;
        iVar1 = iVar1 + -1;
      } while (iVar1 != 0);
      *(float *)(this + 0x444) = fVar3;
    }
  }
  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)