Path::MoveCursorToClosestPosition
0x0075ee50 · 513 bytes · __thiscall
_ZNK4Path27MoveCursorToClosestPositionERK6VectorNS_8SeekTypeEf
Decompiled
undefined (4 params)
/* Path::MoveCursorToClosestPosition(Vector const&, Path::SeekType, float) const */
void __thiscall
Path::MoveCursorToClosestPosition(Path *this,Vector *param_1,uint param_3,float param_4)
{
float fVar1;
float fVar2;
float fVar3;
float fVar4;
float fVar5;
Path *pPVar6;
char cVar7;
Path *pPVar8;
Path *pPVar9;
float fVar10;
float fVar11;
float fVar12;
float local_38;
float local_30;
float local_28;
float local_24;
float local_20;
cVar7 = (**(code **)(*(int *)this + 0x44))(this);
if ((cVar7 == '\0') || (1 < param_3)) {
return;
}
if ((param_3 != 1) || (pPVar9 = *(Path **)(this + 0x4440), pPVar9 == (Path *)0x0)) {
pPVar9 = this + 4;
}
fVar10 = *(float *)param_1;
local_30 = 0.0;
*(float *)(this + 0x4424) = fVar10;
fVar11 = *(float *)(param_1 + 4);
*(float *)(this + 0x4428) = fVar11;
fVar12 = *(float *)(param_1 + 8);
local_38 = 1e+11;
*(float *)(this + 0x442c) = fVar12;
*(Path **)(this + 0x4440) = pPVar9;
if (0.0 <= param_4) {
pPVar8 = (Path *)(**(code **)(*(int *)this + 0x58))(this,pPVar9);
while (pPVar6 = pPVar8, pPVar6 != (Path *)0x0) {
CalcClosestPointOnLineSegment
(param_1,(Vector *)(pPVar9 + 8),(Vector *)(pPVar6 + 8),(Vector *)&local_28,
(float *)0x0);
fVar10 = (local_28 - *(float *)param_1) * (local_28 - *(float *)param_1) +
(local_24 - *(float *)(param_1 + 4)) * (local_24 - *(float *)(param_1 + 4)) +
(local_20 - *(float *)(param_1 + 8)) * (local_20 - *(float *)(param_1 + 8));
if (fVar10 < local_38) {
*(float *)(this + 0x4424) = local_28;
*(float *)(this + 0x4428) = local_24;
*(float *)(this + 0x442c) = local_20;
*(Path **)(this + 0x4440) = pPVar9;
local_38 = fVar10;
}
local_30 = local_30 + *(float *)(pPVar9 + 0x28);
if ((param_4 != 0.0) && (param_4 < local_30)) break;
pPVar8 = (Path *)(**(code **)(*(int *)this + 0x58))(this,pPVar6);
pPVar9 = pPVar6;
}
pPVar9 = *(Path **)(this + 0x4440);
fVar10 = *(float *)(this + 0x4424);
fVar11 = *(float *)(this + 0x4428);
fVar12 = *(float *)(this + 0x442c);
}
fVar1 = *(float *)(pPVar9 + 0xc);
fVar2 = *(float *)(pPVar9 + 0x10);
fVar3 = *(float *)(pPVar9 + 8);
fVar4 = *(float *)(pPVar9 + 0x28);
fVar5 = *(float *)(pPVar9 + 0x2c);
this[0x4444] = (Path)0x1;
*(float *)(this + 0x4420) =
(SQRT((fVar11 - fVar1) * (fVar11 - fVar1) + (fVar12 - fVar2) * (fVar12 - fVar2) +
(fVar10 - fVar3) * (fVar10 - fVar3)) / fVar4) * fVar4 + fVar5;
return;
}
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.