L L4D2node

CNavMesh::CommandNavSubdivide

0x00728bc0 · 1140 bytes · __thiscall

_ZN8CNavMesh19CommandNavSubdivideERK8CCommand

Decompiled

undefined (2 params)

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

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

{
  CNavArea *pCVar1;
  CNavMesh *pCVar2;
  int iVar3;
  char cVar4;
  int iVar5;
  longdouble lVar6;
  float fVar7;
  bool bVar8;
  int local_30;
  CNavArea *local_2c;
  CNavArea *local_28;
  CNavArea *local_24;
  CNavArea *local_20 [4];
  
  local_30 = 1;
  if (*(int *)param_1 == 2) {
    local_30 = strtol(*(char **)(param_1 + 0x40c),(char **)0x0,10);
  }
  pCVar2 = TheNavMesh;
  cVar4 = IsSelectedSetEmpty(TheNavMesh);
  if (cVar4 == '\0') {
    iVar5 = 0;
    if (0 < *(int *)(pCVar2 + 0x4e0)) {
      do {
        iVar3 = local_30;
        pCVar1 = *(CNavArea **)(*(int *)(pCVar2 + 0x4d4) + iVar5 * 4);
        if (0 < local_30) {
          fVar7 = (*(float *)(pCVar1 + 0x10) - *(float *)(pCVar1 + 4)) * 0.5;
          if (fVar7 < 25.0) {
            fVar7 = (*(float *)(pCVar1 + 0x14) - *(float *)(pCVar1 + 8)) * 0.5;
            if (25.0 <= fVar7) {
              lVar6 = (longdouble)SnapToGrid(TheNavMesh,fVar7 + *(float *)(pCVar1 + 8),false);
              cVar4 = CNavArea::SplitEdit(pCVar1,true,(float)lVar6,&local_24,local_20);
              if (cVar4 != '\0') {
                Subdivider::SubdivideX((Subdivider *)&local_30,local_24,false,true,iVar3 + -1);
                bVar8 = false;
LAB_00728eb3:
                Subdivider::SubdivideX((Subdivider *)&local_30,local_20[0],bVar8,true,iVar3 + -1);
              }
            }
          }
          else {
            lVar6 = (longdouble)SnapToGrid(TheNavMesh,fVar7 + *(float *)(pCVar1 + 4),false);
            cVar4 = CNavArea::SplitEdit(pCVar1,false,(float)lVar6,&local_2c,&local_28);
            pCVar1 = local_2c;
            if (cVar4 != '\0') {
              fVar7 = (*(float *)(local_2c + 0x14) - *(float *)(local_2c + 8)) * 0.5;
              if (25.0 <= fVar7) {
                lVar6 = (longdouble)SnapToGrid(TheNavMesh,fVar7 + *(float *)(local_2c + 8),false);
                cVar4 = CNavArea::SplitEdit(pCVar1,true,(float)lVar6,&local_24,local_20);
                if (cVar4 != '\0') {
                  Subdivider::SubdivideX((Subdivider *)&local_30,local_24,true,true,iVar3 + -1);
                  Subdivider::SubdivideX((Subdivider *)&local_30,local_20[0],true,true,iVar3 + -1);
                }
              }
              else {
                Subdivider::SubdivideX((Subdivider *)&local_30,local_2c,true,false,iVar3 + -1);
              }
              pCVar1 = local_28;
              fVar7 = (*(float *)(local_28 + 0x14) - *(float *)(local_28 + 8)) * 0.5;
              if (25.0 <= fVar7) {
                lVar6 = (longdouble)SnapToGrid(TheNavMesh,fVar7 + *(float *)(local_28 + 8),false);
                cVar4 = CNavArea::SplitEdit(pCVar1,true,(float)lVar6,&local_24,local_20);
                if (cVar4 != '\0') {
                  Subdivider::SubdivideX((Subdivider *)&local_30,local_24,true,true,iVar3 + -1);
                  bVar8 = true;
                  goto LAB_00728eb3;
                }
              }
              else {
                Subdivider::SubdivideX((Subdivider *)&local_30,local_28,true,false,iVar3 + -1);
              }
            }
          }
        }
        iVar5 = iVar5 + 1;
      } while (iVar5 < *(int *)(pCVar2 + 0x4e0));
    }
  }
  else if (*(CNavArea **)(pCVar2 + 0x474) != (CNavArea *)0x0) {
    Subdivider::SubdivideX
              ((Subdivider *)&local_30,*(CNavArea **)(pCVar2 + 0x474),true,true,local_30);
    return;
  }
  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)