L L4D2node

TerrorNavMesh::TerrorEditUseFog

0x0097e8d0 · 807 bytes · __thiscall

_ZN13TerrorNavMesh16TerrorEditUseFogERK8CCommand

Decompiled

undefined (2 params)

/* TerrorNavMesh::TerrorEditUseFog(CCommand const&) */

void __thiscall TerrorNavMesh::TerrorEditUseFog(TerrorNavMesh *this,CCommand *param_1)

{
  char **ppcVar1;
  size_t sVar2;
  char cVar3;
  char *pcVar4;
  int iVar5;
  size_t __size;
  char **ppcVar6;
  size_t sVar7;
  int iVar8;
  int iVar9;
  undefined4 uVar10;
  int local_88;
  void *local_70;
  int local_6c;
  int local_68;
  size_t local_64;
  void *local_60;
  
  cVar3 = UTIL_IsCommandIssuedByServerAdmin();
  if (cVar3 != '\0') {
    if (*(int *)param_1 == 1) {
      local_70 = (void *)0x0;
      local_6c = 0;
      local_68 = 0;
      local_64 = 0;
      local_60 = (void *)0x0;
      if (0 < *(int *)(this + 0x658)) {
        iVar5 = 0;
        do {
          sVar2 = local_64;
          sVar7 = local_64 + 1;
          uVar10 = *(undefined4 *)(*(int *)(this + 0x64c) + iVar5 * 4);
          if ((local_6c < (int)sVar7) && (-1 < local_68)) {
            if (local_68 == 0) {
              if (local_6c == 0) {
                if ((int)sVar7 < 9) {
                  local_6c = 8;
                  goto LAB_0097ea1f;
                }
                local_6c = 8;
              }
              do {
                iVar8 = local_6c;
                local_6c = iVar8 * 2;
              } while (local_6c < (int)sVar7);
              __size = iVar8 << 3;
            }
            else {
              for (local_6c = ((int)local_64 / local_68 + 1) * local_68; local_6c < (int)sVar7;
                  local_6c = (int)(local_6c + sVar7) / 2) {
              }
LAB_0097ea1f:
              __size = local_6c << 2;
            }
            if (local_70 == (void *)0x0) {
              local_70 = malloc(__size);
            }
            else {
              local_70 = realloc(local_70,__size);
              sVar7 = local_64 + 1;
            }
          }
          iVar9 = sVar2 * 4;
          iVar8 = (sVar7 - sVar2) + -1;
          local_64 = sVar7;
          local_60 = local_70;
          if (0 < iVar8) {
                    /* try { // try from 0097ea5d to 0097eb6b has its CatchHandler @ 0097ec25 */
            _V_memmove((void *)((int)local_70 + iVar9 + 4),(void *)((int)local_70 + iVar9),iVar8 * 4
                      );
          }
          if ((undefined4 *)(iVar9 + (int)local_70) != (undefined4 *)0x0) {
            *(undefined4 *)(iVar9 + (int)local_70) = uVar10;
          }
          iVar5 = iVar5 + 1;
        } while (iVar5 < *(int *)(this + 0x658));
        if (1 < (int)local_64) {
          if (local_70 == (void *)0x0) {
            local_88 = local_64 - 1;
            do {
              if (0 < local_88) {
                iVar8 = 0;
                iVar5 = 1;
                do {
                  while( true ) {
                    ppcVar1 = (char **)((int)local_70 + iVar5 * 4);
                    ppcVar6 = (char **)((int)local_70 + iVar8);
                    iVar9 = StringSort(ppcVar6,ppcVar1);
                    if (-1 < iVar9) break;
                    iVar5 = iVar5 + 1;
                    pcVar4 = *ppcVar6;
                    iVar8 = iVar8 + 4;
                    *ppcVar6 = *ppcVar1;
                    *ppcVar1 = pcVar4;
                    if (local_88 + 1 == iVar5) goto LAB_0097ebfc;
                  }
                  iVar5 = iVar5 + 1;
                  iVar8 = iVar8 + 4;
                } while (local_88 + 1 != iVar5);
              }
LAB_0097ebfc:
              local_88 = local_88 + -1;
            } while (local_88 != -1);
          }
          else {
            qsort(local_70,local_64,4,StringSort);
          }
        }
      }
      iVar5 = 0;
      while (iVar5 < (int)local_64) {
        iVar8 = NameToFogPlace(this,*(char **)((int)local_70 + iVar5 * 4));
        uVar10 = *(undefined4 *)((int)local_70 + iVar5 * 4);
        if (iVar8 == *(int *)(this + 0x660)) {
          Msg("--> %-26s",uVar10);
        }
        else {
          Msg("%-30s",uVar10);
        }
        iVar5 = iVar5 + 1;
        if (iVar5 == (iVar5 / 3) * 3) {
          Msg(&DAT_00cff71e,uVar10);
        }
      }
      Msg(&DAT_00cff71e);
      local_64 = 0;
      CUtlMemory<char_const*,int>::Purge((CUtlMemory<char_const*,int> *)&local_70);
      local_60 = local_70;
      CUtlMemory<char_const*,int>::Purge((CUtlMemory<char_const*,int> *)&local_70);
      return;
    }
    fogparams_t::fogparams_t((fogparams_t *)&local_70);
    pcVar4 = "";
    if (1 < *(int *)param_1) {
      pcVar4 = *(char **)(param_1 + 0x40c);
    }
    iVar5 = NameToFogPlace(this,pcVar4);
    *(int *)(this + 0x660) = iVar5;
    if (iVar5 == 0) {
      Msg("Fog unselected\n");
      return;
    }
    Msg("No nav fog.\n");
  }
  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)