CDirectorTacticalServices::GetClosestCharacterWhoIsIT
0x008c0ef0 · 552 bytes · __thiscall
_ZNK25CDirectorTacticalServices26GetClosestCharacterWhoIsITEPK20CBaseCombatCharacter
Decompiled
undefined (2 params)
/* CDirectorTacticalServices::GetClosestCharacterWhoIsIT(CBaseCombatCharacter const*) const */
CBaseCombatCharacter * __thiscall
CDirectorTacticalServices::GetClosestCharacterWhoIsIT
(CDirectorTacticalServices *this,CBaseCombatCharacter *param_1)
{
float fVar1;
float fVar2;
float fVar3;
int *piVar4;
char cVar5;
float *pfVar6;
CBaseCombatCharacter *pCVar7;
int iVar8;
uint uVar9;
CBaseCombatCharacter *pCVar10;
int iVar11;
float fVar12;
float fVar13;
float fVar14;
float local_24;
CBaseCombatCharacter *local_20;
pfVar6 = (float *)(**(code **)(*(int *)param_1 + 0x288))(param_1);
local_20 = (CBaseCombatCharacter *)0x0;
fVar1 = *pfVar6;
fVar2 = pfVar6[1];
local_24 = 1e+08;
fVar3 = pfVar6[2];
if (0 < *(int *)(gpGlobals + 0x14)) {
iVar11 = 1;
do {
pCVar7 = (CBaseCombatCharacter *)UTIL_PlayerByIndex(iVar11);
fVar12 = local_24;
pCVar10 = local_20;
if (pCVar7 == (CBaseCombatCharacter *)0x0) {
LAB_008c0fa0:
fVar12 = local_24;
pCVar10 = local_20;
}
else if ((*(int *)(pCVar7 + 0x30) != 0) &&
(*(int *)(pCVar7 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4 != 0)) {
cVar5 = (**(code **)(*(int *)pCVar7 + 0x16c))(pCVar7);
if ((cVar5 != '\0') &&
((((*(int *)(pCVar7 + 0x1f6c) != 2 &&
(iVar8 = (**(code **)(*(int *)pCVar7 + 0x148))(pCVar7), iVar8 == 0)) &&
(param_1 != pCVar7)) &&
((cVar5 = (**(code **)(*(int *)pCVar7 + 300))(pCVar7), cVar5 != '\0' &&
(cVar5 = (**(code **)(*(int *)pCVar7 + 0x550))(pCVar7), cVar5 != '\0')))))) {
pfVar6 = (float *)(**(code **)(*(int *)pCVar7 + 0x288))(pCVar7);
fVar14 = *pfVar6 - fVar1;
fVar12 = pfVar6[1] - fVar2;
fVar13 = pfVar6[2] - fVar3;
fVar12 = fVar12 * fVar12 + fVar14 * fVar14 + fVar13 * fVar13;
pCVar10 = pCVar7;
if (fVar12 < local_24) goto LAB_008c0fa6;
}
goto LAB_008c0fa0;
}
LAB_008c0fa6:
local_20 = pCVar10;
local_24 = fVar12;
iVar11 = iVar11 + 1;
} while (iVar11 <= *(int *)(gpGlobals + 0x14));
}
iVar11 = TheNextBots();
uVar9 = (uint)*(ushort *)(iVar11 + 0x10);
if (uVar9 != 0xffff) {
iVar8 = *(int *)(iVar11 + 4);
do {
while( true ) {
piVar4 = *(int **)(iVar8 + uVar9 * 8);
pCVar10 = (CBaseCombatCharacter *)(**(code **)(*piVar4 + 0xb4))(piVar4);
if (((param_1 != pCVar10) &&
(cVar5 = (**(code **)(*(int *)pCVar10 + 300))(pCVar10), cVar5 != '\0')) &&
(cVar5 = (**(code **)(*(int *)pCVar10 + 0x550))(pCVar10), cVar5 != '\0')) break;
LAB_008c0fd0:
iVar8 = *(int *)(iVar11 + 4);
uVar9 = (uint)*(ushort *)(iVar8 + 6 + uVar9 * 8);
if (uVar9 == 0xffff) {
return local_20;
}
}
pfVar6 = (float *)(**(code **)(*(int *)pCVar10 + 0x288))(pCVar10);
fVar14 = *pfVar6 - fVar1;
fVar12 = pfVar6[2] - fVar3;
fVar13 = pfVar6[1] - fVar2;
fVar12 = fVar12 * fVar12 + fVar14 * fVar14 + fVar13 * fVar13;
if (local_24 <= fVar12) goto LAB_008c0fd0;
iVar8 = *(int *)(iVar11 + 4);
uVar9 = (uint)*(ushort *)(iVar8 + 6 + uVar9 * 8);
local_24 = fVar12;
local_20 = pCVar10;
} while (uVar9 != 0xffff);
}
return local_20;
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
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.
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.