L L4D2node

CDirector::UpdateSpecialSpawns

0x0087c9a0 · 2828 bytes · __thiscall

_ZN9CDirector19UpdateSpecialSpawnsEv

Decompiled

undefined (1 param)

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

void __thiscall CDirector::UpdateSpecialSpawns(CDirector *this)

{
  int *piVar1;
  undefined4 uVar2;
  char cVar3;
  char cVar4;
  int iVar5;
  int iVar6;
  CDirector *pCVar7;
  int iVar8;
  CBaseEntity *this_00;
  int iVar9;
  int iVar10;
  CDirector *pCVar11;
  int in_GS_OFFSET;
  longdouble lVar12;
  longdouble lVar13;
  float fVar14;
  ZombieManager *pZVar15;
  char *pcVar16;
  undefined1 *puVar17;
  int local_8c;
  undefined4 local_74;
  float local_70;
  undefined1 local_68 [12];
  undefined4 local_5c;
  float local_58;
  ZombieManager *local_54;
  undefined4 local_4c;
  float local_48;
  ZombieManager *local_44;
  int local_40 [6];
  int local_28;
  int *local_24;
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  if ((((*(int *)(DirectorNoSpecials._28_4_ + 0x30) != 0) ||
       (cVar3 = IsInCommentaryMode(), cVar3 != '\0')) || (this[0x160] == (CDirector)0x0)) ||
     (((**(char **)(this + 0x648) != '\0' &&
       (iVar5 = GetScriptValue(this,"TotalSpecials",0), iVar5 != 0)) &&
      (iVar5 <= *(int *)(TheZombieManager + 0x68))))) goto LAB_0087c9c9;
  if (*(float *)(this + 0x2fc) <= 0.0) {
    pCVar11 = this + 0x2f4;
    pCVar7 = pCVar11;
    do {
      lVar12 = (longdouble)
               GetScriptValue(this,"SpecialInitialSpawnDelayMax",
                              *(float *)(DirectorPrivate_DirectorSpecialInitialSpawnDelayMax._28_4_
                                        + 0x2c));
      lVar13 = (longdouble)
               GetScriptValue(this,"SpecialInitialSpawnDelayMin",
                              *(float *)(DirectorPrivate_DirectorSpecialInitialSpawnDelayMin._28_4_
                                        + 0x2c));
      lVar12 = (longdouble)RandomFloat((float)lVar13,(float)lVar12);
      fVar14 = (float)lVar12;
      lVar12 = (longdouble)CountdownTimer::Now();
      if ((float)lVar12 + fVar14 != *(float *)(this + (int)(pCVar7 + (8 - (int)this)))) {
        (**(code **)(*(int *)pCVar7 + 4))(pCVar7,pCVar7 + 8);
        *(float *)(this + (int)(pCVar7 + (8 - (int)this))) = (float)lVar12 + fVar14;
      }
      if (fVar14 != *(float *)(this + (int)(pCVar7 + (4 - (int)this)))) {
        (**(code **)(*(int *)pCVar7 + 4))(pCVar7,pCVar7 + 4);
        *(float *)(this + (int)(pCVar7 + (4 - (int)this))) = fVar14;
      }
      pCVar7 = pCVar7 + 0xc;
    } while (pCVar7 != this + 0x33c);
    pcVar16 = *(char **)(gpGlobals + 0x3c);
    if (pcVar16 == (char *)0x0) {
      pcVar16 = "";
LAB_0087d3c3:
      iVar5 = _V_stricmp(pcVar16,"l4d_airport02_offices");
      if (iVar5 != 0) goto LAB_0087ca1e;
    }
    else if (pcVar16 != "l4d_airport02_offices") goto LAB_0087d3c3;
    uVar2 = *(undefined4 *)(DirectorSpecialInitialSpawnDelayMaxExtra._28_4_ + 0x2c);
    lVar12 = (longdouble)
             GetScriptValue(this,"SpecialInitialSpawnDelayMin",
                            *(float *)(DirectorPrivate_DirectorSpecialInitialSpawnDelayMin._28_4_ +
                                      0x2c));
    lVar12 = (longdouble)RandomFloat((float)lVar12,uVar2);
    fVar14 = (float)lVar12;
    lVar12 = (longdouble)CountdownTimer::Now();
    if ((float)lVar12 + fVar14 != *(float *)(this + 0x2fc)) {
      (**(code **)(*(int *)(this + 0x2f4) + 4))(pCVar11,this + 0x2fc);
      *(float *)(this + 0x2fc) = (float)lVar12 + fVar14;
    }
    if (fVar14 != *(float *)(this + 0x2f8)) {
      (**(code **)(*(int *)(this + 0x2f4) + 4))(pCVar11,this + 0x2f8);
      *(float *)(this + 0x2f8) = fVar14;
    }
  }
LAB_0087ca1e:
  cVar3 = (**(code **)(*(int *)this + 0x5c))(this);
  if (cVar3 != '\0') {
    iVar5 = (**(code **)(*(int *)this + 0x30))(this);
    if (iVar5 < 3) {
      iVar5 = 3;
    }
    cVar3 = CTerrorGameRules::HasPlayerControlledZombies();
    local_8c = iVar5;
    if (cVar3 != '\0') {
      local_8c = 0;
      if (-1 < iVar5 - *(int *)(this + 0x1cc)) {
        local_8c = iVar5 - *(int *)(this + 0x1cc);
      }
    }
    if (local_8c != *(int *)(this + 0x370)) {
      CUtlVector<CountdownTimer,CUtlMemoryFixedGrowable<CountdownTimer,3u,int>>::
      SetCountNonDestructively
                ((CUtlVector<CountdownTimer,CUtlMemoryFixedGrowable<CountdownTimer,3u,int>> *)
                 (this + 0x33c),local_8c);
    }
    lVar12 = (longdouble)GetSpecialRespawnInterval(this);
    local_24 = local_40;
    local_28 = 0;
LAB_0087cab0:
    iVar5 = *(int *)(this + 0x1c8);
    iVar6 = (**(code **)(*(int *)this + 0x30))(this);
    if ((iVar5 < iVar6) && (local_8c != 0)) {
      iVar5 = 0;
      iVar6 = 0;
      while (iVar10 = *(int *)(this + 0x33c), lVar13 = (longdouble)CountdownTimer::Now(),
            (float)lVar13 < *(float *)(iVar10 + iVar5 + 8)) {
        iVar6 = iVar6 + 1;
        iVar5 = iVar5 + 0xc;
        if (iVar6 == local_8c) goto LAB_0087c9c9;
      }
      if (local_8c != iVar6) {
        local_28 = 0;
        pCVar11 = this + 0x2b4;
        pCVar7 = this + 0x2f4;
        iVar5 = 0;
        do {
          iVar5 = iVar5 + 1;
          lVar13 = (longdouble)CountdownTimer::Now();
          if (*(float *)(pCVar7 + 8) <= (float)lVar13) {
            fVar14 = 99999.9;
            if (0.0 < *(float *)(pCVar11 + 4)) {
              lVar13 = (longdouble)IntervalTimer::Now();
              fVar14 = (float)lVar13 - *(float *)(pCVar11 + 4);
            }
            if ((float)lVar12 < fVar14) {
              cVar3 = (**(code **)(*(int *)this + 0x34))(this,iVar5);
              if (cVar3 == '\0') {
                lVar13 = (longdouble)CountdownTimer::Now();
                if ((float)lVar13 + 20.0 != *(float *)(this + (int)(pCVar7 + (8 - (int)this)))) {
                  (**(code **)(*(int *)pCVar7 + 4))(pCVar7,pCVar7 + 8);
                  *(float *)(this + (int)(pCVar7 + (8 - (int)this))) = (float)lVar13 + 20.0;
                }
                if (*(float *)(this + (int)(pCVar7 + (4 - (int)this))) != 20.0) {
                  (**(code **)(*(int *)pCVar7 + 4))(pCVar7,pCVar7 + 4);
                  *(undefined4 *)(this + (int)(pCVar7 + (4 - (int)this))) = 0x41a00000;
                }
              }
              else {
                local_24 = local_40;
                piVar1 = local_40 + local_28;
                local_28 = local_28 + 1;
                *piVar1 = iVar5;
              }
            }
          }
          pCVar7 = pCVar7 + 0xc;
          pCVar11 = pCVar11 + 8;
        } while (iVar5 != 6);
        if (local_28 != 0) {
          do {
            iVar10 = RandomInt(0,local_28 + -1);
            local_5c = 0;
            local_58 = 0.0;
            iVar5 = local_40[iVar10];
            if (___atan2f_finite == (ZombieManager *)0x0) {
              local_44 = (ZombieManager *)0x0;
            }
            else {
              (**(code **)(___atan2f_finite + 0x50))
                        (___atan2f_finite,&local_5c,0,0,0,0,
                         "/data/src/game/server/terror/director.cpp",0x81c,
                         &UpdateSpecialSpawns()::tm_fmt,"(%s)%s","Unaccounted",
                         "bFoundSpawn = TheZombieManager->GetRandomPZSpawnPosition( which, retries, NULL, &spawnPos )"
                        );
              local_44 = ___atan2f_finite;
            }
            iVar9 = _DAT_0105db00;
            local_4c = local_5c;
            local_48 = local_58;
                    /* try { // try from 0087cc7a to 0087cc7e has its CatchHandler @ 0087d51f */
            if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
               (iVar8 = ThreadGetCurrentId(), iVar9 == iVar8)) {
              if (*(char **)_DAT_0105d15c !=
                  "bFoundSpawn = TheZombieManager->GetRandomPZSpawnPosition( which, retries, NULL, &spawnPos )"
                 ) {
                    /* try { // try from 0087d010 to 0087d021 has its CatchHandler @ 0087d51f */
                _DAT_0105d15c =
                     (ZombieManager *)
                     CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xcdde78,(char *)0x1,0xbfafa1);
              }
              CVProfNode::EnterScope();
              DAT_0105d158 = '\0';
            }
            puVar17 = local_68;
            pcVar16 = (char *)0x0;
            fVar14 = 7.00649e-45;
            pZVar15 = TheZombieManager;
                    /* try { // try from 0087ccaa to 0087ccae has its CatchHandler @ 0087d4fe */
            cVar3 = ZombieManager::GetRandomPZSpawnPosition(TheZombieManager,iVar5,5,0,puVar17);
            iVar9 = _DAT_0105db00;
            if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
               (iVar8 = ThreadGetCurrentId(), iVar9 == iVar8)) {
              pZVar15 = _DAT_0105d15c;
              cVar4 = CVProfNode::ExitScope();
              if (cVar4 != '\0') {
                _DAT_0105d15c = *(ZombieManager **)(_DAT_0105d15c + 100);
              }
              DAT_0105d158 = _DAT_0105d15c == (ZombieManager *)0x105d160;
            }
            if (local_44 != (ZombieManager *)0x0) {
              puVar17 = (undefined1 *)0x0;
              pcVar16 = (char *)0x0;
              pZVar15 = local_44;
              fVar14 = local_48;
              (**(code **)(local_44 + 0x54))(local_44,local_4c,local_48,0,0,0);
            }
            if (cVar3 != '\0') {
              local_74 = 0;
              local_70 = 0.0;
              if (___atan2f_finite == (ZombieManager *)0x0) {
                local_54 = (ZombieManager *)0x0;
              }
              else {
                pcVar16 = (char *)0x0;
                puVar17 = (undefined1 *)0x0;
                fVar14 = 0.0;
                pZVar15 = ___atan2f_finite;
                (**(code **)(___atan2f_finite + 0x50))
                          (___atan2f_finite,&local_74,0,0,0,0,
                           "/data/src/game/server/terror/director.cpp",0x820,
                           &UpdateSpecialSpawns()::tm_fmt,"(%s)%s","Unaccounted",
                           "pSpecial = TheZombieManager->SpawnSpecial( which, spawnPos, QAngle( 0.0f, RandomFloat( 0.0f, 360.0f ), 0.0f ) )"
                          );
                local_54 = ___atan2f_finite;
              }
              iVar9 = _DAT_0105db00;
              local_5c = local_74;
              local_58 = local_70;
                    /* try { // try from 0087cdbc to 0087cdc0 has its CatchHandler @ 0087d4fa */
              if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
                 (iVar8 = ThreadGetCurrentId(pZVar15), iVar9 == iVar8)) {
                if (*(char **)_DAT_0105d15c !=
                    "pSpecial = TheZombieManager->SpawnSpecial( which, spawnPos, QAngle( 0.0f, RandomFloat( 0.0f, 360.0f ), 0.0f ) )"
                   ) {
                  puVar17 = (undefined1 *)0x0;
                  pcVar16 = "Unaccounted";
                  fVar14 = 1.4013e-45;
                    /* try { // try from 0087d090 to 0087d0a1 has its CatchHandler @ 0087d4fa */
                  _DAT_0105d15c =
                       (ZombieManager *)
                       CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xcdded4,(char *)0x1,0xbfafa1);
                }
                CVProfNode::EnterScope();
                DAT_0105d158 = '\0';
              }
                    /* try { // try from 0087cdd8 to 0087ce16 has its CatchHandler @ 0087d4d9 */
              lVar13 = (longdouble)RandomFloat(0,0x43b40000,fVar14,pcVar16,puVar17);
              local_48 = (float)lVar13;
              local_4c = 0;
              local_44 = (ZombieManager *)0x0;
              this_00 = (CBaseEntity *)
                        ZombieManager::SpawnSpecial(TheZombieManager,iVar5,local_68,&local_4c);
              iVar9 = _DAT_0105db00;
              if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
                 (iVar8 = ThreadGetCurrentId(), iVar9 == iVar8)) {
                cVar3 = CVProfNode::ExitScope();
                if (cVar3 != '\0') {
                  _DAT_0105d15c = *(ZombieManager **)(_DAT_0105d15c + 100);
                }
                DAT_0105d158 = _DAT_0105d15c == (ZombieManager *)0x105d160;
              }
              if (local_54 != (ZombieManager *)0x0) {
                (**(code **)(local_54 + 0x54))(local_54,local_5c,local_58,0,0,0);
              }
              if ((this_00 != (CBaseEntity *)0x0) &&
                 (iVar9 = CBaseEntity::GetTeamNumber(this_00), iVar9 == 3)) goto LAB_0087d0b0;
            }
            iVar5 = (iVar5 * 3 + -3) * 4;
            lVar13 = (longdouble)CountdownTimer::Now();
            if ((float)lVar13 + 5.0 != *(float *)(this + iVar5 + 0x2fc)) {
              (**(code **)(*(int *)(this + iVar5 + 0x2f4) + 4))
                        (this + iVar5 + 0x2f4,this + iVar5 + 0x2fc);
              *(float *)(this + iVar5 + 0x2fc) = (float)lVar13 + 5.0;
            }
            if (*(float *)(this + iVar5 + 0x2f8) != 5.0) {
              (**(code **)(*(int *)(this + iVar5 + 0x2f4) + 4))
                        (this + iVar5 + 0x2f4,this + iVar5 + 0x2f8);
              *(undefined4 *)(this + iVar5 + 0x2f8) = 0x40a00000;
            }
            iVar5 = local_28;
            if ((0 < local_28) && (iVar5 = local_28 + -1, iVar10 != iVar5)) {
              local_40[iVar10] = local_40[iVar5];
              iVar5 = local_28 + -1;
            }
            local_28 = iVar5;
            DevMsg("Director failed to spawn a special\n");
            *(undefined4 *)(TheZombieManager + 0x6c) = 0;
            if (local_28 == 0) break;
          } while( true );
        }
      }
    }
  }
LAB_0087c9c9:
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  return;
LAB_0087d0b0:
  *(int *)(this_00 + 0x3ffc) = iVar6;
  piVar1 = (int *)(*(int *)(this + 0x33c) + iVar6 * 0xc);
  lVar13 = (longdouble)CountdownTimer::Now();
  if ((float)lVar13 + 999.0 != (float)piVar1[2]) {
    (**(code **)(*piVar1 + 4))(piVar1,piVar1 + 2);
    piVar1[2] = (int)((float)lVar13 + 999.0);
  }
  if ((float)piVar1[1] != 999.0) {
    (**(code **)(*piVar1 + 4))(piVar1,piVar1 + 1);
    piVar1[1] = 0x4479c000;
  }
  *(int *)(this + 0x1c8) = *(int *)(this + 0x1c8) + 1;
  if (local_28 == 0) goto LAB_0087c9c9;
  goto LAB_0087cab0;
}

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)