CSoundEnt::InsertSound
0x0082c760 · 566 bytes · __cdecl
_ZN9CSoundEnt11InsertSoundEiRK6VectorifP11CBaseEntityiS4_
Decompiled
undefined (7 params)
/* CSoundEnt::InsertSound(int, Vector const&, int, float, CBaseEntity*, int, CBaseEntity*) */
int CSoundEnt::InsertSound
(int param_1,Vector *param_2,int param_3,float param_4,CBaseEntity *param_5,
int param_6,CBaseEntity *param_7)
{
undefined4 uVar1;
float fVar2;
int iVar3;
undefined4 *puVar4;
int iVar5;
CSoundEnt *pCVar6;
int iVar7;
pCVar6 = g_pSoundEnt;
if (g_pSoundEnt == (CSoundEnt *)0x0) {
return -1;
}
if (param_6 == 0) {
iVar5 = *(int *)(g_pSoundEnt + 0x440);
if (iVar5 != -1) {
*(int *)(g_pSoundEnt + 0x440) = (int)*(short *)(g_pSoundEnt + iVar5 * 0x34 + 0x468);
*(short *)(pCVar6 + iVar5 * 0x34 + 0x468) = (short)*(undefined4 *)(pCVar6 + 0x444);
*(int *)(pCVar6 + 0x444) = iVar5;
goto LAB_0082c7c2;
}
iVar5 = IAllocSound();
}
else {
iVar5 = FindOrAllocateSound(g_pSoundEnt,param_5,param_6);
}
pCVar6 = g_pSoundEnt;
if (iVar5 == -1) {
DevMsg("Could not AllocSound() for InsertSound() (Game DLL)\n");
return -1;
}
LAB_0082c7c2:
iVar3 = iVar5 * 0x34;
*(undefined4 *)(pCVar6 + iVar3 + 0x470) = *(undefined4 *)param_2;
*(undefined4 *)(pCVar6 + iVar3 + 0x474) = *(undefined4 *)(param_2 + 4);
uVar1 = *(undefined4 *)(param_2 + 8);
*(int *)(pCVar6 + iVar3 + 0x45c) = param_1;
*(undefined4 *)(pCVar6 + iVar3 + 0x458) = 0x3f000000;
*(undefined4 *)(pCVar6 + iVar3 + 0x478) = uVar1;
*(int *)(pCVar6 + iVar3 + 0x454) = param_3;
if (param_4 == 3.4028235e+38) {
*(undefined4 *)(pCVar6 + iVar3 + 0x464) = 0x7f7fffff;
pCVar6[iVar3 + 0x46a] = (CSoundEnt)0x1;
}
else {
fVar2 = *(float *)(gpGlobals + 0xc);
pCVar6[iVar3 + 0x46a] = (CSoundEnt)0x0;
*(float *)(pCVar6 + iVar3 + 0x464) = fVar2 + param_4;
}
if (param_5 == (CBaseEntity *)0x0) {
*(undefined4 *)(pCVar6 + iVar3 + 0x44c) = 0xffffffff;
}
else {
puVar4 = (undefined4 *)(**(code **)(*(int *)param_5 + 0xc))(param_5);
*(undefined4 *)(pCVar6 + iVar3 + 0x44c) = *puVar4;
}
if (param_7 == (CBaseEntity *)0x0) {
*(undefined4 *)(pCVar6 + iVar3 + 0x450) = 0xffffffff;
}
else {
puVar4 = (undefined4 *)(**(code **)(*(int *)param_7 + 0xc))(param_7);
*(undefined4 *)(pCVar6 + iVar3 + 0x450) = *puVar4;
}
pCVar6[iVar3 + 0x47c] = (CSoundEnt)(param_5 != (CBaseEntity *)0x0);
*(int *)(pCVar6 + iVar3 + 0x46c) = param_6;
iVar7 = *(int *)(displaysoundlist._28_4_ + 0x30);
if (iVar7 == 1) {
Msg(" Added Sound! Type:%d Duration:%f (Time:%f)\n",*(undefined4 *)(pCVar6 + iVar3 + 0x45c),
(double)param_4,(double)*(float *)(gpGlobals + 0xc));
iVar7 = *(int *)(displaysoundlist._28_4_ + 0x30);
}
if ((iVar7 == 2) && ((param_1 & 8U) != 0)) {
Msg(" Added Danger Sound! Duration:%f (Time:%f)\n",(double)param_4,
(double)*(float *)(gpGlobals + 0xc));
return iVar5;
}
return iVar5;
}
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.