L L4D2node

CNavArea::GetDistanceSquaredToPoint

0x006fca60 · 380 bytes · __thiscall

_ZNK8CNavArea25GetDistanceSquaredToPointERK6Vector

Decompiled

undefined (2 params)

/* CNavArea::GetDistanceSquaredToPoint(Vector const&) const */

longdouble __thiscall CNavArea::GetDistanceSquaredToPoint(CNavArea *this,Vector *param_1)

{
  float fVar1;
  float fVar2;
  float fVar3;
  longdouble lVar4;
  float fVar5;
  float fVar6;
  
  fVar1 = *(float *)(this + 4);
  fVar2 = *(float *)param_1;
  if (fVar1 <= fVar2) {
    fVar1 = *(float *)(this + 0x10);
    if (fVar1 < fVar2) {
      fVar5 = *(float *)(param_1 + 4);
      fVar3 = *(float *)(this + 8);
      if (fVar5 < fVar3) {
        fVar6 = *(float *)(this + 0x24);
      }
      else {
        fVar3 = *(float *)(this + 0x14);
        if (fVar5 <= fVar3) {
          fVar5 = (fVar2 - fVar1) * (fVar2 - fVar1);
          goto LAB_006fcaa4;
        }
        fVar6 = *(float *)(this + 0x18);
      }
      return (longdouble)
             ((fVar3 - fVar5) * (fVar3 - fVar5) + (fVar1 - fVar2) * (fVar1 - fVar2) +
             (fVar6 - *(float *)(param_1 + 8)) * (fVar6 - *(float *)(param_1 + 8)));
    }
    fVar5 = *(float *)(param_1 + 4);
    if (fVar5 < *(float *)(this + 8)) {
      fVar5 = *(float *)(this + 8) - fVar5;
      fVar5 = fVar5 * fVar5;
      goto LAB_006fcaa4;
    }
    if (*(float *)(this + 0x14) < fVar5) {
      fVar5 = fVar5 - *(float *)(this + 0x14);
      fVar5 = fVar5 * fVar5;
      goto LAB_006fcaa4;
    }
    lVar4 = (longdouble)GetZ(this,fVar2,fVar5);
    fVar5 = (float)lVar4 - *(float *)(param_1 + 8);
  }
  else {
    fVar3 = *(float *)(param_1 + 4);
    fVar6 = *(float *)(this + 8);
    if (fVar3 < fVar6) {
      fVar5 = *(float *)(this + 0xc);
LAB_006fcb80:
      return (longdouble)
             ((fVar5 - *(float *)(param_1 + 8)) * (fVar5 - *(float *)(param_1 + 8)) +
              (fVar1 - fVar2) * (fVar1 - fVar2) + (fVar6 - fVar3) * (fVar6 - fVar3));
    }
    fVar6 = *(float *)(this + 0x14);
    fVar5 = fVar1 - fVar2;
    if (fVar6 < fVar3) {
      fVar5 = *(float *)(this + 0x28);
      goto LAB_006fcb80;
    }
  }
  fVar5 = fVar5 * fVar5;
LAB_006fcaa4:
  return (longdouble)fVar5;
}

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)