L L4D2node

TerrorNavMesh::MaintainWanderingPopulation

0x0097d700 · 1509 bytes · __thiscall

_ZN13TerrorNavMesh27MaintainWanderingPopulationEb

Decompiled

undefined (2 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* TerrorNavMesh::MaintainWanderingPopulation(bool) */

void __thiscall TerrorNavMesh::MaintainWanderingPopulation(TerrorNavMesh *this,bool param_1)

{
  uint *puVar1;
  CDirectorTacticalServices *pCVar2;
  TerrorNavArea *this_00;
  char cVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  undefined1 *puVar7;
  longdouble lVar8;
  float fVar9;
  CDirector *pCVar10;
  CDirectorTacticalServices *pCVar11;
  CDirectorTacticalServices *pCVar12;
  int local_58;
  undefined4 local_44;
  undefined4 local_40;
  undefined4 local_38;
  undefined4 local_34;
  CDirector *local_30;
  int local_2c [7];
  
  cVar3 = CDirector::IsFinale(TheDirector);
  if (((cVar3 != '\0') || (cVar3 = CDirector::AreWanderersAllowed(TheDirector), cVar3 == '\0')) ||
     (cVar3 = CTerrorGameRules::IsSurvivalMode(), cVar3 != '\0')) {
    TerrorNavArea::gm_wanderingPopulationRequests._12_4_ = 0;
    return;
  }
  pCVar2 = *(CDirectorTacticalServices **)(TheDirector + 0x628);
  pCVar10 = TheDirector;
  iVar4 = CDirector::GetCommonInfectedLimit(TheDirector);
  if (param_1) {
LAB_0097d773:
    local_44 = 0;
    local_40 = 0;
    if (_towlower == (CDirector *)0x0) {
      local_30 = (CDirector *)0x0;
    }
    else {
      pCVar10 = _towlower;
      (**(code **)(_towlower + 0x50))
                (_towlower,&local_44,0,0,0,0,"/data/src/game/server/terror/terrornav.cpp",0x1121,
                 &MaintainWanderingPopulation(bool)::tm_fmt,"(%s)%s","ZombieSpiky",
                 "TerrorNavMesh::MaintainWanderingPopulation");
      local_30 = _towlower;
    }
    iVar6 = _DAT_0105db00;
    local_38 = local_44;
    local_34 = local_40;
                    /* try { // try from 0097d818 to 0097d81c has its CatchHandler @ 0097dcfa */
    if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
       (iVar5 = ThreadGetCurrentId(pCVar10), iVar6 == iVar5)) {
      if ((char *)*_DAT_0105d15c != "TerrorNavMesh::MaintainWanderingPopulation") {
                    /* try { // try from 0097dca9 to 0097dccc has its CatchHandler @ 0097dcfa */
        _DAT_0105d15c =
             (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xd0fae4,(char *)0x0,0xd0e8d1);
      }
      puVar1 = (uint *)(_DAT_0105d1e8 + 4 + _DAT_0105d15c[0x1c] * 8);
      *puVar1 = *puVar1 | 4;
      CVProfNode::EnterScope();
      DAT_0105d158 = '\0';
    }
    if ((param_1) ||
       (lVar8 = (longdouble)CountdownTimer::Now(), *(float *)(this + 0x6c0) <= (float)lVar8)) {
      local_2c[0] = 0;
      local_2c[1] = 0;
      local_2c[2] = 0;
      local_2c[3] = 0;
                    /* try { // try from 0097d84f to 0097d853 has its CatchHandler @ 0097dd0f */
      ForEachSurvivor<PopulateActiveAreaSet>((PopulateActiveAreaSet *)local_2c);
      iVar6 = 4;
      do {
        puVar7 = (undefined1 *)local_2c[MaintainWanderingPopulation(bool)::iNextForcedSurvivor];
        MaintainWanderingPopulation(bool)::iNextForcedSurvivor =
             (MaintainWanderingPopulation(bool)::iNextForcedSurvivor + 1) % 4;
        if ((int *)puVar7 != (int *)0x0) break;
        iVar6 = iVar6 + -1;
      } while (iVar6 != 0);
    }
    else {
      puVar7 = (undefined1 *)0x0;
      if (TerrorNavArea::gm_wanderingPopulationRequests._12_4_ != 0) {
        puVar7 = TerrorNavArea::gm_wanderingPopulationRequests;
      }
    }
    fVar9 = *(float *)(gpGlobals + 0x1c) * 3.0;
                    /* try { // try from 0097d9f8 to 0097dafb has its CatchHandler @ 0097dd0f */
    lVar8 = (longdouble)CountdownTimer::Now();
    if ((float)lVar8 + fVar9 != *(float *)(this + 0x6b4)) {
      (**(code **)(*(int *)(this + 0x6ac) + 4))(this + 0x6ac,this + 0x6b4);
      *(float *)(this + 0x6b4) = (float)lVar8 + fVar9;
    }
    if (fVar9 != *(float *)(this + 0x6b0)) {
      (**(code **)(*(int *)(this + 0x6ac) + 4))(this + 0x6ac,this + 0x6b0);
      *(float *)(this + 0x6b0) = fVar9;
    }
    pCVar12 = (CDirectorTacticalServices *)(this + 0x6b8);
    pCVar11 = pCVar12;
    lVar8 = (longdouble)CountdownTimer::Now();
    if ((float)lVar8 + 1.0 != *(float *)(this + 0x6c0)) {
      pCVar11 = pCVar12;
      (**(code **)(*(int *)(this + 0x6b8) + 4))(pCVar12,this + 0x6c0);
      *(float *)(this + 0x6c0) = (float)lVar8 + 1.0;
    }
    if (*(float *)(this + 0x6bc) != 1.0) {
                    /* try { // try from 0097db83 to 0097dc1d has its CatchHandler @ 0097dd0f */
      (**(code **)(*(int *)(this + 0x6b8) + 4))(pCVar12,this + 0x6bc);
      *(undefined4 *)(this + 0x6bc) = 0x3f800000;
      pCVar11 = pCVar12;
    }
    if ((int *)puVar7 != (int *)0x0) {
      TerrorNavArea::m_masterTerrorMark = TerrorNavArea::m_masterTerrorMark + 1;
      if (0 < *(int *)((int)puVar7 + 0xc)) {
        local_58 = 0;
        iVar6 = 0;
        do {
          pCVar11 = pCVar2;
          iVar5 = CDirectorTacticalServices::GetCommonInfectedCount(pCVar2,0);
          if ((iVar4 <= iVar5) || (99 < local_58)) break;
          this_00 = *(TerrorNavArea **)(*(int *)puVar7 + iVar6 * 4);
          if ((*(int *)(this_00 + 0x128) != 0) &&
             (((*(int *)(this_00 + 0x124) != TerrorNavArea::m_masterTerrorMark &&
               (this_00[0x7d] == (TerrorNavArea)0x0)) && (*(int *)(this_00 + 0x15c) != 0)))) {
            pCVar11 = (CDirectorTacticalServices *)this_00;
            TerrorNavArea::MaintainWanderingPopulation(this_00);
            local_58 = local_58 + 1;
            *(int *)(this_00 + 0x124) = TerrorNavArea::m_masterTerrorMark;
          }
          iVar6 = iVar6 + 1;
        } while (iVar6 < *(int *)((int)puVar7 + 0xc));
      }
      if (puVar7 == TerrorNavArea::gm_wanderingPopulationRequests) {
        TerrorNavArea::gm_wanderingPopulationRequests._12_4_ = 0;
      }
    }
    iVar4 = _DAT_0105db00;
    if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
       (iVar6 = ThreadGetCurrentId(pCVar11), iVar4 == iVar6)) {
      cVar3 = CVProfNode::ExitScope();
      if (cVar3 != '\0') {
        _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
      }
      DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
    }
    if (local_30 != (CDirector *)0x0) {
      (**(code **)(local_30 + 0x54))(local_30,local_38,local_34,0,0,0);
    }
  }
  else {
    iVar6 = CDirectorTacticalServices::GetCommonInfectedCount(pCVar2,0);
    if (iVar6 < iVar4) {
      if (TerrorNavArea::gm_wanderingPopulationRequests._12_4_ != 0) {
        pCVar10 = (CDirector *)(this + 0x6ac);
        lVar8 = (longdouble)CountdownTimer::Now();
        if (*(float *)(this + 0x6b4) <= (float)lVar8) goto LAB_0097d773;
      }
      pCVar10 = (CDirector *)(this + 0x6b8);
      lVar8 = (longdouble)CountdownTimer::Now();
      if (*(float *)(this + 0x6c0) <= (float)lVar8) goto LAB_0097d773;
    }
    fVar9 = *(float *)(this + 0x6b4);
    if ((0.0 < fVar9) && (lVar8 = (longdouble)CountdownTimer::Now(), fVar9 - (float)lVar8 < -20.0))
    {
      TerrorNavArea::gm_wanderingPopulationRequests._12_4_ = 0;
    }
  }
  cVar3 = CDirector::IsBackgroundMap();
  if (cVar3 != '\0') {
    iVar4 = *(int *)(ZombieBackgroundLimit._28_4_ + 0x30);
    iVar6 = CDirectorTacticalServices::GetCommonInfectedCount
                      (*(CDirectorTacticalServices **)(TheDirector + 0x628),0);
    iVar4 = iVar4 - iVar6;
    if (0 < iVar4) {
      SpawnBackgroundZombies(iVar4,false);
    }
    if ((1 < *(int *)(ZombieDebug._28_4_ + 0x30)) && (0 < DAT_00fe6000)) {
      iVar4 = 0;
      do {
        iVar6 = iVar4 * 4;
        iVar4 = iVar4 + 1;
        TerrorNavArea::DrawSpawn(*(TerrorNavArea **)(TheNavAreas + iVar6));
      } while (iVar4 < DAT_00fe6000);
      return;
    }
  }
  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)