L L4D2node

ZombieManager::AccumulateSpawnAreaCollection

0x00a5cd00 · 3000 bytes · __thiscall

_ZNK13ZombieManager29AccumulateSpawnAreaCollectionERK10CUtlVectorIP8CNavArea10CUtlMemoryIS2_iEENS_15MobLocationTypeE15ZombieClassTypefPS5_bb

Decompiled

undefined (8 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* ZombieManager::AccumulateSpawnAreaCollection(CUtlVector<CNavArea*, CUtlMemory<CNavArea*, int> >
   const&, ZombieManager::MobLocationType, ZombieClassType, float, CUtlVector<CNavArea*,
   CUtlMemory<CNavArea*, int> >*, bool, bool) const */

void __thiscall
ZombieManager::AccumulateSpawnAreaCollection
          (ZombieManager *this,int *param_1,int param_3,uint param_4,float param_5,
          CUtlVector<CNavArea*,CUtlMemory<CNavArea*,int>> *param_6,char param_7,char param_8)

{
  uint *puVar1;
  TerrorNavArea *this_00;
  uint uVar2;
  CNavArea *pCVar3;
  char cVar4;
  char cVar5;
  int iVar6;
  uint uVar7;
  int iVar8;
  CBaseEntity *pCVar9;
  char *pcVar10;
  int iVar11;
  bool bVar12;
  float fVar13;
  Vector *this_01;
  int local_90;
  float local_88;
  float local_84;
  CUtlMemory<CTerrorPlayer*,int> *local_74;
  float local_68;
  float local_64;
  int local_60;
  undefined4 local_5c;
  undefined4 local_58;
  TerrorNavArea *local_54;
  undefined4 local_50;
  undefined4 local_48;
  undefined4 local_44;
  int local_40;
  TerrorNavArea *local_3c;
  undefined4 local_38;
  Vector *local_34;
  int local_30 [8];
  
  local_5c = 0;
  local_58 = 0;
  if (_towlower == 0) {
    local_40 = 0;
  }
  else {
    (**(code **)(_towlower + 0x50))
              (_towlower,&local_5c,0,0,0,0,"/data/src/game/server/terror/zombiemanager.cpp",0xd5b,
               &AccumulateSpawnAreaCollection(CUtlVector<CNavArea*,CUtlMemory<CNavArea*,int>>const&,ZombieManager::MobLocationType,ZombieClassType,float,CUtlVector<CNavArea*,CUtlMemory<CNavArea*,int>>*,bool,bool)
                ::tm_fmt,"(%s)%s","ZOMBIE","ZombieManager::AccumulateSpawnAreaCollection");
    local_40 = _towlower;
  }
  iVar6 = _DAT_0105db00;
  local_48 = local_5c;
  local_44 = local_58;
                    /* try { // try from 00a5d136 to 00a5d196 has its CatchHandler @ 00a5d72a */
  if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
     (iVar11 = ThreadGetCurrentId(), iVar6 == iVar11)) {
    if (*(char **)_DAT_0105d15c != "ZombieManager::AccumulateSpawnAreaCollection") {
      _DAT_0105d15c =
           (Vector *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xd29848,(char *)0x0,0xc0db47);
    }
    puVar1 = (uint *)(_DAT_0105d1e8 + 4 + *(int *)(_DAT_0105d15c + 0x70) * 8);
    *puVar1 = *puVar1 | 4;
    CVProfNode::EnterScope();
    DAT_0105d158 = '\0';
  }
                    /* try { // try from 00a5cdc4 to 00a5cdc8 has its CatchHandler @ 00a5d72e */
  cVar4 = CTerrorGameRules::IsVersusMode();
                    /* try { // try from 00a5d2e1 to 00a5d2e5 has its CatchHandler @ 00a5d72e */
  if ((cVar4 == '\0') || (cVar4 = CDirector::IsFinale(TheDirector), cVar4 == '\0')) {
    local_64 = -NAN;
  }
  else {
    local_64 = -NAN;
    pcVar10 = "";
    if (*(char **)(gpGlobals + 0x3c) != (char *)0x0) {
      pcVar10 = *(char **)(gpGlobals + 0x3c);
    }
    if (((*pcVar10 == 'c') && (pcVar10[1] == '4')) && (pcVar10[2] == 'm')) {
      local_64 = (float)0x76be7;
      if (pcVar10[3] != '5') {
        local_64 = (float)-1;
      }
    }
  }
  local_30[0] = 0;
  local_30[1] = 0;
  local_30[2] = 0;
  local_30[3] = 0;
  local_30[4] = 0;
  if (param_3 == 9) {
                    /* try { // try from 00a5d35e to 00a5d3af has its CatchHandler @ 00a5d732 */
    iVar6 = CDirector::GetScriptValue(TheDirector,"ShouldConstrainLargeVolumeSpawn",1);
    if (iVar6 == 0) {
      local_88 = 3.4028235e+38;
      local_84 = 3.4028235e+38;
    }
    else {
      local_84 = *(float *)(z_large_volume_mob_too_far_xy._28_4_ + 0x2c) *
                 *(float *)(z_large_volume_mob_too_far_xy._28_4_ + 0x2c);
      local_88 = *(float *)(z_large_volume_mob_too_far_z._28_4_ + 0x2c);
    }
    ForEachSurvivor<SurvivorCollector>((SurvivorCollector *)local_30);
  }
  else {
    local_88 = 0.0;
    local_84 = 0.0;
  }
  local_74 = (CUtlMemory<CTerrorPlayer*,int> *)local_30;
                    /* try { // try from 00a5ce29 to 00a5d047 has its CatchHandler @ 00a5d732 */
  cVar4 = CDirectorChallengeMode::TankRun(*(CDirectorChallengeMode **)(TheDirector + 0x648));
  if (((((param_3 - 3U < 2) || (param_3 == 10)) || (cVar4 != '\0')) ||
      ((cVar5 = CDirector::IsFinale(TheDirector), cVar5 != '\0' ||
       (**(char **)(TheDirector + 0x640) != '\0')))) ||
     (*(char *)(*(int *)(TheDirector + 0x638) + 0x111) != '\0')) {
    iVar6 = CDirector::GetScriptValue(TheDirector,"ShouldIgnoreClearStateForSpawn",0);
    bVar12 = iVar6 != 0;
  }
  else {
    bVar12 = true;
  }
  if (0 < param_1[3]) {
    iVar6 = 0;
    do {
      this_00 = *(TerrorNavArea **)(*param_1 + iVar6 * 4);
      cVar5 = TerrorNavArea::IsTerrorMarked(this_00);
      if ((((cVar5 != '\0') ||
           (TerrorNavArea::TerrorMark(this_00), (*(uint *)(this_00 + 0x54) & 0x30003) != 0)) ||
          (((uVar7 = *(uint *)(this_00 + 300), (uVar7 & 0x80) != 0 && (cVar4 == '\0')) ||
           ((uVar7 & 0x18000) != 0)))) ||
         ((((uVar2 = *(uint *)(this + 0x6c), uVar2 != 0 && (uVar2 != 0xff)) &&
           ((uVar2 >> ((uVar7 & 0x7000000) >> 0x18) & 1) == 0)) ||
          ((local_64 != -NAN && ((float)*(int *)(this_00 + 0x8c) == local_64))))))
      goto LAB_00a5cec0;
      if (((uVar7 & 0x2000) == 0) || (cVar4 != '\0')) {
LAB_00a5cf62:
        if (((((uVar7 & 0x800) == 0) ||
             (*(float *)(TheNavMesh + 0x5f8) < *(float *)(this_00 + 0x154) ||
              *(float *)(TheNavMesh + 0x5f8) == *(float *)(this_00 + 0x154))) || (cVar4 != '\0')) &&
           (this_01 = (Vector *)this_00, cVar5 = CNavArea::IsBlocked((CNavArea *)this_00,3,false),
           cVar5 == '\0')) {
          if (param_8 != '\0') {
            this_01 = (Vector *)(this_00 + 0x2c);
                    /* try { // try from 00a5d564 to 00a5d643 has its CatchHandler @ 00a5d732 */
            cVar5 = CZombieBorder::IsBehindZombieBorder(this_01);
            if (cVar5 != '\0') goto LAB_00a5cec0;
          }
          if ((param_3 != 2) && (cVar5 = CTerrorGameRules::IsScavengeMode(), cVar5 == '\0')) {
            this_01 = *(Vector **)(TheDirector + 0x648);
            cVar5 = CDirectorChallengeMode::EnforceFinaleSpawnRules
                              ((CDirectorChallengeMode *)this_01);
            if (cVar5 != '\0') {
              if (**(char **)(TheDirector + 0x640) == '\0') {
                this_01 = (Vector *)TheDirector;
                    /* try { // try from 00a5d6a2 to 00a5d6a6 has its CatchHandler @ 00a5d732 */
                cVar5 = CDirector::IsFinale(TheDirector);
                if ((cVar5 != '\0') && (**(int **)(TheDirector + 0x638) != 3)) goto LAB_00a5d62a;
                if (((byte)this_00[300] & 0x40) != 0) goto LAB_00a5cec0;
              }
              else if (*(int *)(*(char **)(TheDirector + 0x640) + 4) == 0) {
LAB_00a5d62a:
                if (((byte)this_00[300] & 0x40) == 0) goto LAB_00a5cec0;
              }
            }
          }
          if ((bVar12) ||
             (this_01 = (Vector *)this_00, cVar5 = TerrorNavArea::IsSpawningAllowed(this_00),
             cVar5 != '\0')) {
            local_54 = (TerrorNavArea *)0x0;
            local_50 = 0;
            if (___atan2f_finite == (Vector *)0x0) {
              local_34 = (Vector *)0x0;
            }
            else {
              this_01 = ___atan2f_finite;
              (**(code **)(___atan2f_finite + 0x50))
                        (___atan2f_finite,&local_54,0,0,0,0,
                         "/data/src/game/server/terror/zombiemanager.cpp",0xe07,
                         &AccumulateSpawnAreaCollection(CUtlVector<CNavArea*,CUtlMemory<CNavArea*,int>>const&,ZombieManager::MobLocationType,ZombieClassType,float,CUtlVector<CNavArea*,CUtlMemory<CNavArea*,int>>*,bool,bool)
                          ::tm_fmt,"(%s)%s","Unaccounted",
                         "ZombieManager::AccumulateSpawnAreaCollection -- visibility");
              local_34 = ___atan2f_finite;
            }
            iVar11 = _DAT_0105db00;
            local_3c = local_54;
            local_38 = local_50;
                    /* try { // try from 00a5d07a to 00a5d07e has its CatchHandler @ 00a5d6f3 */
            if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
               (iVar8 = ThreadGetCurrentId(), iVar11 == iVar8)) {
              if (*(char **)_DAT_0105d15c !=
                  "ZombieManager::AccumulateSpawnAreaCollection -- visibility") {
                    /* try { // try from 00a5d681 to 00a5d692 has its CatchHandler @ 00a5d6f3 */
                _DAT_0105d15c =
                     (Vector *)
                     CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xd298e8,(char *)0x1,0xbfafa1);
              }
              this_01 = _DAT_0105d15c;
              CVProfNode::EnterScope();
              DAT_0105d158 = '\0';
            }
                    /* try { // try from 00a5d0a6 to 00a5d0aa has its CatchHandler @ 00a5d79e */
            if (((cVar4 == '\0') && (this_00[0x7e] != (TerrorNavArea)0x0)) &&
               (this_01 = (Vector *)TheDirector,
               cVar5 = CDirector::IsLocationFoggedToSurvivors
                                 (TheDirector,(Vector *)(this_00 + 0x2c)), cVar5 == '\0')) {
              CVProfile::ExitScope((CVProfile *)&g_VProfCurrentProfile);
              Tm_Zone::~Tm_Zone((Tm_Zone *)&local_3c);
            }
            else {
              iVar11 = _DAT_0105db00;
              if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
                 (iVar8 = ThreadGetCurrentId(this_01), iVar11 == iVar8)) {
                cVar5 = CVProfNode::ExitScope();
                if (cVar5 != '\0') {
                  _DAT_0105d15c = *(Vector **)(_DAT_0105d15c + 100);
                }
                DAT_0105d158 = _DAT_0105d15c == (Vector *)0x105d160;
              }
              if (local_34 != (Vector *)0x0) {
                (**(code **)(local_34 + 0x54))(local_34,local_3c,local_38,0,0,0);
              }
              switch(param_3) {
              default:
switchD_00a5d121_caseD_0:
                local_3c = this_00;
                CUtlVector<CNavArea*,CUtlMemory<CNavArea*,int>>::InsertBefore
                          (param_6,*(int *)(param_6 + 0xc),(CNavArea **)&local_3c);
                if ((param_3 == 8) || (param_3 == 5)) {
                    /* try { // try from 00a5d75b to 00a5d77c has its CatchHandler @ 00a5d732 */
                  pCVar9 = (CBaseEntity *)
                           CDirectorTacticalServices::GetClosestSurvivor
                                     (*(CDirectorTacticalServices **)(TheDirector + 0x628),
                                      (Vector *)(this_00 + 0x2c),true,true);
                  if ((pCVar9 != (CBaseEntity *)0x0) && (((byte)pCVar9[0x14d] & 8) != 0)) {
                    CBaseEntity::CalcAbsolutePosition(pCVar9);
                  }
                }
                else if (param_7 != '\0') {
                  CNavMesh::AddToSelectedSet(TheNavMesh,(CNavArea *)this_00);
                }
                break;
              case 1:
                if (*(float *)(this_00 + 0x154) <= param_5) goto switchD_00a5d121_caseD_0;
                break;
              case 2:
                if ((*(float *)(this_00 + 0x154) <= param_5 + 2000.0) &&
                   (param_5 - 1000.0 <= *(float *)(this_00 + 0x154))) goto switchD_00a5d121_caseD_0;
                break;
              case 3:
              case 7:
                if ((-9999.0 < *(float *)(this_00 + 0x154)) &&
                   (param_5 <= *(float *)(this_00 + 0x154))) goto switchD_00a5d121_caseD_0;
                break;
              case 6:
                if (param_5 + 100.0 < *(float *)(this_00 + 0x34) ||
                    param_5 + 100.0 == *(float *)(this_00 + 0x34)) goto switchD_00a5d121_caseD_0;
                break;
              case 9:
                local_90 = 0;
                if (0 < local_30[3]) {
                  do {
                    pCVar9 = *(CBaseEntity **)(local_30[0] + local_90 * 4);
                    if (((byte)pCVar9[0x14d] & 8) != 0) {
                    /* try { // try from 00a5d91f to 00a5d923 has its CatchHandler @ 00a5d732 */
                      CBaseEntity::CalcAbsolutePosition(pCVar9);
                    }
                    if (((*(float *)(pCVar9 + 0x2e0) - *(float *)(this_00 + 0x2c)) *
                         (*(float *)(pCVar9 + 0x2e0) - *(float *)(this_00 + 0x2c)) +
                         (*(float *)(pCVar9 + 0x2e4) - *(float *)(this_00 + 0x30)) *
                         (*(float *)(pCVar9 + 0x2e4) - *(float *)(this_00 + 0x30)) < local_84) &&
                       (ABS(*(float *)(pCVar9 + 0x2e8) - *(float *)(this_00 + 0x34)) < local_88))
                    goto switchD_00a5d121_caseD_0;
                    local_90 = local_90 + 1;
                  } while (local_90 < local_30[3]);
                }
                break;
              case 10:
                if ((*(float *)(this_00 + 0x30) - *(float *)(this + 0x21c)) *
                    (*(float *)(this_00 + 0x30) - *(float *)(this + 0x21c)) +
                    (*(float *)(this_00 + 0x2c) - *(float *)(this + 0x218)) *
                    (*(float *)(this_00 + 0x2c) - *(float *)(this + 0x218)) +
                    (*(float *)(this_00 + 0x34) - *(float *)(this + 0x220)) *
                    (*(float *)(this_00 + 0x34) - *(float *)(this + 0x220)) <=
                    *(float *)(this + 0x224) * *(float *)(this + 0x224))
                goto switchD_00a5d121_caseD_0;
              }
            }
          }
        }
      }
      else {
        cVar5 = CTerrorGameRules::HasPlayerControlledZombies();
        if (cVar5 == '\0') {
          if ((param_3 - 3U < 2) || (param_3 == 6)) goto LAB_00a5cf5c;
        }
        else if ((param_4 & 0xfffffff7) != 0) {
LAB_00a5cf5c:
          uVar7 = *(uint *)(this_00 + 300);
          goto LAB_00a5cf62;
        }
      }
