CPathTrack::Nearest
0x007720a0 · 290 bytes · __thiscall
_ZN10CPathTrack7NearestERK6Vector
Decompiled
undefined (2 params)
/* CPathTrack::Nearest(Vector const&) */
CPathTrack * __thiscall CPathTrack::Nearest(CPathTrack *this,Vector *param_1)
{
CPathTrack *pCVar1;
CPathTrack *pCVar2;
undefined4 uVar3;
int iVar4;
CPathTrack *pCVar5;
float fVar6;
float fVar7;
float fVar8;
pCVar5 = *(CPathTrack **)(this + 0x448);
fVar6 = *(float *)param_1 - *(float *)(this + 0x39c);
fVar8 = *(float *)(param_1 + 4) - *(float *)(this + 0x3a0);
fVar6 = SQRT(fVar8 * fVar8 + fVar6 * fVar6);
if (((pCVar5 == (CPathTrack *)0x0) || ((*(uint *)(this + 0x148) & 0x8000) == 0)) ||
((*(uint *)(this + 0x148) & 4) != 0)) {
pCVar5 = *(CPathTrack **)(this + 0x440);
}
iVar4 = 10000;
pCVar2 = this;
do {
if (pCVar5 == this) {
return pCVar2;
}
while( true ) {
if (pCVar5 == (CPathTrack *)0x0) {
return pCVar2;
}
iVar4 = iVar4 + -1;
if (iVar4 == 0) {
uVar3 = CBaseEntity::GetDebugName((CBaseEntity *)this);
Warning("Bad sequence of path_tracks from %s\n",uVar3);
return (CPathTrack *)0x0;
}
fVar8 = *(float *)param_1 - *(float *)(pCVar5 + 0x39c);
fVar7 = *(float *)(param_1 + 4) - *(float *)(pCVar5 + 0x3a0);
fVar8 = SQRT(fVar8 * fVar8 + fVar7 * fVar7);
if (fVar8 < fVar6) {
pCVar2 = pCVar5;
fVar6 = fVar8;
}
pCVar1 = *(CPathTrack **)(pCVar5 + 0x448);
if (((pCVar1 == (CPathTrack *)0x0) || ((*(uint *)(pCVar5 + 0x148) & 0x8000) == 0)) ||
((*(uint *)(pCVar5 + 0x148) & 4) != 0)) break;
pCVar5 = pCVar1;
if (pCVar1 == this) {
return pCVar2;
}
}
pCVar5 = *(CPathTrack **)(pCVar5 + 0x440);
} while( true );
}
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.