UTIL_EmitAmbientSound
0x004b56c0 · 1364 bytes · __cdecl
_Z21UTIL_EmitAmbientSoundiRK6VectorPKcf12soundlevel_tiifPf
Decompiled
undefined (9 params)
/* UTIL_EmitAmbientSound(int, Vector const&, char const*, float, soundlevel_t, int, int, float,
float*) */
void UTIL_EmitAmbientSound
(int param_1,undefined4 param_2,char *param_3,undefined4 param_4,undefined4 param_5,
uint param_6,undefined4 param_7,undefined4 param_8,float *param_9)
{
char cVar1;
int iVar2;
int in_GS_OFFSET;
bool bVar3;
longdouble lVar4;
float local_124;
undefined4 local_110;
undefined4 local_10c;
undefined4 local_108;
undefined4 local_104;
undefined4 local_100;
undefined4 local_fc;
undefined4 local_f8;
undefined4 local_f4;
undefined4 local_f0;
undefined4 local_ec;
CRecipientFilter local_e8 [32];
char local_c8 [4];
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_20 = *(int *)(in_GS_OFFSET + 0x14);
if ((param_3 == (char *)0x0) || (*param_3 != '!')) {
local_110 = 0;
local_10c = 0;
local_108 = 0;
local_104 = 0;
local_100 = 0;
/* try { // try from 004b5768 to 004b5a0e has its CatchHandler @ 004b5c26 */
cVar1 = CEnvMicrophone::OnSoundPlayed
(param_1,param_3,param_5,param_4,param_6,param_7,param_2,param_8,
(CUtlMemory<Vector,int> *)&local_110);
if (cVar1 == '\0') {
if ((param_3 == (char *)0x0) ||
((iVar2 = V_stristr(param_3,".wav"), iVar2 == 0 &&
(iVar2 = V_stristr(param_3,".mp3"), iVar2 == 0)))) {
local_c8[0] = '\0';
local_c8[1] = '\0';
local_c8[2] = '\0';
local_c8[3] = '\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;
cVar1 = (**(code **)(*soundemitterbase + 0x2c))(soundemitterbase,param_3,local_c8,0,0);
if (cVar1 != '\0') {
if ((param_6 & 2) != 0) {
local_c0 = param_7;
}
if ((param_6 & 1) != 0) {
local_c4 = param_4;
}
(**(code **)(*engine + 0x70))
(engine,param_1,param_2,local_a8,local_c4,local_b4,param_6,local_c0,param_8);
bVar3 = (param_6 & 7) == 0;
if ((bVar3) || (local_124 = 0.0, param_9 != (float *)0x0)) {
/* try { // try from 004b5bf4 to 004b5bf6 has its CatchHandler @ 004b5c26 */
lVar4 = (longdouble)(**(code **)(*enginesound + 0x10))(enginesound,local_a8);
local_124 = (float)lVar4;
if (param_9 != (float *)0x0) {
*param_9 = local_124;
}
}
(**(code **)(g_SoundEmitterSystem + 0x44))
(&g_SoundEmitterSystem,param_1,
"EmitAmbientSound: \'%s\' emitted as \'%s\' (ent %i)\n",param_3,local_a8,
param_1);
if (bVar3) {
CRecipientFilter::CRecipientFilter(local_e8);
/* try { // try from 004b5a12 to 004b5a1e has its CatchHandler @ 004b5c52 */
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 004b5a97 to 004b5a9b has its CatchHandler @ 004b5c38 */
CSoundEmitterSystem::EmitCloseCaption
((CSoundEmitterSystem *)&g_SoundEmitterSystem,(IRecipientFilter *)local_e8,
param_1,false,param_3,(CUtlVector *)&local_fc,local_124,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 **)(*engine + 0x70))
(engine,param_1,param_2,param_3,param_4,param_5,param_6,param_7,param_8);
if (param_9 != (float *)0x0) {
lVar4 = (longdouble)(**(code **)(*enginesound + 0x10))(enginesound,param_3);
*param_9 = (float)lVar4;
}
(**(code **)(g_SoundEmitterSystem + 0x44))
(&g_SoundEmitterSystem,param_1,
"EmitAmbientSound: Raw wave emitted \'%s\' (ent %i)\n",param_3,param_1);
}
}
local_104 = 0;
CUtlMemory<Vector,int>::Purge((CUtlMemory<Vector,int> *)&local_110);
local_100 = local_110;
CUtlMemory<Vector,int>::Purge((CUtlMemory<Vector,int> *)&local_110);
}
else {
iVar2 = SENTENCEG_Lookup(param_3);
if (-1 < iVar2) {
V_snprintf(local_c8,0x20,"!%d",iVar2);
(**(code **)(*engine + 0x70))
(engine,param_1,param_2,local_c8,param_4,param_5,param_6,param_7,param_8);
if (param_9 != (float *)0x0) {
lVar4 = (longdouble)(**(code **)(*enginesound + 0x10))(enginesound,local_c8);
*param_9 = (float)lVar4;
}
CSoundEmitterSystem::TraceEmitSound
((CSoundEmitterSystem *)&g_SoundEmitterSystem,param_1,
"UTIL_EmitAmbientSound: Sentence emitted \'%s\' (ent %i)\n",local_c8,param_1);
}
}
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return;
}
SourceMod gamedata
paste intoaddons/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.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.