L L4D2node

CNavMesh::AddNavArea

0x00742d80 · 502 bytes · __thiscall

_ZN8CNavMesh10AddNavAreaEP8CNavArea

Decompiled

undefined (2 params)

/* CNavMesh::AddNavArea(CNavArea*) */

void __thiscall CNavMesh::AddNavArea(CNavMesh *this,CNavArea *param_1)

{
  CUtlVector<CNavArea*,CUtlMemory<CNavArea*,int>> *this_00;
  CNavArea CVar1;
  CNavArea *pCVar2;
  CNavArea *pCVar3;
  int iVar4;
  int iVar5;
  float fVar6;
  int local_38;
  int local_34;
  int local_30;
  CNavArea *local_20 [4];
  
  if (*(int *)(this + 0x18) == 0) {
    AllocateGrid(this,0.0,0.0,0.0,0.0);
  }
  fVar6 = 1.0 / *(float *)(this + 0x20);
  iVar5 = (int)((*(float *)(param_1 + 4) - *(float *)(this + 0x2c)) * fVar6);
  if (iVar5 < 0) {
    local_38 = 0;
  }
  else {
    local_38 = *(int *)(this + 0x24) + -1;
    if (iVar5 < *(int *)(this + 0x24)) {
      local_38 = iVar5;
    }
  }
  iVar5 = (int)((*(float *)(param_1 + 8) - *(float *)(this + 0x30)) * fVar6);
  if (iVar5 < 0) {
    iVar5 = 0;
  }
  else if (*(int *)(this + 0x28) <= iVar5) {
    iVar5 = *(int *)(this + 0x28) + -1;
  }
  iVar4 = (int)((*(float *)(param_1 + 0x10) - *(float *)(this + 0x2c)) * fVar6);
  if (iVar4 < 0) {
    local_30 = 0;
  }
  else {
    local_30 = *(int *)(this + 0x24) + -1;
    if (iVar4 < *(int *)(this + 0x24)) {
      local_30 = iVar4;
    }
  }
  iVar4 = (int)((*(float *)(param_1 + 0x14) - *(float *)(this + 0x30)) * fVar6);
  pCVar2 = param_1;
  if (iVar4 < 0) {
    local_34 = 0;
  }
  else {
    local_34 = *(int *)(this + 0x28) + -1;
    if (iVar4 < *(int *)(this + 0x28)) {
      local_34 = iVar4;
    }
  }
  for (; iVar4 = local_38, pCVar3 = local_20[0], iVar5 <= local_34; iVar5 = iVar5 + 1) {
    for (; local_20[0] = pCVar2, iVar4 <= local_30; iVar4 = iVar4 + 1) {
      this_00 = (CUtlVector<CNavArea*,CUtlMemory<CNavArea*,int>> *)
                (*(int *)(this + 0xc) + (*(int *)(this + 0x24) * iVar5 + iVar4) * 0x14);
      CUtlVector<CNavArea*,CUtlMemory<CNavArea*,int>>::InsertBefore
                (this_00,*(int *)(this_00 + 0xc),local_20);
      pCVar2 = param_1;
      pCVar3 = local_20[0];
    }
    pCVar2 = local_20[0];
    local_20[0] = pCVar3;
  }
  CVar1 = pCVar2[0x8c];
  if (*(int *)(this + (uint)(byte)CVar1 * 4 + 0x50) == 0) {
    *(CNavArea **)(this + (uint)(byte)CVar1 * 4 + 0x50) = pCVar2;
    *(undefined4 *)(pCVar2 + 0x110) = 0;
    *(undefined4 *)(pCVar2 + 0x10c) = 0;
  }
  else {
    *(undefined4 *)(pCVar2 + 0x10c) = 0;
    *(undefined4 *)(pCVar2 + 0x110) = *(undefined4 *)(this + (uint)(byte)CVar1 * 4 + 0x50);
    *(CNavArea **)(*(int *)(this + (uint)(byte)CVar1 * 4 + 0x50) + 0x10c) = pCVar2;
    *(CNavArea **)(this + (uint)(byte)CVar1 * 4 + 0x50) = pCVar2;
  }
  if (((byte)pCVar2[0x55] & 1) != 0) {
    CUtlVector<CNavArea*,CUtlMemory<CNavArea*,int>>::InsertBefore
              ((CUtlVector<CNavArea*,CUtlMemory<CNavArea*,int>> *)(this + 0x574),
               *(int *)(this + 0x580),&param_1);
  }
  *(int *)(this + 0x34) = *(int *)(this + 0x34) + 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)