L L4D2node

CDirectorScriptedEventManager::OnFinaleStarted

0x008bb3d0 · 2184 bytes · __thiscall

_ZN29CDirectorScriptedEventManager15OnFinaleStartedE12FinaleType_t

Decompiled

undefined (2 params)

/* CDirectorScriptedEventManager::OnFinaleStarted(FinaleType_t) */

void __thiscall
CDirectorScriptedEventManager::OnFinaleStarted
          (CDirectorScriptedEventManager *this,undefined4 param_2)

{
  CDirectorScriptedEventManager *pCVar1;
  float fVar2;
  code *pcVar3;
  char cVar4;
  int iVar5;
  uint uVar6;
  CBaseEntity *this_00;
  int iVar7;
  int *piVar8;
  TerrorNavArea *pTVar9;
  undefined4 uVar10;
  KeyValues *this_01;
  char *pcVar11;
  undefined1 *puVar12;
  int in_GS_OFFSET;
  bool bVar13;
  longdouble lVar14;
  undefined1 local_130 [4];
  undefined1 local_12c [4];
  int local_128;
  int local_124;
  char local_120 [256];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  if (*(int *)this != 5) {
    UTIL_LogPrintf("%3.2f: Director::OnFinaleStarted: ERROR - Finale already started.\n",
                   (double)*(float *)(gpGlobals + 0xc));
    goto LAB_008bb40e;
  }
  UTIL_LogPrintf("%3.2f: Director::OnFinaleStarted: Finale started.\n",
                 (double)*(float *)(gpGlobals + 0xc));
  this[0x88] = (CDirectorScriptedEventManager)0x0;
  this[0x89] = (CDirectorScriptedEventManager)0x0;
  *(undefined4 *)this = param_2;
  iVar5 = 1;
  if (0 < *(int *)(TheDirector + 0x420)) {
    iVar5 = *(int *)(TheDirector + 0x420);
  }
  *(int *)(TheDirector + 0x420) = iVar5;
  iVar5 = TheNextBots();
  uVar6 = (uint)*(ushort *)(iVar5 + 0x10);
  if (uVar6 != 0xffff) {
    iVar7 = *(int *)(iVar5 + 4);
    do {
      piVar8 = *(int **)(iVar7 + uVar6 * 8);
      this_00 = (CBaseEntity *)(**(code **)(*piVar8 + 0xb4))(piVar8);
      cVar4 = (**(code **)(*(int *)this_00 + 300))(this_00);
      if (((cVar4 != '\0') &&
          (iVar7 = __dynamic_cast(piVar8,&INextBot::typeinfo,&Witch::typeinfo,0x1a3c), iVar7 == 0))
         && (iVar7 = CBaseEntity::GetTeamNumber(this_00), iVar7 != 4)) {
        piVar8 = (int *)(**(code **)(*piVar8 + 0xc4))(piVar8);
        cVar4 = (**(code **)(*piVar8 + 0x114))(piVar8);
        if (cVar4 == '\0') {
          pTVar9 = (TerrorNavArea *)(**(code **)(*(int *)this_00 + 0x52c))(this_00);
          cVar4 = CDirectorTacticalServices::IsVisibleToTeam
                            (*(CDirectorTacticalServices **)(TheDirector + 0x628),this_00,2,0,0.0,
                             pTVar9);
          if (cVar4 == '\0') {
            cVar4 = (**(code **)(*(int *)this_00 + 0x16c))(this_00);
            if (cVar4 == '\0') {
              UTIL_Remove(this_00);
            }
            else {
              pcVar3 = *(code **)(*engine + 0x94);
              cVar4 = (**(code **)(*(int *)this_00 + 0x16c))(this_00);
              if (cVar4 == '\0') {
                this_00 = (CBaseEntity *)0x0;
              }
              uVar10 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this_00 + 0x30));
              UTIL_VarArgs("kickid %d removing bots before the finale\n",uVar10);
              (*pcVar3)(engine);
            }
          }
        }
      }
      iVar7 = *(int *)(iVar5 + 4);
      uVar6 = (uint)*(ushort *)(iVar7 + 6 + uVar6 * 8);
    } while (uVar6 != 0xffff);
  }
  pCVar1 = this + 0x90;
  *(undefined4 *)(TheZombieManager + 0x210) = 0;
  UTIL_LogPrintf("%3.2f: ZombieManager::ClearPendingMobCount: All mobs cleared.\n",
                 (double)*(float *)(gpGlobals + 0xc));
  ZombieManager::OnFinaleStart(TheZombieManager);
  bVar13 = *(int *)this != 1;
  ChangeFinaleStage(this,(-(uint)bVar13 & 0xfffffff5) + 0xc);
  if (*(float *)(this + 0x98) != -1.0) {
    (**(code **)(*(int *)(this + 0x90) + 4))(pCVar1,this + 0x98);
    *(undefined4 *)(this + 0x98) = 0xbf800000;
  }
  *(undefined4 *)(this + 0x100) = 0;
  if (*(float *)(this + 0x10c) == -1.0) {
    if (bVar13) goto LAB_008bb6c4;
LAB_008bb9d6:
    CDirector::BeginLocalScript(TheDirector,"director_gauntlet");
  }
  else {
    (**(code **)(*(int *)(this + 0x104) + 4))(this + 0x104,this + 0x10c);
    *(undefined4 *)(this + 0x10c) = 0xbf800000;
    if (!bVar13) goto LAB_008bb9d6;
LAB_008bb6c4:
    if (*(int *)this - 2U < 3) {
      puVar12 = &DAT_00d539c2;
      if (*(undefined1 **)(gpGlobals + 0x3c) != (undefined1 *)0x0) {
        puVar12 = *(undefined1 **)(gpGlobals + 0x3c);
      }
      V_snprintf(local_120,0x100,"%s_finale",puVar12);
      CDirector::RunScript(TheDirector,local_120,1,0);
      lVar14 = (longdouble)IntervalTimer::Now();
      if ((float)lVar14 != *(float *)(this + 0xc0)) {
        (**(code **)(*(int *)(this + 0xbc) + 4))(this + 0xbc,this + 0xc0);
        *(float *)(this + 0xc0) = (float)lVar14;
      }
      *(undefined4 *)(this + 0xe8) = 0;
      *(undefined4 *)(this + 0xec) = 0;
      if (*(float *)(this + 0xfc) != -1.0) {
        (**(code **)(*(int *)(this + 0xf4) + 4))(this + 0xf4,this + 0xfc);
        *(undefined4 *)(this + 0xfc) = 0xbf800000;
      }
      cVar4 = (**(code **)(*(int *)TheDirector + 100))(TheDirector);
      if (cVar4 != '\0') {
        this[0xf0] = (CDirectorScriptedEventManager)0x0;
        *(undefined4 *)(this + 0xe4) = 0;
      }
      ChangeFinaleStage(this,10);
      fVar2 = *(float *)(DirectorFinaleStageDelay._28_4_ + 0x2c);
      lVar14 = (longdouble)CountdownTimer::Now();
      if ((float)lVar14 + fVar2 != *(float *)(this + 0x98)) {
        (**(code **)(*(int *)(this + 0x90) + 4))(pCVar1,this + 0x98);
        *(float *)(this + 0x98) = (float)lVar14 + fVar2;
      }
      if (fVar2 != *(float *)(this + 0x94)) {
        (**(code **)(*(int *)(this + 0x90) + 4))(pCVar1,this + 0x94);
        *(float *)(this + 0x94) = fVar2;
      }
      pcVar11 = *(char **)(gpGlobals + 0x3c);
      if (pcVar11 == (char *)0x0) {
        pcVar11 = "";
LAB_008bb860:
        iVar5 = _V_stricmp(pcVar11,"c1m4_atrium");
        if (iVar5 != 0) goto LAB_008bb898;
      }
      else if (pcVar11 != "c1m4_atrium") goto LAB_008bb860;
      GetCurrentDate(local_130,local_12c,&local_128);
      GetCurrentDayOfTheYear(&local_124);
      if (((0x7d9 < local_128) || (0x14a < local_124)) &&
         ((local_124 + -0x14b + (local_128 + -0x7d9) * 0x16d) % 0xf == 0)) {
        ZombieManager::StartJimmyTimer(TheZombieManager);
      }
    }
    else {
      StartPanicEvent(this,*(int *)(DirectorFinalePanicWaves._28_4_ + 0x30),(CBasePlayer *)0x0);
    }
  }
