SpitterPrepareAmbush::FindAmbushTargetArea
0x00adb5a0 · 403 bytes · __thiscall
_ZNK20SpitterPrepareAmbush20FindAmbushTargetAreaEP7Spitterf
Decompiled
undefined (3 params)
/* SpitterPrepareAmbush::FindAmbushTargetArea(Spitter*, float) const */
undefined4 __thiscall
SpitterPrepareAmbush::FindAmbushTargetArea
(SpitterPrepareAmbush *this,Spitter *param_1,float param_2)
{
float fVar1;
int *piVar2;
CNavArea *pCVar3;
int iVar4;
int iVar5;
undefined4 uVar6;
float fVar7;
SpitterAmbushAreaCollector local_2c [4];
int local_28;
undefined4 local_24;
void *local_20;
undefined4 local_1c;
undefined4 local_18;
int local_14;
void *local_10;
piVar2 = (int *)CDirectorTacticalServices::GetHighestFlowSurvivor
(*(CDirectorTacticalServices **)(TheDirector + 0x628),0);
if ((piVar2 == (int *)0x0) || (local_28 = (**(code **)(*piVar2 + 0x52c))(piVar2), local_28 == 0))
{
return 0;
}
local_24 = *(undefined4 *)(local_28 + 0x154);
local_18 = 0;
local_14 = 0;
local_2c[0] = (SpitterAmbushAreaCollector)0x0;
local_1c = 0x200;
local_20 = malloc(0x800);
local_10 = local_20;
if (((byte)param_1[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_1);
}
/* try { // try from 00adb634 to 00adb725 has its CatchHandler @ 00adb742 */
pCVar3 = (CNavArea *)(**(code **)(*(int *)param_1 + 0x52c))(param_1);
SearchSurroundingAreas<SpitterAmbushAreaCollector>
(pCVar3,(Vector *)(param_1 + 0x2e0),local_2c,param_2,0,-1);
if (local_14 < 1) {
uVar6 = 0;
}
else {
iVar4 = RandomInt(1,100);
iVar5 = local_14;
if ((iVar4 < 0x15) && (0 < local_14)) {
iVar5 = 0;
fVar7 = -99999.0;
iVar4 = -1;
do {
fVar1 = *(float *)(*(int *)((int)local_20 + iVar5 * 4) + 0x34);
if (fVar7 < fVar1) {
iVar4 = iVar5;
fVar7 = fVar1;
}
iVar5 = iVar5 + 1;
} while (iVar5 != local_14);
if (iVar4 != -1) {
uVar6 = *(undefined4 *)((int)local_20 + iVar4 * 4);
goto LAB_00adb6d1;
}
}
iVar5 = RandomInt(0,iVar5 + -1);
uVar6 = *(undefined4 *)((int)local_20 + iVar5 * 4);
}
LAB_00adb6d1:
local_14 = 0;
CUtlMemory<TerrorNavArea*,int>::Purge((CUtlMemory<TerrorNavArea*,int> *)&local_20);
local_10 = local_20;
CUtlMemory<TerrorNavArea*,int>::Purge((CUtlMemory<TerrorNavArea*,int> *)&local_20);
return uVar6;
}
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.