Test_SpawnRandomEntities
0x00af3f90 · 377 bytes · __cdecl
_Z24Test_SpawnRandomEntitiesRK8CCommand
Decompiled
undefined (1 param)
/* Test_SpawnRandomEntities(CCommand const&) */
void Test_SpawnRandomEntities(CCommand *param_1)
{
uint uVar1;
char *pcVar2;
long lVar3;
long lVar4;
int iVar5;
undefined4 *puVar6;
int iVar7;
int iVar8;
int *piVar9;
undefined *puVar10;
int iVar11;
undefined4 *puVar12;
if (*(int *)param_1 < 3) {
Error("Test_SpawnRandomEntities <min # entities> <max # entities> missing arguments.");
}
if (DAT_0102ca10 == 0) {
Error("Test_SpawnRandomEntities: not initialized (call Test_InitRandomEntitySpawner frst).");
}
pcVar2 = "";
if (1 < *(int *)param_1) {
pcVar2 = *(char **)(param_1 + 0x40c);
}
lVar3 = strtol(pcVar2,(char **)0x0,10);
pcVar2 = "";
if (2 < *(int *)param_1) {
pcVar2 = *(char **)(param_1 + 0x410);
}
iVar11 = 0;
lVar4 = strtol(pcVar2,(char **)0x0,10);
iVar5 = RandomInt(lVar3,lVar4);
if (0 < iVar5) {
do {
while( true ) {
iVar7 = RandomInt(0,DAT_0102ca10 + -1);
uVar1 = *(uint *)(g_StressEntities + iVar7 * 4);
if ((((uVar1 != 0xffffffff) &&
(puVar10 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc))
&& (*(uint *)(puVar10 + 8) == uVar1 >> 0xc)) &&
(*(CBaseEntity **)(puVar10 + 4) != (CBaseEntity *)0x0)) {
UTIL_RemoveImmediate(*(CBaseEntity **)(puVar10 + 4));
}
iVar8 = RandomInt(0,DAT_0102ca24 + -1);
piVar9 = (int *)(**(code **)(*(int *)(g_StressEntityRegs + iVar8 * 4) + 4))();
puVar12 = (undefined4 *)(iVar7 * 4 + g_StressEntities);
if (piVar9 != (int *)0x0) break;
iVar11 = iVar11 + 1;
*puVar12 = 0xffffffff;
if (iVar11 == iVar5) {
return;
}
}
iVar11 = iVar11 + 1;
puVar6 = (undefined4 *)(**(code **)(*piVar9 + 0xc))(piVar9);
*puVar12 = *puVar6;
} while (iVar11 != iVar5);
}
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.