L L4D2node

CNavArea::ComputeHidingSpots

0x006ff4f0 · 915 bytes · __thiscall

_ZN8CNavArea18ComputeHidingSpotsEv

Decompiled

undefined (1 param)

/* CNavArea::ComputeHidingSpots() */

void __thiscall CNavArea::ComputeHidingSpots(CNavArea *this)

{
  size_t __size;
  int *piVar1;
  undefined4 uVar2;
  CNavArea *pCVar3;
  int iVar4;
  char cVar5;
  uint uVar6;
  int iVar7;
  void *pvVar8;
  undefined4 *puVar9;
  int *piVar10;
  int iVar11;
  int iVar12;
  int local_58;
  float local_50;
  float local_4c;
  undefined4 local_38;
  undefined4 local_34;
  undefined4 local_30;
  int local_2c [7];
  
  piVar10 = *(int **)(this + 0xcc);
  if (piVar10 !=
      &CUtlVectorUltraConservative<HidingSpot*,CUtlVectorUltraConservativeAllocator>::StaticData()::
       staticData) {
    if (0 < *piVar10) {
      iVar11 = 0;
      do {
        piVar1 = (int *)piVar10[iVar11 + 1];
        if (piVar1 != (int *)0x0) {
          (**(code **)(*piVar1 + 4))(piVar1);
          piVar10 = *(int **)(this + 0xcc);
        }
        iVar11 = iVar11 + 1;
      } while (iVar11 < *piVar10);
      if (piVar10 ==
          &CUtlVectorUltraConservative<HidingSpot*,CUtlVectorUltraConservativeAllocator>::
           StaticData()::staticData) goto LAB_006ff54f;
    }
    free(piVar10);
    *(undefined4 **)(this + 0xcc) =
         &CUtlVectorUltraConservative<HidingSpot*,CUtlVectorUltraConservativeAllocator>::
          StaticData()::staticData;
  }
LAB_006ff54f:
  if ((*(uint *)(this + 0x54) & 0x202) != 0) {
    return;
  }
  local_2c[0] = 0;
  local_2c[1] = 0;
  local_2c[2] = 0;
  local_2c[3] = 0;
  local_58 = 1;
  do {
    uVar6 = local_58 - 1;
    piVar10 = *(int **)(this + local_58 * 4 + 0x54);
    iVar11 = *piVar10;
    if (iVar11 < 1) {
      local_50 = -999999.9;
      local_4c = 999999.9;
    }
    else {
      uVar2 = *(undefined4 *)(CSWTCH_1823 + local_58 * 4 + 0xc);
      local_50 = -999999.9;
      local_4c = 999999.9;
      iVar12 = 0;
      do {
        while( true ) {
          pCVar3 = (CNavArea *)piVar10[iVar12 * 2 + 1];
          cVar5 = IsConnected(pCVar3,this,uVar2);
          if ((cVar5 != '\0') && (((byte)pCVar3[0x54] & 2) == 0)) break;
LAB_006ff5f0:
          iVar12 = iVar12 + 1;
          if (iVar12 == iVar11) goto LAB_006ff650;
        }
        if ((uVar6 & 0xfffffffd) == 0) {
          if (*(float *)(pCVar3 + 4) <= local_4c) {
            local_4c = *(float *)(pCVar3 + 4);
          }
          if (local_50 <= *(float *)(pCVar3 + 0x10)) {
            local_50 = *(float *)(pCVar3 + 0x10);
          }
          goto LAB_006ff5f0;
        }
        iVar12 = iVar12 + 1;
        if (*(float *)(pCVar3 + 8) <= local_4c) {
          local_4c = *(float *)(pCVar3 + 8);
        }
        if (local_50 <= *(float *)(pCVar3 + 0x14)) {
          local_50 = *(float *)(pCVar3 + 0x14);
        }
      } while (iVar12 != iVar11);
    }
LAB_006ff650:
    if (uVar6 == 2) {
      if (20.0 <= local_4c - *(float *)(this + 4)) {
        local_2c[3] = local_2c[3] + 1;
      }
      if (20.0 <= *(float *)(this + 0x10) - local_50) {
        local_2c[2] = local_2c[2] + 1;
      }
    }
    else {
      if (uVar6 == 3) {
        if (20.0 <= local_4c - *(float *)(this + 8)) {
          local_2c[0] = local_2c[0] + 1;
        }
        if (20.0 <= *(float *)(this + 0x14) - local_50) {
          local_2c[3] = local_2c[3] + 1;
        }
LAB_006ff71e:
        iVar12 = 0;
        iVar11 = local_2c[0];
        while( true ) {
          if ((iVar11 == 2) &&
             ((FindPositionInArea(&local_38,this,iVar12), iVar12 == 0 ||
              (cVar5 = IsHidingSpotCollision(this,(Vector *)&local_38), cVar5 == '\0')))) {
            iVar7 = (**(code **)(*TheNavMesh + 0x1c))(TheNavMesh);
            *(undefined4 *)(iVar7 + 4) = local_38;
            *(undefined4 *)(iVar7 + 8) = local_34;
            *(undefined4 *)(iVar7 + 0xc) = local_30;
            cVar5 = IsHidingSpotInCover((Vector *)&local_38);
            *(byte *)(iVar7 + 0x1c) = *(byte *)(iVar7 + 0x1c) | (-(cVar5 == '\0') & 7U) + 1;
            piVar10 = *(int **)(this + 0xcc);
            iVar4 = *piVar10;
            iVar11 = iVar4 + 1;
            if (piVar10 ==
                &CUtlVectorUltraConservative<HidingSpot*,CUtlVectorUltraConservativeAllocator>::
                 StaticData()::staticData) {
              puVar9 = malloc(iVar11 * 4 + 4);
              *(undefined4 **)(this + 0xcc) = puVar9;
              *puVar9 = 0;
              pvVar8 = *(void **)(this + 0xcc);
            }
            else {
              __size = iVar11 * 4 + 4;
              iVar11 = malloc_usable_size(piVar10);
              if (iVar11 < (int)__size) {
                pvVar8 = realloc(*(void **)(this + 0xcc),__size);
                *(void **)(this + 0xcc) = pvVar8;
              }
              else {
                pvVar8 = *(void **)(this + 0xcc);
              }
            }
            *(int *)((int)pvVar8 + iVar4 * 4 + 4) = iVar7;
            **(int **)(this + 0xcc) = **(int **)(this + 0xcc) + 1;
          }
          iVar12 = iVar12 + 1;
          if (iVar12 == 4) break;
          iVar11 = local_2c[iVar12];
        }
        return;
      }
      if (uVar6 == 1) {
        if (20.0 <= local_4c - *(float *)(this + 8)) {
          local_2c[1] = local_2c[1] + 1;
        }
        if (20.0 <= *(float *)(this + 0x14) - local_50) {
          local_2c[2] = local_2c[2] + 1;
        }
      }
      else {
        if (20.0 <= local_4c - *(float *)(this + 4)) {
          local_2c[0] = local_2c[0] + 1;
        }
        if (20.0 <= *(float *)(this + 0x10) - local_50) {
          local_2c[1] = local_2c[1] + 1;
        }
        if (local_58 == 4) goto LAB_006ff71e;
      }
    }
    local_58 = local_58 + 1;
  } while( true );
}

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)