L L4D2node

CAmbientGeneric::ToggleSound

0x005ddb00 · 396 bytes · __thiscall

_ZN15CAmbientGeneric11ToggleSoundEv

Decompiled

undefined (1 param)

/* CAmbientGeneric::ToggleSound() */

void __thiscall CAmbientGeneric::ToggleSound(CAmbientGeneric *this)

{
  CBaseEdict *this_00;
  int iVar1;
  uint uVar2;
  int iVar3;
  
  if (this[0x4b0] == (CAmbientGeneric)0x0) {
    if (this[0x4b1] == (CAmbientGeneric)0x0) {
      (**(code **)(*(int *)this + 0x328))(this,4);
    }
    else {
      this[0x4b0] = (CAmbientGeneric)0x1;
    }
    InitModulationParms(this);
    (**(code **)(*(int *)this + 0x328))(this,0);
  }
  else {
    iVar1 = *(int *)(this + 0x480);
    if (iVar1 == 0) {
      this[0x4b0] = (CAmbientGeneric)0x0;
      uVar2 = *(uint *)(this + 0x148) | 0x10;
      if (*(uint *)(this + 0x148) != uVar2) {
        if (this[0x6c] == (CAmbientGeneric)0x0) {
          this_00 = *(CBaseEdict **)(this + 0x30);
          if (this_00 != (CBaseEdict *)0x0) {
            *(uint *)this_00 = *(uint *)this_00 | 0x101;
            iVar1 = CBaseEdict::GetChangeAccessor(this_00);
            *(undefined2 *)(iVar1 + 2) = 0;
          }
        }
        else {
          this[0x70] = (CAmbientGeneric)((byte)this[0x70] | 1);
        }
        *(uint *)(this + 0x148) = uVar2;
      }
      if ((*(int *)(this + 0x490) == 0) && (*(int *)(this + 0x4a0) == 0)) {
        (**(code **)(*(int *)this + 0x328))(this,4);
        return;
      }
      *(int *)(this + 0x45c) = *(int *)(this + 0x490);
      *(undefined4 *)(this + 0x458) = 0;
      *(int *)(this + 0x46c) = *(int *)(this + 0x4a0);
      *(undefined4 *)(this + 0x468) = 0;
    }
    else {
      if (iVar1 < *(int *)(this + 0x484)) {
        return;
      }
      iVar3 = *(int *)(this + 0x484) + 1;
      *(int *)(this + 0x484) = iVar3;
      *(undefined4 *)(this + 0x45c) = 0;
      *(undefined4 *)(this + 0x458) = *(undefined4 *)(this + 0x48c);
      iVar3 = iVar3 * ((0xff - *(int *)(this + 0x454)) / iVar1) + *(int *)(this + 0x454);
      iVar1 = 0xff;
      if (iVar3 < 0x100) {
        iVar1 = iVar3;
      }
      *(int *)(this + 0x450) = iVar1;
    }
  }
  CBaseEntity::SetNextThink((CBaseEntity *)this,*(float *)(gpGlobals + 0xc) + 0.1,(char *)0x0);
  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)