L L4D2node

nav_chop_selected

0x00747d60 · 498 bytes · __cdecl

_ZL17nav_chop_selectedRK8CCommand

Decompiled

undefined (1 param)

/* nav_chop_selected(CCommand const&) */

void nav_chop_selected(CCommand *param_1)

{
  CNavArea *pCVar1;
  CNavMesh *pCVar2;
  char cVar3;
  int iVar4;
  undefined4 uVar5;
  int iVar6;
  int iVar7;
  CUtlMemory<CNavArea*,int> *local_40;
  CNavArea *local_3c;
  CNavArea *local_38;
  char local_34;
  int *local_30;
  undefined4 local_2c;
  undefined4 local_28;
  int local_24;
  int *local_20;
  
  cVar3 = UTIL_IsCommandIssuedByServerAdmin();
  if ((cVar3 == '\0') || (cVar3 = (**(code **)(*engine + 8))(engine), cVar3 != '\0')) {
    return;
  }
  (**(code **)(*(int *)TheNavMesh + 0x84))(TheNavMesh);
  CNavMesh::SetMarkedArea(TheNavMesh,(CNavArea *)0x0);
  pCVar2 = TheNavMesh;
  local_30 = (int *)0x0;
  local_2c = 0;
  local_28 = 0;
  local_24 = 0;
  local_20 = (int *)0x0;
  local_34 = '\0';
                    /* try { // try from 00747dec to 00747f44 has its CatchHandler @ 00747f6a */
  cVar3 = CNavMesh::IsSelectedSetEmpty(TheNavMesh);
  iVar7 = local_24;
  if (cVar3 == '\0') {
    if (0 < *(int *)(pCVar2 + 0x4e0)) {
      iVar6 = 0;
      do {
        local_3c = *(CNavArea **)(*(int *)(pCVar2 + 0x4d4) + iVar6 * 4);
        if ((local_34 == '\0') || (iVar7 < 1)) {
LAB_00747e50:
          CUtlVector<CNavArea*,CUtlMemory<CNavArea*,int>>::InsertBefore
                    ((CUtlVector<CNavArea*,CUtlMemory<CNavArea*,int>> *)&local_30,iVar7,&local_3c);
          iVar7 = local_24;
        }
        else if (local_3c != (CNavArea *)*local_30) {
          iVar4 = 0;
          do {
            iVar4 = iVar4 + 1;
            if (iVar4 == iVar7) goto LAB_00747e50;
          } while (local_3c != (CNavArea *)local_30[iVar4]);
          if (iVar4 < 0) goto LAB_00747e50;
        }
        iVar6 = iVar6 + 1;
      } while (iVar6 < *(int *)(pCVar2 + 0x4e0));
    }
LAB_00747e74:
    if (iVar7 < 1) goto LAB_00747e98;
  }
  else {
    pCVar1 = *(CNavArea **)(pCVar2 + 0x474);
    if (pCVar1 == (CNavArea *)0x0) goto LAB_00747e74;
    local_38 = pCVar1;
    if ((local_34 == '\0') || (local_24 < 1)) {
LAB_00747f2c:
      CUtlVector<CNavArea*,CUtlMemory<CNavArea*,int>>::InsertBefore
                ((CUtlVector<CNavArea*,CUtlMemory<CNavArea*,int>> *)&local_30,local_24,&local_38);
      iVar7 = local_24;
      goto LAB_00747e74;
    }
    iVar7 = 0;
    if (pCVar1 != (CNavArea *)*local_30) {
      do {
        iVar7 = iVar7 + 1;
        if (iVar7 == local_24) goto LAB_00747f2c;
      } while (pCVar1 != (CNavArea *)local_30[iVar7]);
      if (iVar7 < 0) goto LAB_00747f2c;
    }
  }
  iVar7 = 0;
  do {
    ReduceToComponentAreas((CNavArea *)local_30[iVar7],true);
    iVar7 = iVar7 + 1;
  } while (iVar7 < local_24);
LAB_00747e98:
  local_40 = (CUtlMemory<CNavArea*,int> *)&local_30;
  uVar5 = CNavMesh::GetSelecteSetSize(TheNavMesh);
  Msg("%d areas chopped into %d\n",local_24,uVar5);
  local_24 = 0;
  CUtlMemory<CNavArea*,int>::Purge(local_40);
  local_20 = local_30;
  CUtlMemory<CNavArea*,int>::Purge(local_40);
  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)