L L4D2node

CNavMesh::AddNode

0x00727240 · 958 bytes · __thiscall

_ZN8CNavMesh7AddNodeERK6VectorS2_10NavDirTypeP8CNavNodebfff

Decompiled

undefined (9 params)

/* CNavMesh::AddNode(Vector const&, Vector const&, NavDirType, CNavNode*, bool, float, float, float)
    */

CNavNode * __thiscall
CNavMesh::AddNode(CNavMesh *this,Vector *param_1,Vector *param_2,uint param_4,CNavNode *param_5,
                 undefined1 param_6,float param_7,float param_8,float param_9)

{
  char cVar1;
  CNavNode *this_00;
  byte bVar2;
  int iVar3;
  bool bVar4;
  undefined4 uVar5;
  float fVar6;
  float local_dc;
  float local_d8;
  undefined4 local_d4;
  float local_d0;
  float local_cc;
  float local_c8;
  CGameTrace local_c4 [12];
  float local_b8;
  float local_b4;
  float local_b0;
  char local_8e;
  char local_8d;
  CGameTrace local_70 [20];
  float local_5c;
  char local_3a;
  char local_39;
  
  this_00 = (CNavNode *)CNavNode::GetNode(param_1);
  bVar4 = this_00 == (CNavNode *)0x0;
  if (bVar4) {
    this_00 = ::operator_new(0x94);
                    /* try { // try from 007275f6 to 007275fa has its CatchHandler @ 00727617 */
    CNavNode::CNavNode(this_00,param_1,param_2,param_5,(bool)param_6);
    (**(code **)(*(int *)this + 0x78))(this,this_00);
  }
  CNavNode::ConnectTo(param_5,this_00,param_4,param_7,param_8,param_9);
  if (ABS(*(float *)(param_5 + 8) - *(float *)(param_1 + 8)) < 50.0) {
    if ((0.0 < param_7) &&
       (fVar6 = (*(float *)(param_5 + 8) - *(float *)(param_1 + 8)) + param_7, param_7 = 0.0,
       0.0 <= fVar6)) {
      param_7 = fVar6;
    }
    fVar6 = 25.0;
    if (param_4 < 4) {
      uVar5 = (&CSWTCH_1514)[param_4];
      CNavNode::ConnectTo(this_00,param_5,uVar5,param_7,25.0 - param_9,25.0 - param_8,uVar5,
                          0x41c80000);
      bVar2 = (byte)(1 << ((byte)uVar5 & 0x1f));
    }
    else {
      CNavNode::ConnectTo(this_00,param_5,0,param_7,25.0 - param_9,25.0 - param_8);
      bVar2 = 1;
    }
    this_00[0x68] = (CNavNode)((byte)this_00[0x68] | bVar2);
  }
  else {
    fVar6 = 25.0;
  }
  if (bVar4) {
    *(CNavNode **)(this + 0x508) = this_00;
  }
  iVar3 = 0;
  CNavNode::CheckCrouch(this_00);
  do {
    local_dc = *(float *)this_00;
    local_d8 = *(float *)(this_00 + 4);
    local_d4 = *(undefined4 *)(this_00 + 8);
    if (iVar3 == 2) {
      local_d8 = local_d8 + fVar6;
    }
    else if (iVar3 == 3) {
      local_dc = local_dc - fVar6;
    }
    else if (iVar3 == 1) {
      local_dc = local_dc + fVar6;
    }
    else {
      local_d8 = local_d8 - fVar6;
    }
    cVar1 = TraceAdjacentNode(0,(Vector *)this_00,(Vector *)&local_dc,local_c4,4000.0);
    if (((cVar1 != '\0') && (local_8e == '\0')) && (local_8d == '\0')) {
      if (300.0 < *(float *)(this_00 + 8) - local_b0) {
LAB_00727470:
        *(uint *)(this_00 + 0x5c) = *(uint *)(this_00 + 0x5c) | 0x8000;
        return this_00;
      }
      if ((iVar3 - 1U < 2) && (ABS(*(float *)(this_00 + 8) - local_b0) < 18.0)) {
        local_c8 = local_b0;
        local_cc = local_b4;
        local_d0 = local_b8;
        if (iVar3 == 2) {
          local_cc = local_b4 + fVar6;
        }
        else {
          local_d0 = local_b8 + fVar6;
        }
        cVar1 = TraceAdjacentNode(0,(Vector *)&local_b8,(Vector *)&local_d0,local_70,4000.0);
        if (((cVar1 != '\0') && (local_3a == '\0')) &&
           ((local_39 == '\0' && (300.0 < local_b0 - local_5c)))) goto LAB_00727470;
      }
    }
    iVar3 = iVar3 + 1;
    if (iVar3 == 4) {
      return this_00;
    }
  } while( true );
}

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)