ScavengeClusterDistanceSort
0x008b25d0 · 388 bytes · __cdecl
_Z27ScavengeClusterDistanceSortPK7CHandleI11CBaseEntityES3_
Decompiled
undefined (2 params)
/* ScavengeClusterDistanceSort(CHandle<CBaseEntity> const*, CHandle<CBaseEntity> const*) */
int ScavengeClusterDistanceSort(CHandle *param_1,CHandle *param_2)
{
int iVar1;
uint uVar2;
undefined *puVar3;
CBaseEntity *this;
CBaseEntity *this_00;
float fVar4;
float fVar5;
float fVar6;
float fVar7;
float fVar8;
float fVar9;
this = (CBaseEntity *)0x0;
iVar1 = *(int *)(TheDirector + 0x644);
fVar7 = *(float *)(iVar1 + 0x54);
fVar9 = *(float *)(iVar1 + 0x58);
fVar5 = *(float *)(iVar1 + 0x5c);
uVar2 = *(uint *)param_1;
if (((uVar2 != 0xffffffff) &&
(puVar3 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar3 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar3 + 8) == uVar2 >> 0xc)) {
this = *(CBaseEntity **)(puVar3 + 4);
}
if (((byte)this[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(this);
}
fVar8 = *(float *)(this + 0x2e0) - fVar7;
this_00 = (CBaseEntity *)0x0;
fVar4 = *(float *)(this + 0x2e8) - fVar5;
fVar6 = *(float *)(this + 0x2e4) - fVar9;
uVar2 = *(uint *)param_2;
if (((uVar2 != 0xffffffff) &&
(puVar3 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar3 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar3 + 8) == uVar2 >> 0xc)) {
this_00 = *(CBaseEntity **)(puVar3 + 4);
}
if (((byte)this_00[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(this_00);
}
fVar9 = *(float *)(this_00 + 0x2e4) - fVar9;
fVar5 = *(float *)(this_00 + 0x2e8) - fVar5;
fVar7 = *(float *)(this_00 + 0x2e0) - fVar7;
return (int)(fVar4 * fVar4 + fVar8 * fVar8 + fVar6 * fVar6) -
(int)(fVar5 * fVar5 + fVar9 * fVar9 + fVar7 * fVar7);
}
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.