L L4D2node

CDirector::UpdateScenarioState

0x00887e10 · 1235 bytes · __thiscall

_ZN9CDirector19UpdateScenarioStateEv

Decompiled

undefined (1 param)

/* CDirector::UpdateScenarioState() */

void __thiscall CDirector::UpdateScenarioState(CDirector *this)

{
  char cVar1;
  longdouble lVar2;
  int local_30;
  undefined4 local_2c;
  undefined4 local_28;
  undefined1 local_24;
  int local_20;
  undefined4 local_1c;
  char *local_18;
  undefined1 local_14;
  int local_10;
  
  if (*(float *)(this + 0x270) <= 0.0) {
    if (this[0x4e7] != (CDirector)0x0) {
      return;
    }
    if (0.0 < *(float *)(this + 0x27c)) {
      lVar2 = (longdouble)CountdownTimer::Now();
      if (*(float *)(this + 0x27c) <= (float)lVar2) {
        if (*(float *)(this + 0x27c) != -1.0) {
          (**(code **)(*(int *)(this + 0x274) + 4))(this + 0x274,this + 0x27c);
          *(undefined4 *)(this + 0x27c) = 0xbf800000;
        }
        ExitScenario(this);
        return;
      }
    }
    cVar1 = CheckConvarForcedRestart(this);
    if (cVar1 != '\0') {
      return;
    }
    lVar2 = (longdouble)CountdownTimer::Now();
    if ((float)lVar2 < *(float *)(this + 0x264)) {
      return;
    }
    lVar2 = (longdouble)CountdownTimer::Now();
    if ((float)lVar2 + 1.0 != *(float *)(this + 0x264)) {
      (**(code **)(*(int *)(this + 0x25c) + 4))(this + 0x25c,this + 0x264);
      *(float *)(this + 0x264) = (float)lVar2 + 1.0;
    }
    if (*(float *)(this + 0x260) != 1.0) {
      (**(code **)(*(int *)(this + 0x25c) + 4))(this + 0x25c,this + 0x260);
      *(undefined4 *)(this + 0x260) = 0x3f800000;
    }
    CDirectorVersusMode::VersusUpdateScenarioState(*(CDirectorVersusMode **)(this + 0x63c));
    if ((((this[0x280] != (CDirector)0x0) && (this[0x282] != (CDirector)0x0)) &&
        (cVar1 = CTerrorGameRules::HasPlayerControlledZombies(), cVar1 != '\0')) &&
       ((*(int *)(AllowAllBotGame._28_4_ + 0x30) == 0 &&
        (lVar2 = (longdouble)CountdownTimer::Now(), *(float *)(this + 0x4f0) <= (float)lVar2)))) {
      local_30 = 0;
      ForEachTerrorPlayer<TransitioningPlayerCounter>((TransitioningPlayerCounter *)&local_30);
      if (local_30 == 0) {
        local_28 = 2;
        local_24 = 0;
        local_20 = 0;
        local_2c = 0xffffffff;
        ForEachPlayer<PlayerCounter>((PlayerCounter *)&local_2c);
        local_18 = (char *)0x3;
        local_14 = 0;
        local_10 = 0;
        local_1c = 0xffffffff;
        ForEachPlayer<PlayerCounter>((PlayerCounter *)&local_1c);
        if (((local_20 == 0) && (*(int *)(allow_all_bot_survivor_team._28_4_ + 0x30) == 0)) ||
           (local_10 == 0)) {
          CTerrorGameRules::IsVersusMode();
          if (0.0 < *(float *)(this + 0x270)) {
            return;
          }
          EndScenario();
          return;
        }
      }
    }
    if ((**(int **)(this + 0x638) != 5) && (*(int *)(this + 0x164) == 3)) {
      if (**(int **)(this + 0x638) != 1) {
        return;
      }
      EndLocalScript(this);
      return;
    }
    cVar1 = CTerrorGameRules::IsScavengeMode();
    if (cVar1 != '\0') {
      CDirectorScavengeMode::ScavengeUpdateScenarioState(*(CDirectorScavengeMode **)(this + 0x644));
    }
    if (*(int *)(DirectorNoDeathCheck._28_4_ + 0x30) != 0) {
      return;
    }
    CheckForDeadPlayers(this);
    return;
  }
  if ((this[0x4e4] == (CDirector)0x0) ||
     (lVar2 = (longdouble)CountdownTimer::Now(),
     (*(float *)(this + 0x26c) - *(float *)(this + 0x270)) + (float)lVar2 <= 1.0))
  goto LAB_00887e3a;
  cVar1 = CTerrorGameRules::IsSurvivalMode();
  if (cVar1 == '\0') {
    cVar1 = CTerrorGameRules::IsScavengeMode();
    if (cVar1 != '\0') {
      local_18 = "fullscreen_scavenge_scoreboard";
      goto LAB_0088802c;
    }
    cVar1 = CTerrorGameRules::IsChallengeModeActive(g_pGameRules);
    if (cVar1 != '\0') {
      CDirectorChallengeMode::ShowRoundEndScoreboard(*(CDirectorChallengeMode **)(this + 0x648));
    }
  }
  else {
    local_18 = "fullscreen_survival_scoreboard";
LAB_0088802c:
    local_1c = 0xffffffff;
    local_14 = 1;
    local_10 = 0;
    ForEachTerrorPlayer<CShowViewportPanel>((CShowViewportPanel *)&local_1c);
  }
  this[0x4e4] = (CDirector)0x0;
LAB_00887e3a:
  lVar2 = (longdouble)CountdownTimer::Now();
  if (*(float *)(this + 0x270) <= (float)lVar2) {
    if (*(float *)(this + 0x270) != -1.0) {
      (**(code **)(*(int *)(this + 0x268) + 4))(this + 0x268,this + 0x270);
      *(undefined4 *)(this + 0x270) = 0xbf800000;
    }
    switch(*(undefined4 *)(this + 0x284)) {
    case 5:
    case 8:
      CDirectorVersusMode::RestartVsMode(*(CDirectorVersusMode **)(this + 0x63c));
      break;
    default:
      RestartScenario(this);
      break;
    case 7:
      CDirectorVersusMode::RestartVersusLevelOnVote(*(CDirectorVersusMode **)(this + 0x63c));
      break;
    case 9:
    case 10:
    case 0xd:
      CDirectorScavengeMode::RestartScavengeRound(*(CDirectorScavengeMode **)(this + 0x644));
      break;
    case 0xc:
      CDirectorScavengeMode::OnScavengeMatchFinished();
      break;
    case 0xe:
    case 0x10:
      CDirectorSurvivalMode::RestartSurvivalRound(*(CDirectorSurvivalMode **)(this + 0x640));
    }
  }
  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)