L L4D2node

CDirectorSurvivalMode::OnEndScenarioNonVirtual

0x008bfc30 · 1127 bytes · __thiscall

_ZN21CDirectorSurvivalMode23OnEndScenarioNonVirtualEP26EndScenarioGameEventInfo_t

Decompiled

undefined (2 params)

/* CDirectorSurvivalMode::OnEndScenarioNonVirtual(EndScenarioGameEventInfo_t*) */

undefined4 __thiscall
CDirectorSurvivalMode::OnEndScenarioNonVirtual
          (CDirectorSurvivalMode *this,EndScenarioGameEventInfo_t *param_1)

{
  float fVar1;
  int iVar2;
  int iVar3;
  longdouble lVar4;
  undefined4 local_50;
  char *local_4c;
  undefined1 local_48;
  undefined4 local_44;
  undefined4 local_40;
  undefined4 local_3c;
  undefined4 local_38;
  undefined4 local_34;
  int local_30 [8];
  
  iVar3 = *(int *)param_1;
  if (iVar3 == 0xf) {
    if (((this[2] != (CDirectorSurvivalMode)0x0) && (0.0 < *(float *)(this + 0x34))) &&
       (g_pGameRules != (CTerrorGameRules *)0x0)) {
      CTerrorGameRules::SetRoundEndTime(g_pGameRules,*(float *)(gpGlobals + 0xc));
      ForEachTerrorPlayer<UpdateBestSurvivalTime>((UpdateBestSurvivalTime *)&local_40,true);
      lVar4 = (longdouble)CTerrorGameRules::GetRoundDuration(g_pGameRules,2);
      *(float *)(param_1 + 0xc) = (float)lVar4;
    }
    iVar2 = TheDirector;
    iVar3 = TheDirector + 0x268;
    lVar4 = (longdouble)CountdownTimer::Now();
    if ((float)lVar4 + 3.0 != *(float *)(iVar2 + 0x270)) {
      (**(code **)(*(int *)(iVar2 + 0x268) + 4))(iVar3,iVar2 + 0x270);
      *(float *)(iVar2 + 0x270) = (float)lVar4 + 3.0;
    }
    if (*(float *)(iVar2 + 0x26c) != 3.0) {
      (**(code **)(*(int *)(iVar2 + 0x268) + 4))(iVar3,iVar2 + 0x26c);
      *(undefined4 *)(iVar2 + 0x26c) = 0x40400000;
    }
    *this = (CDirectorSurvivalMode)0x0;
    local_30[0] = 0;
    local_30[1] = 0;
    local_30[2] = 0;
    local_30[3] = 0;
    local_30[4] = 0;
    local_40 = 0xffffffff;
    local_3c = 2;
    local_38 = 3;
    local_34 = 9;
                    /* try { // try from 008bff57 to 008bffa9 has its CatchHandler @ 008c00bd */
    ForEachPlayer<PlayerCollector>((PlayerCollector *)&local_40);
    iVar3 = 0;
    if (0 < local_30[3]) {
      do {
        CBaseEntity::AddFlag(*(CBaseEntity **)(local_30[0] + iVar3 * 4),0x20);
        iVar3 = iVar3 + 1;
      } while (iVar3 < local_30[3]);
    }
    local_50 = 0xffffffff;
    local_4c = "survival_shutting_down";
    local_48 = 1;
    local_44 = 0;
    ForEachTerrorPlayer<CShowViewportPanel>((CShowViewportPanel *)&local_50);
  }
  else {
    if (iVar3 != 0x10) {
      if (iVar3 == 0xe) {
        if (((this[2] != (CDirectorSurvivalMode)0x0) && (0.0 < *(float *)(this + 0x34))) &&
           (g_pGameRules != (CTerrorGameRules *)0x0)) {
          CTerrorGameRules::SetRoundEndTime(g_pGameRules,*(float *)(gpGlobals + 0xc));
          ForEachTerrorPlayer<UpdateBestSurvivalTime>((UpdateBestSurvivalTime *)&local_40,true);
          lVar4 = (longdouble)CTerrorGameRules::GetRoundDuration(g_pGameRules,2);
          *(float *)(param_1 + 0xc) = (float)lVar4;
        }
        iVar2 = TheDirector;
        iVar3 = TheDirector + 0x268;
        fVar1 = *(float *)(SurvivalRoundRestartDelay._28_4_ + 0x2c);
        lVar4 = (longdouble)CountdownTimer::Now();
        if ((float)lVar4 + fVar1 != *(float *)(iVar2 + 0x270)) {
          (**(code **)(*(int *)(iVar2 + 0x268) + 4))(iVar3,iVar2 + 0x270);
          *(float *)(iVar2 + 0x270) = (float)lVar4 + fVar1;
        }
        if (fVar1 != *(float *)(iVar2 + 0x26c)) {
          (**(code **)(*(int *)(iVar2 + 0x268) + 4))(iVar3,iVar2 + 0x26c);
          *(float *)(iVar2 + 0x26c) = fVar1;
        }
        *this = (CDirectorSurvivalMode)0x0;
        *(char **)(param_1 + 8) = "#L4D_Scenario_Restart";
        return 1;
      }
      return 0;
    }
    if (((this[2] != (CDirectorSurvivalMode)0x0) && (0.0 < *(float *)(this + 0x34))) &&
       (g_pGameRules != (CTerrorGameRules *)0x0)) {
      CTerrorGameRules::SetRoundEndTime(g_pGameRules,*(float *)(gpGlobals + 0xc));
    }
    iVar2 = TheDirector;
    iVar3 = TheDirector + 0x268;
    lVar4 = (longdouble)CountdownTimer::Now();
    if ((float)lVar4 + 3.0 != *(float *)(iVar2 + 0x270)) {
      (**(code **)(*(int *)(iVar2 + 0x268) + 4))(iVar3,iVar2 + 0x270);
      *(float *)(iVar2 + 0x270) = (float)lVar4 + 3.0;
    }
    if (*(float *)(iVar2 + 0x26c) != 3.0) {
      (**(code **)(*(int *)(iVar2 + 0x268) + 4))(iVar3,iVar2 + 0x26c);
      *(undefined4 *)(iVar2 + 0x26c) = 0x40400000;
    }
    *this = (CDirectorSurvivalMode)0x0;
    local_30[0] = 0;
    local_30[1] = 0;
    local_30[2] = 0;
    local_30[3] = 0;
    local_30[4] = 0;
    local_40 = 0xffffffff;
    local_3c = 2;
    local_38 = 3;
    local_34 = 9;
                    /* try { // try from 008bfdff to 008bfe25 has its CatchHandler @ 008c00d2 */
    ForEachPlayer<PlayerCollector>((PlayerCollector *)&local_40);
    iVar3 = 0;
    if (0 < local_30[3]) {
      do {
        CBaseEntity::AddFlag(*(CBaseEntity **)(local_30[0] + iVar3 * 4),0x20);
        iVar3 = iVar3 + 1;
      } while (iVar3 < local_30[3]);
    }
  }
  local_30[3] = 0;
  CUtlMemory<CTerrorPlayer*,int>::Purge((CUtlMemory<CTerrorPlayer*,int> *)local_30);
  local_30[4] = local_30[0];
  CUtlMemory<CTerrorPlayer*,int>::Purge((CUtlMemory<CTerrorPlayer*,int> *)local_30);
  return 1;
}

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)