LAB_00a5cec0:
      iVar6 = iVar6 + 1;
    } while (iVar6 < param_1[3]);
  }
  if (param_3 == 8) {
    if (param_4 == 0) {
      local_64 = *(float *)(ZombieFinaleMobSpawnSafetyRange._28_4_ + 0x2c);
    }
    else if (param_4 == 8) {
      local_64 = *(float *)(ZombieFinaleTankSpawnSafetyRange._28_4_ + 0x2c);
    }
    else {
      local_64 = *(float *)(ZombieFinaleSpawnSafetyRange._28_4_ + 0x2c);
    }
    local_68 = (local_64 + local_64) * (local_64 + local_64);
    local_64 = local_64 * local_64;
  }
  else {
    local_68 = 0.0;
    local_64 = 0.0;
    if (param_3 != 5) goto LAB_00a5d400;
  }
  local_60 = *(int *)(param_6 + 0xc) + -1;
  if (-1 < local_60) {
    iVar6 = local_60 * 4;
    do {
      pCVar3 = *(CNavArea **)(*(int *)param_6 + iVar6);
                    /* try { // try from 00a5d2a9 to 00a5d2c8 has its CatchHandler @ 00a5d732 */
      pCVar9 = (CBaseEntity *)
               CDirectorTacticalServices::GetClosestSurvivor
                         (*(CDirectorTacticalServices **)(TheDirector + 0x628),
                          (Vector *)(pCVar3 + 0x2c),true,true);
      if (pCVar9 != (CBaseEntity *)0x0) {
        if (((byte)pCVar9[0x14d] & 8) != 0) {
          CBaseEntity::CalcAbsolutePosition(pCVar9);
        }
        fVar13 = (*(float *)(pCVar9 + 0x2e8) - *(float *)(pCVar3 + 0x34)) *
                 (*(float *)(pCVar9 + 0x2e8) - *(float *)(pCVar3 + 0x34)) +
                 (*(float *)(pCVar9 + 0x2e4) - *(float *)(pCVar3 + 0x30)) *
                 (*(float *)(pCVar9 + 0x2e4) - *(float *)(pCVar3 + 0x30)) +
                 (*(float *)(pCVar9 + 0x2e0) - *(float *)(pCVar3 + 0x2c)) *
                 (*(float *)(pCVar9 + 0x2e0) - *(float *)(pCVar3 + 0x2c));
        if ((fVar13 < local_64) || ((local_68 < fVar13 && (param_3 == 8)))) {
          if (0 < *(int *)(param_6 + 0xc)) {
            iVar11 = *(int *)(param_6 + 0xc) + -1;
            if (local_60 != iVar11) {
              *(undefined4 *)(*(int *)param_6 + iVar6) =
                   *(undefined4 *)(*(int *)param_6 + iVar11 * 4);
              iVar11 = *(int *)(param_6 + 0xc) + -1;
            }
            *(int *)(param_6 + 0xc) = iVar11;
          }
        }
        else if (param_7 != '\0') {
                    /* try { // try from 00a5d4cc to 00a5d4d0 has its CatchHandler @ 00a5d732 */
          CNavMesh::AddToSelectedSet(TheNavMesh,pCVar3);
        }
      }
      local_60 = local_60 + -1;
      iVar6 = iVar6 + -4;
    } while (local_60 != -1);
  }
LAB_00a5d400:
  local_30[3] = 0;
  CUtlMemory<CTerrorPlayer*,int>::Purge(local_74);
  local_30[4] = local_30[0];
  CUtlMemory<CTerrorPlayer*,int>::Purge(local_74);
  iVar6 = _DAT_0105db00;
  if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
     (iVar11 = ThreadGetCurrentId(), iVar6 == iVar11)) {
    cVar4 = CVProfNode::ExitScope();
    if (cVar4 != '\0') {
      _DAT_0105d15c = *(Vector **)(_DAT_0105d15c + 100);
    }
    DAT_0105d158 = _DAT_0105d15c == (Vector *)0x105d160;
  }
  if (local_40 != 0) {
    (**(code **)(local_40 + 0x54))(local_40,local_48,local_44,0,0,0);
  }
  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)