L L4D2node

ZombieManager::ChooseAdjacentMobSpawnArea

0x00a60620 · 415 bytes · __thiscall

_ZN13ZombieManager26ChooseAdjacentMobSpawnAreaEP13TerrorNavArea

Decompiled

undefined (2 params)

/* ZombieManager::ChooseAdjacentMobSpawnArea(TerrorNavArea*) */

TerrorNavArea * __thiscall
ZombieManager::ChooseAdjacentMobSpawnArea(ZombieManager *this,TerrorNavArea *param_1)

{
  TerrorNavArea *pTVar1;
  int *piVar2;
  int iVar3;
  int iVar4;
  float fVar5;
  float fVar6;
  TerrorNavArea *local_20 [4];
  
  if (*(int *)(ZombieSpawnMobsFromSelectedSet._28_4_ + 0x30) == 0) {
    piVar2 = (int *)CollectSpawnAreas(this,*(undefined4 *)(this + 0x214),0);
  }
  else {
    piVar2 = (int *)CNavMesh::GetSelectedSet(TheNavMesh);
  }
  local_20[0] = (TerrorNavArea *)0x0;
  if (0 < piVar2[3]) {
    fVar6 = 3.4028235e+38;
    iVar4 = 0;
    do {
      pTVar1 = *(TerrorNavArea **)(*piVar2 + iVar4 * 4);
      if (pTVar1 != param_1) {
        if (*(int *)(this + 0x1dc) < 1) {
LAB_00a606a0:
          fVar5 = (*(float *)(pTVar1 + 0x30) - *(float *)(param_1 + 0x30)) *
                  (*(float *)(pTVar1 + 0x30) - *(float *)(param_1 + 0x30)) +
                  (*(float *)(pTVar1 + 0x2c) - *(float *)(param_1 + 0x2c)) *
                  (*(float *)(pTVar1 + 0x2c) - *(float *)(param_1 + 0x2c)) +
                  (*(float *)(pTVar1 + 0x34) - *(float *)(param_1 + 0x34)) *
                  (*(float *)(pTVar1 + 0x34) - *(float *)(param_1 + 0x34));
          if (fVar5 < fVar6) {
            fVar6 = fVar5;
            local_20[0] = pTVar1;
          }
        }
        else if (pTVar1 != (TerrorNavArea *)**(int **)(this + 0x1d0)) {
          iVar3 = 0;
          do {
            iVar3 = iVar3 + 1;
            if (iVar3 == *(int *)(this + 0x1dc)) goto LAB_00a606a0;
          } while (pTVar1 != (TerrorNavArea *)(*(int **)(this + 0x1d0))[iVar3]);
          if (iVar3 < 0) goto LAB_00a606a0;
        }
      }
      iVar4 = iVar4 + 1;
    } while (iVar4 != piVar2[3]);
    if (local_20[0] != (TerrorNavArea *)0x0) {
      iVar4 = *(int *)(this + 0x1dc);
      if (9 < iVar4) {
        _V_memmove(*(void **)(this + 0x1d0),(void *)((int)*(void **)(this + 0x1d0) + 4),
                   iVar4 * 4 + -4);
        iVar4 = *(int *)(this + 0x1dc) + -1;
        *(int *)(this + 0x1dc) = iVar4;
      }
      CUtlVector<TerrorNavArea*,CUtlMemory<TerrorNavArea*,int>>::InsertBefore
                ((CUtlVector<TerrorNavArea*,CUtlMemory<TerrorNavArea*,int>> *)(this + 0x1d0),iVar4,
                 local_20);
      if (1 < *(int *)(ZombieDebugMobSpawn._28_4_ + 0x30)) {
        CNavMesh::AddToSelectedSet(TheNavMesh,(CNavArea *)local_20[0]);
      }
      return local_20[0];
    }
  }
  return (TerrorNavArea *)(CNavArea *)0x0;
}

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)