L L4D2node

CBaseEntity::EmitAmbientSound

0x004b5c60 · 759 bytes · __cdecl

_ZN11CBaseEntity16EmitAmbientSoundEiRK6VectorPKcifPf

Decompiled

undefined (6 params)

/* CBaseEntity::EmitAmbientSound(int, Vector const&, char const*, int, float, float*) */

void CBaseEntity::EmitAmbientSound
               (int param_1,Vector *param_2,char *param_3,int param_4,float param_5,float *param_6)

{
  char cVar1;
  int in_GS_OFFSET;
  bool bVar2;
  longdouble lVar3;
  undefined4 local_fc;
  undefined4 local_f8;
  undefined4 local_f4;
  undefined4 local_f0;
  undefined4 local_ec;
  CRecipientFilter local_e8 [32];
  undefined4 local_c8;
  undefined4 local_c4;
  undefined4 local_c0;
  undefined4 local_bc;
  undefined4 local_b8;
  undefined4 local_b4;
  undefined1 local_b0;
  undefined4 local_ac;
  undefined1 local_a8 [128];
  undefined4 local_28;
  undefined4 local_24;
  int local_20;
  
  local_a8[0] = 0;
  local_c8 = 0;
  local_c4 = 0x3f800000;
  local_c0 = 100;
  local_bc = 100;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  local_b8 = 100;
  local_b4 = 0x4b;
  local_b0 = 0;
  local_ac = 0;
  local_28 = 0;
  local_24 = 0;
  cVar1 = (**(code **)(*soundemitterbase + 0x2c))(soundemitterbase,param_3,&local_c8,0,0);
  if (cVar1 != '\0') {
    if ((param_4 & 2U) != 0) {
      local_c0 = 0;
    }
    if ((param_4 & 1U) != 0) {
      local_c4 = 0;
    }
    (**(code **)(*engine + 0x70))
              (engine,param_1,param_2,local_a8,local_c4,local_b4,param_4,local_c0,param_5);
    bVar2 = (param_4 & 7U) == 0;
    if ((bVar2) || (param_6 != (float *)0x0)) {
      lVar3 = (longdouble)(**(code **)(*enginesound + 0x10))(enginesound,local_a8);
      if (param_6 != (float *)0x0) {
        *param_6 = (float)lVar3;
      }
      (**(code **)(g_SoundEmitterSystem + 0x44))
                (&g_SoundEmitterSystem,param_1,
                 "EmitAmbientSound:  \'%s\' emitted as \'%s\' (ent %i)\n",param_3,local_a8,param_1);
      if (bVar2) {
        CRecipientFilter::CRecipientFilter(local_e8);
                    /* try { // try from 004b5e9f to 004b5eab has its CatchHandler @ 004b5f7f */
        CRecipientFilter::AddAllPlayers(local_e8);
        CRecipientFilter::MakeReliable(local_e8);
        local_fc = 0;
        local_f8 = 0;
        local_f4 = 0;
        local_f0 = 0;
        local_ec = 0;
                    /* try { // try from 004b5f24 to 004b5f28 has its CatchHandler @ 004b5f65 */
        CSoundEmitterSystem::EmitCloseCaption
                  ((CSoundEmitterSystem *)&g_SoundEmitterSystem,(IRecipientFilter *)local_e8,param_1
                   ,false,param_3,(CUtlVector *)&local_fc,(float)lVar3,false,false);
        local_f0 = 0;
        CUtlMemory<Vector,int>::Purge((CUtlMemory<Vector,int> *)&local_fc);
        local_ec = local_fc;
        CUtlMemory<Vector,int>::Purge((CUtlMemory<Vector,int> *)&local_fc);
        CRecipientFilter::~CRecipientFilter(local_e8);
      }
    }
    else {
      (**(code **)(g_SoundEmitterSystem + 0x44))
                (&g_SoundEmitterSystem,param_1,
                 "EmitAmbientSound:  \'%s\' emitted as \'%s\' (ent %i)\n",param_3,local_a8,param_1);
    }
  }
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __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)