CSoundEnt::Initialize
0x0082cc60 · 373 bytes · __thiscall
_ZN9CSoundEnt10InitializeEv
Decompiled
undefined (1 param)
/* CSoundEnt::Initialize() */
void __thiscall CSoundEnt::Initialize(CSoundEnt *this)
{
undefined4 uVar1;
undefined4 uVar2;
undefined4 uVar3;
CSoundEnt *pCVar4;
int iVar5;
int iVar6;
CSoundEnt *pCVar7;
int iVar8;
int local_20;
local_20 = gpGlobals;
*(undefined4 *)(this + 0x440) = 0;
*(undefined4 *)(this + 0x444) = 0xffffffff;
iVar8 = *(int *)(local_20 + 0x14);
iVar5 = 0x40;
if (1 < iVar8) {
iVar5 = 0x80;
if (iVar8 < 0x61) {
iVar5 = iVar8 + 0x20;
}
}
if (iVar5 <= iVar8 + 0xf) {
Warning("CSoundEnt pool is low on sounds due to high number of clients.\n");
local_20 = gpGlobals;
}
uVar3 = DAT_01053d50;
uVar2 = DAT_01053d4c;
uVar1 = vec3_origin;
pCVar4 = this + 0x45c;
iVar8 = 0;
pCVar7 = this + 0x470;
do {
iVar6 = iVar8;
*(undefined4 *)pCVar7 = uVar1;
*(undefined4 *)(pCVar7 + 4) = uVar2;
*(undefined4 *)(pCVar7 + 8) = uVar3;
*(short *)(pCVar4 + 0xc) = (short)iVar6 + 1;
*(undefined4 *)pCVar4 = 0;
*(undefined4 *)(pCVar4 + -8) = 0;
*(undefined4 *)(pCVar4 + -4) = 0;
*(undefined4 *)(pCVar4 + 8) = 0;
pCVar4[0xe] = (CSoundEnt)0x0;
*(undefined4 *)(pCVar4 + 4) = 0xffffffff;
pCVar4 = pCVar4 + 0x34;
iVar8 = iVar6 + 1;
pCVar7 = pCVar7 + 0x34;
} while (iVar6 + 1 < iVar5);
iVar8 = 0;
*(undefined2 *)(this + iVar6 * 0x34 + 0x468) = 0xffff;
if (0 < *(int *)(local_20 + 0x14)) {
do {
iVar5 = *(int *)(this + 0x440);
if (iVar5 == -1) {
iVar5 = IAllocSound();
if (iVar5 == -1) {
DevMsg("Could not AllocSound() for Client Reserve! (DLL)\n");
return;
}
}
else {
*(int *)(this + 0x440) = (int)*(short *)(this + iVar5 * 0x34 + 0x468);
*(short *)(this + iVar5 * 0x34 + 0x468) = (short)*(undefined4 *)(this + 0x444);
*(int *)(this + 0x444) = iVar5;
}
iVar8 = iVar8 + 1;
this[iVar5 * 0x34 + 0x46a] = (CSoundEnt)0x1;
} while (iVar8 < *(int *)(gpGlobals + 0x14));
}
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.