L L4D2node

ZombieManager::StartFrame

0x00a614f0 · 2782 bytes · __thiscall

_ZN13ZombieManager10StartFrameEv

Decompiled

undefined (1 param)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* ZombieManager::StartFrame() */

void __thiscall ZombieManager::StartFrame(ZombieManager *this)

{
  ZombieManager *pZVar1;
  uint *puVar2;
  ZombieManager ZVar3;
  char cVar4;
  int iVar5;
  int iVar6;
  int *piVar7;
  undefined4 uVar8;
  CBaseEntity *pCVar9;
  TerrorNavArea *pTVar10;
  undefined4 *puVar11;
  int in_GS_OFFSET;
  longdouble lVar12;
  float fVar13;
  TerrorNavMesh *pTVar14;
  undefined4 uVar15;
  int local_64;
  int local_60;
  undefined4 local_54;
  undefined4 local_50;
  undefined4 local_48;
  undefined4 local_44;
  TerrorNavMesh *local_40;
  undefined4 local_3c;
  undefined4 local_38;
  float local_34;
  undefined4 local_30;
  undefined4 local_2c;
  float local_28;
  Color local_24;
  undefined1 local_23;
  undefined1 local_22;
  undefined1 local_21;
  int local_20;
  
  local_54 = 0;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  local_50 = 0;
  if (_towlower == (TerrorNavMesh *)0x0) {
    local_40 = (TerrorNavMesh *)0x0;
  }
  else {
    (**(code **)(_towlower + 0x50))
              (_towlower,&local_54,0,0,0,0,"/data/src/game/server/terror/zombiemanager.cpp",0x8c1,
               &StartFrame()::tm_fmt,"(%s)%s","ZOMBIE","ZombieManager::StartFrame");
    local_40 = _towlower;
  }
  iVar5 = _DAT_0105db00;
  local_48 = local_54;
  local_44 = local_50;
                    /* try { // try from 00a61776 to 00a617d6 has its CatchHandler @ 00a62037 */
  if (((_DAT_0105d154 == 0) && (DAT_0105d158 != '\0')) ||
     (iVar6 = ThreadGetCurrentId(), iVar5 != iVar6)) {
    ZVar3 = this[0x289];
  }
  else {
    if (*(char **)_DAT_0105d15c != "ZombieManager::StartFrame") {
      _DAT_0105d15c =
           (TerrorNavMesh *)
           CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xd28f0b,(char *)0x0,0xc0db47);
    }
    puVar2 = (uint *)(_DAT_0105d1e8 + 4 + *(int *)(_DAT_0105d15c + 0x70) * 8);
    *puVar2 = *puVar2 | 4;
    CVProfNode::EnterScope();
    DAT_0105d158 = '\0';
    ZVar3 = this[0x289];
  }
  if (ZVar3 != (ZombieManager)0x0) {
                    /* try { // try from 00a617ee to 00a617f2 has its CatchHandler @ 00a62035 */
    CollateNavAreas(this);
    this[0x289] = (ZombieManager)0x0;
  }
  if ((*(int *)(ZombieDebug._28_4_ + 0x30) != 0) && (*(int *)(TheNavMesh + 0x528) == 0)) {
    if ((StartFrame()::host_thread_mode == '\0') &&
       (iVar5 = __cxa_guard_acquire(&StartFrame()::host_thread_mode), iVar5 != 0)) {
                    /* try { // try from 00a61ed6 to 00a61eda has its CatchHandler @ 00a6203b */
      ConVarRef::ConVarRef((ConVarRef *)&StartFrame()::host_thread_mode,"host_thread_mode");
      __cxa_guard_release(&StartFrame()::host_thread_mode);
    }
                    /* try { // try from 00a61b07 to 00a61c7f has its CatchHandler @ 00a62035 */
    (**(code **)(*StartFrame()::host_thread_mode + 8))(StartFrame()::host_thread_mode,0);
  }
  if (0.0 < *(float *)(this + 0x38)) {
                    /* try { // try from 00a615ed to 00a61704 has its CatchHandler @ 00a62035 */
    lVar12 = (longdouble)CountdownTimer::Now();
    if (*(float *)(this + 0x38) <= (float)lVar12) {
      iVar5 = CDirector::GetMegaMobSize(TheDirector);
      SpawnMob(this,iVar5);
      if (*(float *)(this + 0x38) != -1.0) {
        (**(code **)(*(int *)(this + 0x30) + 4))(this + 0x30,this + 0x38);
        *(undefined4 *)(this + 0x38) = 0xbf800000;
      }
    }
  }
  if (((1 < *(int *)(ZombieDebugMobSpawn._28_4_ + 0x30)) && (*(int *)(nav_edit._28_4_ + 0x30) == 0))
     && (0 < *(int *)(this + 0x1f0))) {
    iVar5 = 0;
    do {
      piVar7 = *(int **)(*(int *)(this + 0x1e4) + iVar5 * 8);
      (**(code **)(*piVar7 + 0x54))(piVar7,0xff,0xff,0,0xff,0x47c34f80,1);
      iVar5 = iVar5 + 1;
    } while (iVar5 < *(int *)(this + 0x1f0));
  }
  iVar6 = CDirector::GetCommonInfectedLimit(TheDirector);
  iVar5 = *(int *)(this + 0x210);
  if (iVar5 < 1) {
    if (0 < *(int *)(this + 0x234)) {
      iVar5 = CDirectorTacticalServices::GetCommonInfectedCount
                        (*(CDirectorTacticalServices **)(TheDirector + 0x628),0);
      if (iVar5 < iVar6) {
        if (*(int *)(this + 0x238) == 0) {
          pCVar9 = (CBaseEntity *)CDirectorTacticalServices::GetRandomSurvivor();
          if (pCVar9 != (CBaseEntity *)0x0) {
            if (((byte)pCVar9[0x14d] & 8) != 0) {
              CBaseEntity::CalcAbsolutePosition(pCVar9);
            }
            pCVar9 = (CBaseEntity *)
                     CGlobalEntityList::FindEntityByClassnameNearest
                               ((CGlobalEntityList *)gEntList,"info_ambient_mob_start",
                                (Vector *)(pCVar9 + 0x2e0),16384.0);
            if ((pCVar9 != (CBaseEntity *)0x0) &&
               (iVar5 = CNavMesh::GetNearestNavArea((CNavMesh *)TheNavMesh,pCVar9,4,10000.0),
               iVar5 != 0)) {
              iVar5 = __dynamic_cast(iVar5,&CNavArea::typeinfo,&TerrorNavArea::typeinfo,0);
              *(int *)(this + 0x238) = iVar5;
              if ((iVar5 != 0) && (*(char *)(iVar5 + 0x7d) == '\0')) {
                ForEachSurvivor<AmbientMobSpawned>((AmbientMobSpawned *)&local_30);
                if (*(int *)(this + 0x238) == 0) goto LAB_00a61c5a;
                goto LAB_00a61c12;
              }
            }
          }
          *(undefined4 *)(this + 0x234) = 0;
          iVar5 = *(int *)(this + 0x210);
          *(undefined4 *)(this + 0x238) = 0;
          goto LAB_00a61c60;
        }
LAB_00a61c12:
        TerrorNavArea::FindRandomSpot();
        iVar5 = SpawnCommonZombie(this,*(undefined4 *)(this + 0x238),&local_30,2);
        if ((iVar5 != 0) &&
           (iVar5 = *(int *)(this + 0x234), *(int *)(this + 0x234) = iVar5 + -1, iVar5 + -1 < 1)) {
          *(undefined4 *)(this + 0x238) = 0;
        }
      }
LAB_00a61c5a:
      iVar5 = *(int *)(this + 0x210);
    }
LAB_00a61c60:
    if (iVar5 < 1) goto LAB_00a616dc;
  }
  iVar5 = CDirectorTacticalServices::GetCommonInfectedCount
                    (*(CDirectorTacticalServices **)(TheDirector + 0x628),0);
  if (iVar6 <= iVar5) goto LAB_00a616dc;
  pZVar1 = this + 0x1f8;
                    /* try { // try from 00a61854 to 00a61858 has its CatchHandler @ 00a62035 */
  lVar12 = (longdouble)CountdownTimer::Now();
  if ((*(float *)(this + 0x200) <= (float)lVar12) || (iVar5 = *(int *)(this + 0x1f0), iVar5 == 0)) {
    uVar15 = 0x40f00000;
    if (*(int *)(this + 0x214) != 9) {
      uVar15 = 0x41700000;
    }
    lVar12 = (longdouble)RandomFloat(0x40a00000,uVar15);
    fVar13 = (float)lVar12;
    lVar12 = (longdouble)CountdownTimer::Now();
    if ((float)lVar12 + fVar13 != *(float *)(this + 0x200)) {
                    /* try { // try from 00a61f02 to 00a61fc7 has its CatchHandler @ 00a62035 */
      (**(code **)(*(int *)(this + 0x1f8) + 4))(pZVar1,this + 0x200);
      *(float *)(this + 0x200) = (float)lVar12 + fVar13;
    }
    if (fVar13 != *(float *)(this + 0x1fc)) {
                    /* try { // try from 00a61eb2 to 00a61eb4 has its CatchHandler @ 00a62035 */
      (**(code **)(*(int *)(this + 0x1f8) + 4))(pZVar1,this + 0x1fc);
      *(float *)(this + 0x1fc) = fVar13;
    }
    ChooseMobSpawnAreas(this);
    iVar5 = *(int *)(this + 0x1f0);
    if (iVar5 != 0) goto LAB_00a6187c;
LAB_00a61b91:
    iVar6 = *(int *)(this + 0x210);
  }
  else {
LAB_00a6187c:
    iVar5 = iVar5 * 2;
    if (iVar5 < 4) {
      iVar5 = 4;
    }
    iVar6 = *(int *)(this + 0x210);
    if (iVar6 < iVar5) {
      iVar5 = iVar6;
    }
    if ((0 < iVar5) &&
       (pTVar10 = (TerrorNavArea *)**(int **)(this + 0x1e4), pTVar10 != (TerrorNavArea *)0x0)) {
      local_64 = 0;
      local_60 = 0;
      do {
        TerrorNavArea::FindRandomSpot();
                    /* try { // try from 00a619ba to 00a619be has its CatchHandler @ 00a62027 */
        cVar4 = CDirectorTacticalServices::IsVisibleToTeam
                          (*(CDirectorTacticalServices **)(TheDirector + 0x628),(Vector *)&local_3c,
                           2,0,0.0,pTVar10,(CBaseEntity *)0x0);
        if (cVar4 == '\0') {
          local_30 = local_3c;
          local_2c = local_38;
          uVar15 = 0;
          local_28 = local_34 + 68.0;
                    /* try { // try from 00a61a26 to 00a61a2a has its CatchHandler @ 00a62006 */
          cVar4 = CDirectorTacticalServices::IsVisibleToTeam
                            (*(CDirectorTacticalServices **)(TheDirector + 0x628),
                             (Vector *)&local_30,2,0,0.0,pTVar10,(CBaseEntity *)0x0);
          if (cVar4 != '\0') goto LAB_00a618d0;
                    /* try { // try from 00a61a49 to 00a61acb has its CatchHandler @ 00a62029 */
          piVar7 = (int *)SpawnCommonZombie(this,pTVar10,&local_3c,1);
          if (piVar7 == (int *)0x0) {
            fVar13 = *(float *)(this + 0x200);
            lVar12 = (longdouble)CountdownTimer::Now();
            fVar13 = (fVar13 - (float)lVar12) - 5.0;
            lVar12 = (longdouble)CountdownTimer::Now();
            if ((float)lVar12 + fVar13 != *(float *)(this + 0x200)) {
              (**(code **)(*(int *)(this + 0x1f8) + 4))(pZVar1,this + 0x200);
              *(float *)(this + 0x200) = (float)lVar12 + fVar13;
            }
            if (fVar13 != *(float *)(this + 0x1fc)) {
              (**(code **)(*(int *)(this + 0x1f8) + 4))(pZVar1,this + 0x1fc);
              *(float *)(this + 0x1fc) = fVar13;
            }
          }
          else {
            *(int *)(this + 0x210) = *(int *)(this + 0x210) + -1;
            iVar6 = (**(code **)(*piVar7 + 0x14c))(piVar7);
            *(uint *)(iVar6 + 0x1c74) = *(uint *)(iVar6 + 0x1c74) | 0x100;
            piVar7 = (int *)(local_64 + *(int *)(this + 0x1e4) + 4);
            *piVar7 = *piVar7 + -1;
            if (*(int *)(ZombieDebugMobSpawn._28_4_ + 0x30) == 0) {
              puVar11 = (undefined4 *)(local_64 + *(int *)(this + 0x1e4));
              iVar6 = puVar11[1];
            }
            else {
              local_24 = 0xff;
              local_23 = 0x80;
              local_22 = 0;
              local_21 = 0xff;
              ConColorMsg(&local_24,"Mob zombie spawned in spawn area %d - %d left\n");
              puVar11 = (undefined4 *)(local_64 + *(int *)(this + 0x1e4));
              iVar6 = puVar11[1];
            }
            if (iVar6 < 1) {
              uVar8 = ChooseAdjacentMobSpawnArea(this,(TerrorNavArea *)*puVar11);
              *puVar11 = uVar8;
              iVar6 = *(int *)(local_64 + *(int *)(this + 0x1e4));
              if ((iVar6 != 0) &&
                 (((int *)(local_64 + *(int *)(this + 0x1e4)))[1] =
                       (int)((*(float *)(iVar6 + 0x10) - *(float *)(iVar6 + 4)) *
                             (*(float *)(iVar6 + 0x14) - *(float *)(iVar6 + 8)) *
                            *(float *)(ZombieMobPopulationDensity._28_4_ + 0x2c)),
                 *(int *)(ZombieDebugMobSpawn._28_4_ + 0x30) != 0)) {
                uVar15 = *(undefined4 *)(local_64 + *(int *)(this + 0x1e4) + 4);
                local_24 = 0xff;
                local_23 = 0x80;
                local_22 = 0;
                local_21 = 0xff;
                ConColorMsg(&local_24,
                            "ChooseAdjacentMobSpawnArea: m_mobSpawnAreas[%d].pArea %d has %d population\n"
                           );
              }
            }
            UTIL_LogPrintf("%3.2f: (MOB) Mob zombie spawned, %d remain.\n",
                           (double)*(float *)(gpGlobals + 0xc),*(undefined4 *)(this + 0x210),uVar15)
            ;
          }
        }
        else {
LAB_00a618d0:
          fVar13 = *(float *)(this + 0x200);
                    /* try { // try from 00a618dc to 00a6197d has its CatchHandler @ 00a62029 */
          lVar12 = (longdouble)CountdownTimer::Now();
          fVar13 = (fVar13 - (float)lVar12) - 5.0;
          lVar12 = (longdouble)CountdownTimer::Now();
          if ((float)lVar12 + fVar13 != *(float *)(this + 0x200)) {
            (**(code **)(*(int *)(this + 0x1f8) + 4))(pZVar1,this + 0x200);
            *(float *)(this + 0x200) = (float)lVar12 + fVar13;
          }
          if (fVar13 != *(float *)(this + 0x1fc)) {
                    /* try { // try from 00a61ca3 to 00a61e93 has its CatchHandler @ 00a62029 */
            (**(code **)(*(int *)(this + 0x1f8) + 4))(pZVar1,this + 0x1fc);
            *(float *)(this + 0x1fc) = fVar13;
          }
        }
        local_60 = local_60 + 1;
        if (local_60 == iVar5) break;
        local_64 = (local_60 % *(int *)(this + 0x1f0)) * 8;
        pTVar10 = *(TerrorNavArea **)
                   (*(int *)(this + 0x1e4) + (local_60 % *(int *)(this + 0x1f0)) * 8);
      } while (pTVar10 != (TerrorNavArea *)0x0);
      goto LAB_00a61b91;
    }
  }
  if (iVar6 == 0) {
    UTIL_LogPrintf("%3.2f: (MOB) Pending mob done.\n",(double)*(float *)(gpGlobals + 0xc));
  }
LAB_00a616dc:
  if (*(int *)(ZombieDebugSpawnableAreas._28_4_ + 0x30) != 0) {
    DebugSpawnAreas(this);
  }
  pTVar14 = TheNavMesh;
  TerrorNavMesh::MaintainWanderingPopulation(TheNavMesh,false);
  iVar5 = _DAT_0105db00;
  if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
     (iVar6 = ThreadGetCurrentId(), iVar5 == iVar6)) {
    pTVar14 = _DAT_0105d15c;
    cVar4 = CVProfNode::ExitScope();
    if (cVar4 != '\0') {
      _DAT_0105d15c = *(TerrorNavMesh **)(_DAT_0105d15c + 100);
    }
    DAT_0105d158 = _DAT_0105d15c == (TerrorNavMesh *)0x105d160;
  }
  if (local_40 != (TerrorNavMesh *)0x0) {
    pTVar14 = local_40;
    (**(code **)(local_40 + 0x54))(local_40,local_48,local_44,0,0,0);
  }
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail(pTVar14);
}

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)