L L4D2node

CBreakable::MaterialSoundRandom

0x006b36c0 · 761 bytes · __cdecl

_ZN10CBreakable19MaterialSoundRandomEi9Materialsf

Decompiled

undefined (3 params)

/* CBreakable::MaterialSoundRandom(int, Materials, float) */

void CBreakable::MaterialSoundRandom(uint param_1,uint param_2,undefined4 param_3)

{
  byte *pbVar1;
  int iVar2;
  char cVar3;
  int *piVar4;
  byte *pbVar5;
  undefined1 *puVar6;
  int in_GS_OFFSET;
  float local_134;
  undefined **local_12c [8];
  undefined4 local_10c;
  undefined1 *local_108;
  undefined4 local_104;
  int local_100;
  undefined4 local_fc;
  undefined4 local_f8;
  undefined4 local_f4;
  undefined4 local_f0;
  undefined4 local_ec;
  undefined1 local_e8;
  undefined1 local_e7;
  undefined1 local_e6;
  undefined4 local_e4;
  undefined4 local_e0;
  undefined4 local_dc;
  undefined4 local_d8;
  undefined4 local_d4;
  undefined4 local_d0;
  undefined2 local_cc;
  undefined4 local_c8;
  undefined4 local_c4;
  undefined4 local_c0;
  undefined4 local_bc;
  undefined4 local_b8;
  int local_b4;
  undefined1 local_b0;
  undefined4 local_ac;
  undefined1 local_a8 [128];
  undefined4 local_28;
  undefined4 local_24;
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  puVar6 = &stack0xfffffeb4;
  if ((9 < param_2) ||
     (puVar6 = &stack0xfffffeb4, *(char **)(CSWTCH_1687 + param_2 * 4) == (char *)0x0))
  goto LAB_006b3773;
  local_c8 = 0;
  local_c4 = 0x3f800000;
  local_c0 = 100;
  local_bc = 100;
  local_b8 = 100;
  local_b4 = 0x4b;
  local_a8[0] = 0;
  local_b0 = 0;
  local_ac = 0;
  local_28 = 0;
  local_24 = 0;
  cVar3 = CBaseEntity::GetParametersForSound
                    (*(char **)(CSWTCH_1687 + param_2 * 4),(CSoundParameters *)&local_c8,(char *)0x0
                    );
  iVar2 = local_b4;
  puVar6 = &stack0xfffffeb4;
  if (cVar3 == '\0') goto LAB_006b3773;
  pbVar1 = *(byte **)(gpGlobals + 0x58);
  if (param_1 < 0x800) {
    if (pbVar1 == (byte *)0x0) goto LAB_006b39b2;
    pbVar5 = pbVar1 + param_1 * 0x10;
    if ((pbVar1[param_1 * 0x10] & 2) != 0) goto LAB_006b39ac;
LAB_006b37ca:
    if (*(int **)(pbVar5 + 0xc) == (int *)0x0) goto LAB_006b39b2;
    piVar4 = (int *)(**(code **)(**(int **)(pbVar5 + 0xc) + 0x18))();
  }
  else {
    if (pbVar1 != (byte *)0x0) {
LAB_006b39ac:
      pbVar5 = pbVar1;
      if ((*pbVar1 & 2) == 0) goto LAB_006b37ca;
    }
LAB_006b39b2:
    piVar4 = (int *)0x0;
  }
  (**(code **)(*piVar4 + 0x28c))();
  CRecipientFilter::CRecipientFilter((CRecipientFilter *)local_12c);
  local_12c[0] = &PTR__CPASFilter_00bfaf28;
                    /* try { // try from 006b3816 to 006b381a has its CatchHandler @ 006b39fa */
  CRecipientFilter::AddRecipientsByPAS((CRecipientFilter *)local_12c,(Vector *)&local_10c);
  local_12c[0] = &PTR__CPASAttenuationFilter_00c08ec8;
  local_134 = 4.0;
  if (0x32 < iVar2) {
    local_134 = 20.0 / (float)(iVar2 + -0x32);
  }
                    /* try { // try from 006b3868 to 006b388a has its CatchHandler @ 006b39f6 */
  (**(code **)(*piVar4 + 0x28c))();
  puVar6 = &stack0xfffffeac;
  CPASAttenuationFilter::Filter((CPASAttenuationFilter *)local_12c,(Vector *)&local_10c,local_134);
  local_cc = 0xffff;
  local_fc = 0;
  local_f8 = 100;
  local_10c = local_c8;
  local_108 = local_a8;
  local_f4 = 0;
  local_f0 = 0;
  local_ec = 0;
  local_100 = local_b4;
  local_e8 = 1;
  local_e7 = 0;
  local_e6 = 0;
  local_e4 = 0xffffffff;
  local_e0 = 0;
  local_dc = 0;
  local_d8 = 0;
  local_d4 = 0;
  local_d0 = 0;
  local_104 = param_3;
                    /* try { // try from 006b3959 to 006b395d has its CatchHandler @ 006b39cc */
  CBaseEntity::EmitSound((IRecipientFilter *)local_12c,param_1,(EmitSound_t *)&local_10c);
  local_d4 = 0;
  CUtlMemory<Vector,int>::Purge((CUtlMemory<Vector,int> *)&local_e0);
  local_d0 = local_e0;
  CUtlMemory<Vector,int>::Purge((CUtlMemory<Vector,int> *)&local_e0);
  local_12c[0] = &PTR__CPASFilter_00bfaf28;
  CRecipientFilter::~CRecipientFilter((CRecipientFilter *)local_12c);
LAB_006b3773:
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    *(undefined1 **)(puVar6 + -4) = &LAB_006b39cc;
    __stack_chk_fail();
  }
  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)