L L4D2node

CEscapeRoute::AddNode

0x008ce180 · 548 bytes · __thiscall

_ZN12CEscapeRoute7AddNodeERK6VectorP13TerrorNavArea

Decompiled

undefined (3 params)

/* CEscapeRoute::AddNode(Vector const&, TerrorNavArea*) */

void __thiscall CEscapeRoute::AddNode(CEscapeRoute *this,Vector *param_1,TerrorNavArea *param_2)

{
  CEscapeRoute *pCVar1;
  float fVar2;
  TerrorNavArea *pTVar3;
  int iVar4;
  float fVar5;
  float fVar6;
  float fVar7;
  float fVar8;
  float fVar9;
  float fVar10;
  float fVar11;
  
  iVar4 = *(int *)(this + 0x1c40);
  if (0x1ff < iVar4) {
    Warning();
    return;
  }
  if (iVar4 < 1) {
    fVar8 = *(float *)param_1;
  }
  else {
    fVar8 = *(float *)param_1;
    pCVar1 = this + (iVar4 * 3 + -3) * 4 + 0x440;
    if (SQRT((fVar8 - *(float *)pCVar1) * (fVar8 - *(float *)pCVar1) +
             (*(float *)(param_1 + 4) - *(float *)(pCVar1 + 4)) *
             (*(float *)(param_1 + 4) - *(float *)(pCVar1 + 4)) +
             (*(float *)(param_1 + 8) - *(float *)(pCVar1 + 8)) *
             (*(float *)(param_1 + 8) - *(float *)(pCVar1 + 8))) < 10.0) {
      return;
    }
  }
  pCVar1 = this + iVar4 * 0xc + 0x440;
  *(float *)pCVar1 = fVar8;
  *(float *)(pCVar1 + 4) = *(float *)(param_1 + 4);
  *(float *)(pCVar1 + 8) = *(float *)(param_1 + 8);
  pTVar3 = *(TerrorNavArea **)(this + 0x3448);
  if ((param_2 == pTVar3) || (pTVar3 == (TerrorNavArea *)0x0)) {
    iVar4 = *(int *)(this + 0x1c40);
    *(undefined4 *)(this + iVar4 * 8 + 0x2448) = *(undefined4 *)(param_2 + 0x154);
    *(undefined4 *)(this + iVar4 * 8 + 0x244c) = *(undefined4 *)(param_2 + 0x158);
  }
  else {
    fVar7 = *(float *)(param_1 + 4) - *(float *)(pTVar3 + 0x30);
    fVar6 = *(float *)(param_1 + 8) - *(float *)(pTVar3 + 0x34);
    fVar5 = *(float *)param_1 - *(float *)(pTVar3 + 0x2c);
    fVar11 = *(float *)(param_1 + 4) - *(float *)(param_2 + 0x30);
    fVar9 = *(float *)param_1 - *(float *)(param_2 + 0x2c);
    fVar10 = *(float *)(param_1 + 8) - *(float *)(param_2 + 0x34);
    fVar8 = *(float *)(pTVar3 + 0x158);
    fVar2 = *(float *)(param_2 + 0x158);
    fVar6 = SQRT(fVar6 * fVar6 + fVar7 * fVar7 + fVar5 * fVar5);
    fVar5 = SQRT(fVar11 * fVar11 + fVar9 * fVar9 + fVar10 * fVar10);
    if ((fVar6 == 0.0) && (fVar5 == 0.0)) {
      iVar4 = *(int *)(this + 0x1c40);
      *(float *)(this + iVar4 * 8 + 0x2448) = *(float *)(param_2 + 0x154);
      *(float *)(this + iVar4 * 8 + 0x244c) = fVar2;
    }
    else {
      iVar4 = *(int *)(this + 0x1c40);
      fVar5 = fVar5 / (fVar6 + fVar5);
      *(float *)(this + iVar4 * 8 + 0x2448) =
           *(float *)(param_2 + 0x154) * (1.0 - fVar5) + *(float *)(pTVar3 + 0x154) * fVar5;
      *(float *)(this + iVar4 * 8 + 0x244c) = fVar2 * (1.0 - fVar5) + fVar5 * fVar8;
    }
  }
  *(int *)(this + 0x1c40) = iVar4 + 1;
  return;
}

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)