LAB_008bb898:
  UTIL_LogPrintf("%3.2f: Director: Finale state = FINALE_HORDE_ATTACK_1\n",
                 (double)*(float *)(gpGlobals + 0xc));
  this[0x8b] = (CDirectorScriptedEventManager)0x0;
  if (*(int *)this == 1) {
    piVar8 = (int *)(**(code **)(*gameeventmanager + 0x1c))
                              (gameeventmanager,"gauntlet_finale_start",0,0);
    fVar2 = *(float *)(TheDirector + 0x24c);
    lVar14 = (longdouble)
             CDirector::GetScriptValue
                       (TheDirector,"GauntletMovementThreshold",
                        *(float *)(DirectorPrivate_DirectorGauntletMovementThreshold._28_4_ + 0x2c))
    ;
    uVar10 = DirectorPrivate_DirectorGauntletMovementTimerLength._28_4_;
    *(float *)(this + 0x9c) = (float)lVar14 + fVar2;
    lVar14 = (longdouble)
             CDirector::GetScriptValue
                       (TheDirector,"GauntletMovementTimerLength",*(float *)(uVar10 + 0x2c));
    fVar2 = (float)lVar14;
    lVar14 = (longdouble)CountdownTimer::Now();
    if ((float)lVar14 + fVar2 != *(float *)(this + 0xac)) {
      (**(code **)(*(int *)(this + 0xa4) + 4))(this + 0xa4,this + 0xac);
      *(float *)(this + 0xac) = (float)lVar14 + fVar2;
    }
    if (fVar2 != *(float *)(this + 0xa8)) {
      (**(code **)(*(int *)(this + 0xa4) + 4))(this + 0xa4,this + 0xa8);
      *(float *)(this + 0xa8) = fVar2;
    }
    *(undefined4 *)(this + 0xa0) = 0;
    if (*(float *)(this + 0xb8) != -1.0) {
      (**(code **)(*(int *)(this + 0xb0) + 4))(this + 0xb0,this + 0xb8);
      *(undefined4 *)(this + 0xb8) = 0xbf800000;
    }
  }
  else {
    piVar8 = (int *)(**(code **)(*gameeventmanager + 0x1c))(gameeventmanager,"finale_start");
  }
  if (piVar8 != (int *)0x0) {
    this_01 = (KeyValues *)CTerrorGameRules::GetMissionInfo();
    puVar12 = &DAT_00d539c2;
    if (this_01 != (KeyValues *)0x0) {
      puVar12 = (undefined1 *)KeyValues::GetString(this_01,"Name","");
    }
    (**(code **)(*piVar8 + 0x3c))(piVar8,"campaign",puVar12);
    (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar8,0);
  }
  ForEachTerrorPlayer<FinaleStart>((FinaleStart *)&local_124);
LAB_008bb40e:
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail();
}

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)