L L4D2node

CDirectorScriptedEventManager::UpdateSacrificeFinaleFailure

0x008bc490 · 1001 bytes · __thiscall

_ZN29CDirectorScriptedEventManager28UpdateSacrificeFinaleFailureEv

Decompiled

undefined (1 param)

/* CDirectorScriptedEventManager::UpdateSacrificeFinaleFailure() */

void __thiscall
CDirectorScriptedEventManager::UpdateSacrificeFinaleFailure(CDirectorScriptedEventManager *this)

{
  int *piVar1;
  char cVar2;
  char *pcVar3;
  KeyValues *this_00;
  CDirectorScriptedEventManager CVar4;
  int iVar5;
  longdouble lVar6;
  char *in_stack_ffffff78;
  float local_70;
  undefined4 local_64;
  undefined4 local_60;
  undefined4 local_5c;
  undefined4 local_58;
  undefined4 local_54;
  undefined4 local_50;
  undefined4 local_4c;
  int local_48;
  undefined4 local_44;
  undefined4 local_40;
  undefined4 local_3c;
  undefined4 local_38;
  undefined4 local_34;
  int local_30 [8];
  
  if (this[0x140] == (CDirectorScriptedEventManager)0x0) {
    return;
  }
  if (TheDirector[0x280] == (CDirector)0x0) {
    return;
  }
  if (0.0 < *(float *)(TheDirector + 0x270)) {
    return;
  }
  cVar2 = CTerrorGameRules::IsVersusMode();
  if ((cVar2 != '\0') && (*(char *)(*(int *)(TheDirector + 0x63c) + 4) == '\0')) {
    return;
  }
  cVar2 = CTerrorGameRules::IsSoloMode();
  if (cVar2 != '\0') {
    return;
  }
  CVar4 = (CDirectorScriptedEventManager)0x1;
  if (this[0x141] == (CDirectorScriptedEventManager)0x0) {
    CVar4 = this[0x142];
  }
  cVar2 = CDirectorVersusMode::InFinaleMap(*(CDirectorVersusMode **)(TheDirector + 0x63c));
  if (((((cVar2 == '\0') || (TheDirector[0x161] == (CDirector)0x0)) ||
       (CVar4 != (CDirectorScriptedEventManager)0x0)) || (*(int *)(TheDirector + 0x3ec) != 0)) ||
     ((*(int *)this == 5 && (*(char *)(*(int *)(TheDirector + 0x63c) + 4) == '\0'))))
  goto LAB_008bc620;
  local_54 = 0;
  local_50 = 0;
  local_4c = 0;
  local_48 = 0;
  local_44 = 0;
  local_64 = 2;
  local_60 = 2;
  local_5c = 2;
  local_58 = 9;
                    /* try { // try from 008bc59b to 008bc59f has its CatchHandler @ 008bc8a2 */
  ForEachSurvivor<PlayerCollector>((PlayerCollector *)&local_64);
  local_30[0] = 0;
  local_30[1] = 0;
  local_30[2] = 0;
  local_30[3] = 0;
  local_30[4] = 0;
  local_40 = 2;
  local_3c = 2;
  local_38 = 1;
  local_34 = 9;
                    /* try { // try from 008bc5e5 to 008bc5e9 has its CatchHandler @ 008bc882 */
  ForEachSurvivor<PlayerCollector>((PlayerCollector *)&local_40);
  if (local_30[3] < 1) {
                    /* try { // try from 008bc863 to 008bc87f has its CatchHandler @ 008bc882 */
    DevMsg("DLC3 Finale failed: Less than 1 player alive.\n");
LAB_008bc868:
    this[0x142] = (CDirectorScriptedEventManager)0x1;
  }
  else if (local_30[3] + local_48 < 2) {
    DevMsg("DLC3 Finale failed: Less than 2 survivors alive.\n");
    goto LAB_008bc868;
  }
  CUtlVector<CTerrorPlayer*,CUtlMemory<CTerrorPlayer*,int>>::~CUtlVector
            ((CUtlVector<CTerrorPlayer*,CUtlMemory<CTerrorPlayer*,int>> *)local_30);
  CUtlVector<CTerrorPlayer*,CUtlMemory<CTerrorPlayer*,int>>::~CUtlVector
            ((CUtlVector<CTerrorPlayer*,CUtlMemory<CTerrorPlayer*,int>> *)&local_54);
LAB_008bc620:
  if (this[0x142] != (CDirectorScriptedEventManager)0x0) {
    if (*(float *)(this + 0x14c) <= 0.0) {
      cVar2 = CTerrorGameRules::IsVersusMode();
      local_70 = 2.0;
      if (cVar2 != '\0') {
        local_70 = 5.0;
      }
      lVar6 = (longdouble)CountdownTimer::Now();
      if ((float)lVar6 + local_70 != *(float *)(this + 0x14c)) {
        in_stack_ffffff78 = (char *)(this + 0x14c);
        (**(code **)(*(int *)(this + 0x144) + 4))(this + 0x144);
        *(float *)(this + 0x14c) = (float)lVar6 + local_70;
      }
      if (local_70 != *(float *)(this + 0x148)) {
        in_stack_ffffff78 = (char *)(this + 0x148);
        (**(code **)(*(int *)(this + 0x144) + 4))(this + 0x144);
        *(float *)(this + 0x148) = local_70;
      }
      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 = 7;
      local_38 = 1;
      local_34 = 9;
                    /* try { // try from 008bc741 to 008bc788 has its CatchHandler @ 008bc8a6 */
      ForEachPlayer<PlayerCollector>((PlayerCollector *)&local_40);
      if (0 < local_30[3]) {
        iVar5 = 0;
        do {
          piVar1 = *(int **)(local_30[0] + iVar5 * 4);
          cVar2 = CDirector::IsFinaleVehicleReady(TheDirector);
          pcVar3 = "resource/ui/riverescapefailed.res";
          if (cVar2 == '\0') {
            pcVar3 = "resource/ui/riverfinalefailed.res";
          }
          this_00 = KeyValues::operator_new((KeyValues *)0x2c,(uint)in_stack_ffffff78);
                    /* try { // try from 008bc7a6 to 008bc7aa has its CatchHandler @ 008bc8bb */
          KeyValues::KeyValues(this_00,"data",(IKeyValuesSystem *)0x0,false);
                    /* try { // try from 008bc7bd to 008bc7e8 has its CatchHandler @ 008bc8a6 */
          KeyValues::SetString(this_00,"res",pcVar3);
          in_stack_ffffff78 = "info_window";
          (**(code **)(*piVar1 + 0x580))(piVar1,"info_window",1,this_00);
          KeyValues::deleteThis();
          iVar5 = iVar5 + 1;
        } while (iVar5 < 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);
    }
    else {
      lVar6 = (longdouble)CountdownTimer::Now();
      if ((*(float *)(this + 0x14c) <= (float)lVar6) && (TheDirector[0x280] != (CDirector)0x0)) {
        CDirector::InitiateEndScenario(TheDirector);
      }
    }
  }
  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)