L L4D2node

CNavMesh::CommandNavMergeMesh

0x00737970 · 1288 bytes · __thiscall

_ZN8CNavMesh19CommandNavMergeMeshERK8CCommand

Decompiled

undefined (2 params)

/* CNavMesh::CommandNavMergeMesh(CCommand const&) */

void __thiscall CNavMesh::CommandNavMergeMesh(CNavMesh *this,CCommand *param_1)

{
  char cVar1;
  IBaseFileSystem *pIVar2;
  KeyValues *pKVar3;
  undefined4 uVar4;
  int iVar5;
  int in_GS_OFFSET;
  char *this_00;
  uint uVar6;
  KeyValues *pKVar7;
  char *pcVar8;
  CNavArea *local_1e0;
  int local_1dc [2];
  char *local_1d4;
  CNavArea *local_1d0;
  KeyValues local_1cc [12];
  KeyValues local_1c0 [12];
  KeyValues local_1b4 [12];
  KeyValues local_1a8 [12];
  undefined4 local_19c;
  undefined4 local_198;
  undefined4 local_194;
  int local_190;
  undefined4 local_18c;
  code *local_188;
  undefined4 local_184;
  undefined4 local_180;
  undefined4 local_17c;
  undefined4 local_178;
  undefined4 local_174;
  undefined4 local_170;
  undefined4 local_16c;
  undefined4 local_168;
  char local_164 [64];
  char local_124 [260];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  if (*(int *)param_1 == 2) {
    V_FileBase(*(char **)(param_1 + 0x40c),local_164,0x40);
    uVar6 = 0x104;
    V_snprintf(local_124,0x104,"maps/%s.txt",local_164);
    this_00 = KeyValues::operator_new((KeyValues *)0x2c,uVar6);
                    /* try { // try from 00737a31 to 00737a35 has its CatchHandler @ 00737e94 */
    KeyValues::KeyValues((KeyValues *)this_00,"Nav Selected Set",(IKeyValuesSystem *)0x0,false);
    pIVar2 = (IBaseFileSystem *)0x0;
    if (filesystem != 0) {
      pIVar2 = (IBaseFileSystem *)(filesystem + 4);
    }
    cVar1 = KeyValues::LoadFromFile((KeyValues *)this_00,pIVar2,local_124,(char *)0x0);
    if (cVar1 == '\0') {
      Msg("Unable to load %s.\n",local_124);
    }
    else {
      local_184 = 0;
      local_180 = 0;
      local_17c = 0;
      local_178 = 0xffffffff;
      local_174 = 0;
      local_170 = 0xffffffff;
      local_16c = 0xffffffff;
      local_168 = 0;
      local_188 = CaselessStringLessThan;
      local_19c = 0;
      local_198 = 0;
      local_194 = 0;
      local_190 = 0;
      local_18c = 0;
                    /* try { // try from 00737b2f to 00737e23 has its CatchHandler @ 00737eac */
      pKVar3 = (KeyValues *)KeyValues::GetFirstSubKey((KeyValues *)this_00);
      if (pKVar3 != (KeyValues *)0x0) {
        do {
          ReadCorner(local_1cc,(char *)pKVar3);
          ReadCorner(local_1c0,(char *)pKVar3);
          ReadCorner(local_1b4,(char *)pKVar3);
          pcVar8 = "SouthEast";
          pKVar7 = pKVar3;
          ReadCorner(local_1a8,(char *)pKVar3);
          local_1e0 = (CNavArea *)(**(code **)(*(int *)TheNavMesh + 0x14))(TheNavMesh,pKVar7,pcVar8)
          ;
          if (local_1e0 == (CNavArea *)0x0) {
            Warning("nav_merge_mesh: Out of memory\n");
            this_00 = (char *)&local_184;
            local_190 = 0;
            CUtlMemory<CNavArea*,int>::Purge((CUtlMemory<CNavArea*,int> *)&local_19c);
            local_18c = local_19c;
            CUtlMemory<CNavArea*,int>::Purge((CUtlMemory<CNavArea*,int> *)&local_19c);
            CUtlDict<CNavArea*,int>::RemoveAll((CUtlDict<CNavArea*,int> *)&local_188);
            CUtlRBTree<CUtlMap<char_const*,CNavArea*,int>::Node_t,int,CUtlMap<char_const*,CNavArea*,int>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<char_const*,CNavArea*,int>::Node_t,int>,int>>
            ::RemoveAll((CUtlRBTree<CUtlMap<char_const*,CNavArea*,int>::Node_t,int,CUtlMap<char_const*,CNavArea*,int>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<char_const*,CNavArea*,int>::Node_t,int>,int>>
                         *)&local_188);
            local_170 = 0xffffffff;
            CUtlMemory<UtlRBTreeNode_t<CUtlMap<char_const*,CNavArea*,int>::Node_t,int>,int>::Purge
                      ((CUtlMemory<UtlRBTreeNode_t<CUtlMap<char_const*,CNavArea*,int>::Node_t,int>,int>
                        *)this_00);
            local_16c = 0xffffffff;
            CUtlMemory<UtlRBTreeNode_t<CUtlMap<char_const*,CNavArea*,int>::Node_t,int>,int>::Purge
                      ((CUtlMemory<UtlRBTreeNode_t<CUtlMap<char_const*,CNavArea*,int>::Node_t,int>,int>
                        *)this_00);
            goto LAB_007379a5;
          }
          CNavArea::Build(local_1e0,(Vector *)local_1cc,(Vector *)local_1c0,(Vector *)local_1a8,
                          (Vector *)local_1b4);
          uVar4 = CUtlVector<CNavArea*,CUtlMemory<CNavArea*,int>>::InsertBefore
                            ((CUtlVector<CNavArea*,CUtlMemory<CNavArea*,int>> *)&TheNavAreas,
                             DAT_00fe6000,&local_1e0);
          *(undefined4 *)(local_1e0 + 0x90) = uVar4;
          AddNavArea(TheNavMesh,local_1e0);
          CUtlVector<CNavArea*,CUtlMemory<CNavArea*,int>>::InsertBefore
                    ((CUtlVector<CNavArea*,CUtlMemory<CNavArea*,int>> *)&local_19c,local_190,
                     &local_1e0);
          iVar5 = KeyValues::GetName(pKVar3);
          if (iVar5 == 0) {
LAB_00737cbe:
            pcVar8 = (char *)KeyValues::GetName(pKVar3);
            local_1d4 = strdup(pcVar8);
            local_1d0 = local_1e0;
            CUtlRBTree<CUtlMap<char_const*,CNavArea*,int>::Node_t,int,CUtlMap<char_const*,CNavArea*,int>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<char_const*,CNavArea*,int>::Node_t,int>,int>>
            ::Insert((CUtlRBTree<CUtlMap<char_const*,CNavArea*,int>::Node_t,int,CUtlMap<char_const*,CNavArea*,int>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<char_const*,CNavArea*,int>::Node_t,int>,int>>
                      *)&local_188,(Node_t *)&local_1d4);
          }
          else {
            local_1dc[0] = iVar5;
            iVar5 = CUtlRBTree<CUtlMap<char_const*,CNavArea*,int>::Node_t,int,CUtlMap<char_const*,CNavArea*,int>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<char_const*,CNavArea*,int>::Node_t,int>,int>>
                    ::Find((CUtlRBTree<CUtlMap<char_const*,CNavArea*,int>::Node_t,int,CUtlMap<char_const*,CNavArea*,int>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<char_const*,CNavArea*,int>::Node_t,int>,int>>
                            *)&local_188,(Node_t *)local_1dc);
            if (iVar5 == -1) goto LAB_00737cbe;
          }
          (**(code **)(*(int *)local_1e0 + 0x40))(local_1e0,pKVar3);
          pKVar3 = (KeyValues *)KeyValues::GetNextKey(pKVar3);
        } while (pKVar3 != (KeyValues *)0x0);
      }
      for (pKVar3 = (KeyValues *)KeyValues::GetFirstSubKey((KeyValues *)this_00);
          pKVar3 != (KeyValues *)0x0; pKVar3 = (KeyValues *)KeyValues::GetNextKey(pKVar3)) {
        ReconnectMergedArea((CUtlDict<CNavArea*,int> *)&local_188,pKVar3,0,"North");
        ReconnectMergedArea((CUtlDict<CNavArea*,int> *)&local_188,pKVar3,2,"South");
        ReconnectMergedArea((CUtlDict<CNavArea*,int> *)&local_188,pKVar3,1,"East");
        ReconnectMergedArea((CUtlDict<CNavArea*,int> *)&local_188,pKVar3,3,"West");
      }
      StitchAreaSet(this,(CUtlVector *)&local_19c);
      local_190 = 0;
      CUtlMemory<CNavArea*,int>::Purge((CUtlMemory<CNavArea*,int> *)&local_19c);
      local_18c = local_19c;
      CUtlMemory<CNavArea*,int>::Purge((CUtlMemory<CNavArea*,int> *)&local_19c);
      CUtlDict<CNavArea*,int>::RemoveAll((CUtlDict<CNavArea*,int> *)&local_188);
      CUtlRBTree<CUtlMap<char_const*,CNavArea*,int>::Node_t,int,CUtlMap<char_const*,CNavArea*,int>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<char_const*,CNavArea*,int>::Node_t,int>,int>>
      ::RemoveAll((CUtlRBTree<CUtlMap<char_const*,CNavArea*,int>::Node_t,int,CUtlMap<char_const*,CNavArea*,int>::CKeyLess,CUtlMemory<UtlRBTreeNode_t<CUtlMap<char_const*,CNavArea*,int>::Node_t,int>,int>>
                   *)&local_188);
      local_170 = 0xffffffff;
      CUtlMemory<UtlRBTreeNode_t<CUtlMap<char_const*,CNavArea*,int>::Node_t,int>,int>::Purge
                ((CUtlMemory<UtlRBTreeNode_t<CUtlMap<char_const*,CNavArea*,int>::Node_t,int>,int> *)
                 &local_184);
      local_16c = 0xffffffff;
      CUtlMemory<UtlRBTreeNode_t<CUtlMap<char_const*,CNavArea*,int>::Node_t,int>,int>::Purge
                ((CUtlMemory<UtlRBTreeNode_t<CUtlMap<char_const*,CNavArea*,int>::Node_t,int>,int> *)
                 &local_184);
    }
    KeyValues::deleteThis();
  }
  else {
    this_00 = "Usage: nav_merge_mesh filename\n";
    Msg("Usage: nav_merge_mesh filename\n");
  }
LAB_007379a5:
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail(this_00);
}

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)