L L4D2node

CalcDistanceSqrToLineSegment

0x00bc2750 · 109 bytes · __cdecl

_Z28CalcDistanceSqrToLineSegmentRK6VectorS1_S1_Pf

Decompiled

undefined (4 params)

/* CalcDistanceSqrToLineSegment(Vector const&, Vector const&, Vector const&, float*) */

longdouble
CalcDistanceSqrToLineSegment(Vector *param_1,Vector *param_2,Vector *param_3,float *param_4)

{
  float local_14;
  float local_10;
  float local_c;
  
  CalcClosestPointOnLineSegment(param_1,param_2,param_3,(Vector *)&local_14,param_4);
  return (longdouble)
         ((*(float *)(param_1 + 4) - local_10) * (*(float *)(param_1 + 4) - local_10) +
          (*(float *)param_1 - local_14) * (*(float *)param_1 - local_14) +
         (*(float *)(param_1 + 8) - local_c) * (*(float *)(param_1 + 8) - local_c));
}

SourceMod gamedata

paste into addons/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.



        

        

          

Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.

Return-type handling cheatsheet (DHookReturn)