CNavArea::FindClosestNode
0x007062f0 · 253 bytes · __thiscall
_ZNK8CNavArea15FindClosestNodeERK6Vector10NavDirType
Decompiled
undefined (3 params)
/* CNavArea::FindClosestNode(Vector const&, NavDirType) const */
float * __thiscall CNavArea::FindClosestNode(CNavArea *this,float *param_1,undefined4 param_3)
{
float *pfVar1;
undefined4 *puVar2;
int iVar3;
float *pfVar4;
float fVar5;
float fVar6;
undefined4 *local_30;
undefined4 local_2c;
undefined4 local_28;
int local_24;
undefined4 *local_20;
iVar3 = 0;
do {
if (*(int *)(this + iVar3 * 4 + 0xec) != 0) {
local_30 = (undefined4 *)0x0;
local_2c = 0;
local_28 = 0;
local_24 = 0;
local_20 = (undefined4 *)0x0;
/* try { // try from 00706354 to 00706358 has its CatchHandler @ 007063f1 */
GetNodes(this,param_3,(CUtlMemory<CNavNode*,int> *)&local_30);
if (local_24 < 1) {
pfVar4 = (float *)0x0;
}
else {
pfVar4 = (float *)0x0;
fVar6 = 3.4028235e+38;
puVar2 = local_30;
do {
pfVar1 = (float *)*puVar2;
fVar5 = (param_1[1] - pfVar1[1]) * (param_1[1] - pfVar1[1]) +
(param_1[2] - pfVar1[2]) * (param_1[2] - pfVar1[2]) +
(*param_1 - *pfVar1) * (*param_1 - *pfVar1);
if (fVar5 < fVar6) {
pfVar4 = pfVar1;
fVar6 = fVar5;
}
puVar2 = puVar2 + 1;
} while (puVar2 != local_30 + local_24);
}
local_24 = 0;
CUtlMemory<CNavNode*,int>::Purge((CUtlMemory<CNavNode*,int> *)&local_30);
local_20 = local_30;
CUtlMemory<CNavNode*,int>::Purge((CUtlMemory<CNavNode*,int> *)&local_30);
return pfVar4;
}
iVar3 = iVar3 + 1;
} while (iVar3 != 4);
return (float *)0x0;
}
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.