diff --git a/src/g_level.cpp b/src/g_level.cpp index 94b507e7a..17d1366ea 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -904,7 +904,6 @@ DIntermissionController* FLevelLocals::CreateIntermission() ext->mDefined & FExitText::DEF_LOOKUP, false); } - if (controller) controller->mEndGame = false; return controller; } @@ -936,14 +935,11 @@ DIntermissionController* FLevelLocals::CreateIntermission() } } } - if (controller) controller->mEndGame = endgame; return controller; } void RunIntermission(DIntermissionController* intermissionScreen, DObject* statusScreen, std::function completionf) { - D_StartTitle(); - if (!intermissionScreen && !statusScreen) { completionf(false); @@ -1014,12 +1010,12 @@ void G_DoCompleted (void) statusScreen = WI_Start (&staticWmInfo); } - bool endgame = intermissionScreen && intermissionScreen->mEndGame; + bool endgame = strncmp(nextlevel, "enDSeQ", 6) == 0; intermissionScreen = primaryLevel->CreateIntermission(); RunIntermission(intermissionScreen, statusScreen, [=](bool) { if (!endgame) primaryLevel->WorldDone(); - else if (!intermissionScreen) D_StartTitle(); + else D_StartTitle(); }); } diff --git a/src/intermission/intermission.cpp b/src/intermission/intermission.cpp index cd4c0c32e..e82ef2a60 100644 --- a/src/intermission/intermission.cpp +++ b/src/intermission/intermission.cpp @@ -834,7 +834,7 @@ void DIntermissionScreenScroller::Drawer () // //========================================================================== -DIntermissionController::DIntermissionController(FIntermissionDescriptor *Desc, bool DeleteDesc) +DIntermissionController::DIntermissionController(FIntermissionDescriptor *Desc, bool DeleteDesc, bool ending) { mDesc = Desc; mDeleteDesc = DeleteDesc; @@ -843,6 +843,7 @@ DIntermissionController::DIntermissionController(FIntermissionDescriptor *Desc, mSentAdvance = false; mScreen = nullptr; mFirst = true; + mEndGame = ending; } bool DIntermissionController::NextPage () @@ -852,8 +853,8 @@ bool DIntermissionController::NextPage () if (mIndex == (int)mDesc->mActions.Size() && mDesc->mLink == NAME_None) { - // last page - return false; + // last page (must block when ending the game.) + return mEndGame; } bg.SetInvalid(); @@ -872,7 +873,7 @@ again: } else if (action->mClass == TITLE_ID) { - continue; + return false; } else { @@ -950,7 +951,7 @@ bool DIntermissionController::Ticker () mAdvance = false; if (!NextPage()) { - return false; + return !false; } } return true; @@ -980,14 +981,14 @@ void DIntermissionController::OnDestroy () // //========================================================================== -DIntermissionController* F_StartIntermission(FIntermissionDescriptor *desc, bool deleteme) +DIntermissionController* F_StartIntermission(FIntermissionDescriptor *desc, bool deleteme, bool ending) { ScaleOverrider s(twod); S_StopAllChannels (); gameaction = ga_nothing; gamestate = GS_FINALE; //if (state == FSTATE_InLevel) wipegamestate = GS_FINALE; // don't wipe when within a level. - auto CurrentIntermission = Create(desc, deleteme); + auto CurrentIntermission = Create(desc, deleteme, ending); // If the intermission finishes straight away then cancel the wipe. if (!CurrentIntermission->NextPage()) diff --git a/src/intermission/intermission.h b/src/intermission/intermission.h index 2d731a359..db2e76ecb 100644 --- a/src/intermission/intermission.h +++ b/src/intermission/intermission.h @@ -301,7 +301,7 @@ class DIntermissionController : public DObject public: bool mEndGame; - DIntermissionController(FIntermissionDescriptor *mDesc = NULL, bool mDeleteDesc = false); + DIntermissionController(FIntermissionDescriptor *mDesc = NULL, bool mDeleteDesc = false, bool ending = false); bool Responder (FInputEvent *ev); bool Ticker (); void Drawer (); @@ -313,7 +313,7 @@ public: // Interface for main loop -DIntermissionController* F_StartIntermission(FIntermissionDescriptor *desc, bool deleteme); +DIntermissionController* F_StartIntermission(FIntermissionDescriptor *desc, bool deleteme, bool ending = false); DIntermissionController* F_StartIntermission(FName desc); // Create an intermission from old cluster data diff --git a/src/intermission/intermission_parse.cpp b/src/intermission/intermission_parse.cpp index bda635448..087397895 100644 --- a/src/intermission/intermission_parse.cpp +++ b/src/intermission/intermission_parse.cpp @@ -911,14 +911,14 @@ DIntermissionController* F_StartFinale (const char *music, int musicorder, int c desc->mActions.Push(wiper); } - return F_StartIntermission(desc, true); + return F_StartIntermission(desc, true, ending && endsequence != NAME_None); } else if (ending) { FIntermissionDescriptor **pdesc = IntermissionDescriptors.CheckKey(endsequence); if (pdesc != NULL) { - return F_StartIntermission(*pdesc, false); + return F_StartIntermission(*pdesc, false, ending); } } return nullptr; diff --git a/wadsrc/static/zscript/ui/statscreen/statscreen.zs b/wadsrc/static/zscript/ui/statscreen/statscreen.zs index 27892bd36..567cf0e6f 100644 --- a/wadsrc/static/zscript/ui/statscreen/statscreen.zs +++ b/wadsrc/static/zscript/ui/statscreen/statscreen.zs @@ -681,7 +681,6 @@ class StatusScreen : ScreenJob abstract version("2.5") if (cnt == 0) { End(); - Level.WorldDone(); } } @@ -693,11 +692,11 @@ class StatusScreen : ScreenJob abstract version("2.5") protected virtual void initShowNextLoc () { + Console.Printf("Next m ap = %s", wbs.next); if (wbs.next == "") { // Last map in episode - there is no next location! - End(); - Level.WorldDone(); + jobstate = finished; return; }