L L4D2node

CNavMesh::CommandNavConnect

0x0070c440 · 766 bytes · __thiscall

_ZN8CNavMesh17CommandNavConnectEv

Decompiled

undefined (1 param)

/* CNavMesh::CommandNavConnect() */

void __thiscall CNavMesh::CommandNavConnect(CNavMesh *this)

{
  CNavArea *pCVar1;
  char cVar2;
  CBaseEntity *this_00;
  int iVar3;
  undefined4 uVar4;
  CNavArea *pCVar5;
  int iVar6;
  float local_2c;
  Vector local_28 [24];
  
  cVar2 = TestFilesWritable(this);
  if (cVar2 == '\0') {
    return;
  }
  this_00 = (CBaseEntity *)UTIL_GetListenServerHost();
  if (this_00 == (CBaseEntity *)0x0) {
    return;
  }
  if (*(int *)(this + 0x458) != 0) {
    return;
  }
  FindActiveNavArea(this);
  if (1 < *(int *)(this + 0x4e0)) {
    iVar6 = 1;
    do {
      pCVar1 = (CNavArea *)(*(undefined4 **)(this + 0x4d4))[iVar6];
      pCVar5 = (CNavArea *)**(undefined4 **)(this + 0x4d4);
      iVar3 = CNavArea::ComputeLargestPortal(pCVar1,pCVar5,local_28,&local_2c);
      if ((iVar3 == 4) ||
         (iVar3 = CNavArea::ComputeLargestPortal(pCVar5,pCVar1,local_28,&local_2c), iVar3 == 4))
      goto LAB_0070c4f8;
      iVar6 = iVar6 + 1;
    } while (iVar6 < *(int *)(this + 0x4e0));
    if (1 < *(int *)(this + 0x4e0)) {
      iVar6 = 1;
      do {
        pCVar1 = (CNavArea *)(*(undefined4 **)(this + 0x4d4))[iVar6];
        iVar6 = iVar6 + 1;
        pCVar5 = (CNavArea *)**(undefined4 **)(this + 0x4d4);
        uVar4 = CNavArea::ComputeLargestPortal(pCVar1,pCVar5,local_28,&local_2c);
        CNavArea::ConnectTo(pCVar1,pCVar5,uVar4);
        uVar4 = CNavArea::ComputeLargestPortal(pCVar5,pCVar1,local_28,&local_2c);
        CNavArea::ConnectTo(pCVar5,pCVar1,uVar4);
        CBaseEntity::EmitSound(this_00,"EDIT_CONNECT.Added",0.0,(float *)0x0);
      } while (iVar6 < *(int *)(this + 0x4e0));
    }
    goto LAB_0070c51b;
  }
  pCVar1 = *(CNavArea **)(this + 0x474);
  if (pCVar1 == (CNavArea *)0x0) {
    if (*(CNavLadder **)(this + 0x4bc) == (CNavLadder *)0x0) goto LAB_0070c51b;
    if (*(CNavArea **)(this + 0x470) == (CNavArea *)0x0) {
LAB_0070c6ed:
      Msg(
         "To connect areas, mark an area, highlight a second area, then invoke the connect command. Make sure the cursor is directly north, south, east, or west of the marked area."
         );
      goto LAB_0070c4f8;
    }
    CNavArea::ConnectTo(*(CNavArea **)(this + 0x470),*(CNavLadder **)(this + 0x4bc));
  }
  else {
    if (*(CNavLadder **)(this + 0x4c4) == (CNavLadder *)0x0) {
      if (*(int *)(this + 0x470) == 0) {
        if (*(int *)(this + 0x4e0) != 1) goto LAB_0070c6ed;
        pCVar5 = (CNavArea *)**(undefined4 **)(this + 0x4d4);
        iVar6 = CNavArea::ComputeLargestPortal(pCVar5,pCVar1,local_28,&local_2c);
        if (iVar6 != 4) {
          CNavArea::ConnectTo(pCVar5,*(undefined4 *)(this + 0x474),iVar6);
          goto LAB_0070c644;
        }
      }
      else {
        pCVar5 = (CNavArea *)GetMarkedArea(this);
        iVar6 = CNavArea::ComputeLargestPortal(pCVar5,pCVar1,local_28,&local_2c);
        if (iVar6 != 4) {
          CNavArea::ConnectTo(*(CNavArea **)(this + 0x470),*(undefined4 *)(this + 0x474),iVar6);
          goto LAB_0070c644;
        }
      }
LAB_0070c4f8:
      CBaseEntity::EmitSound(this_00,"EDIT_CONNECT.AllDirections",0.0,(float *)0x0);
      goto LAB_0070c51b;
    }
    CNavLadder::ConnectTo(*(CNavLadder **)(this + 0x4c4),pCVar1);
  }
LAB_0070c644:
  CBaseEntity::EmitSound(this_00,"EDIT_CONNECT.Added",0.0,(float *)0x0);
LAB_0070c51b:
  *(undefined4 *)(this + 0x4c4) = 0;
  *(undefined4 *)(this + 0x470) = 0;
  *(undefined4 *)(this + 0x47c) = 4;
  *(undefined4 *)(this + 0x4e0) = 0;
  *(undefined4 *)(this + 0x474) = 0;
  *(undefined4 *)(this + 0x478) = 0;
  *(undefined4 *)(this + 0x4bc) = 0;
  *(undefined4 *)(this + 0x4c0) = 0;
  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)