diff --git a/src/common/2d/wipe.cpp b/src/common/2d/wipe.cpp index 7de5f1cf7..78079f47a 100644 --- a/src/common/2d/wipe.cpp +++ b/src/common/2d/wipe.cpp @@ -279,7 +279,7 @@ Wiper_Melt::Wiper_Melt() bool Wiper_Melt::Run(int ticks) { - bool done; + bool done = false; DrawTexture(twod, endScreen, 0, 0, DTA_FlipY, screen->RenderTextureIsFlipped(), DTA_Masked, false, TAG_DONE); // Copy the old screen in vertical strips on top of the new one. @@ -366,14 +366,13 @@ Wiper_Burn::~Wiper_Burn() bool Wiper_Burn::Run(int ticks) { - bool done; - + bool done = false; + BurnTime += ticks; ticks *= 2; // Make the fire burn - done = false; while (!done && ticks--) { Density = wipe_CalcBurn(BurnArray, WIDTH, HEIGHT, Density); diff --git a/src/common/cutscenes/screenjob.cpp b/src/common/cutscenes/screenjob.cpp index 28e0d682c..840b9f55e 100644 --- a/src/common/cutscenes/screenjob.cpp +++ b/src/common/cutscenes/screenjob.cpp @@ -334,6 +334,21 @@ bool StartCutscene(const char* s, int flags, const CompletionFunc& completion) return StartCutscene(def, flags, completion); } +//============================================================================= +// +// initiates a screen wipe. Needs to call the game code for it. +// +//============================================================================= + +DEFINE_ACTION_FUNCTION(DScreenJobRunner, setTransition) +{ + PARAM_PROLOGUE; + PARAM_INT(type); + + if (type && sysCallbacks.SetTransition) sysCallbacks.SetTransition(type); + return 0; +} + //============================================================================= // // diff --git a/src/common/engine/i_interface.h b/src/common/engine/i_interface.h index dd3ea5862..be3651886 100644 --- a/src/common/engine/i_interface.h +++ b/src/common/engine/i_interface.h @@ -34,6 +34,7 @@ struct SystemCallbacks void (*FontCharCreated)(FGameTexture* base, FGameTexture* untranslated); void (*ToggleFullConsole)(); void (*StartCutscene)(bool blockui); + void (*SetTransition)(int type); }; extern SystemCallbacks sysCallbacks; diff --git a/src/d_main.cpp b/src/d_main.cpp index a8f0db37a..d0f0005b7 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -2972,6 +2972,11 @@ static void System_StartCutscene(bool blockui) gameaction = blockui ? ga_intro : ga_intermission; } +static void System_SetTransition(int type) +{ + if (type != wipe_None) wipegamestate = type == wipe_Burn? GS_FORCEWIPEBURN : type == wipe_Fade? GS_FORCEWIPEFADE : GS_FORCEWIPEMELT; +} + bool CheckSkipGameOptionBlock(const char* str); @@ -3025,6 +3030,7 @@ static int D_DoomMain_Internal (void) nullptr, System_ToggleFullConsole, System_StartCutscene, + System_SetTransition, }; diff --git a/wadsrc/static/zscript/engine/screenjob.zs b/wadsrc/static/zscript/engine/screenjob.zs index 0b64e55c4..e11234fd9 100644 --- a/wadsrc/static/zscript/engine/screenjob.zs +++ b/wadsrc/static/zscript/engine/screenjob.zs @@ -25,6 +25,11 @@ class ScreenJob : Object UI fadeout = 2, stopmusic = 4, stopsound = 8, + transition_shift = 4, + transition_mask = 48, + transition_melt = 16, + transition_burn = 32, + transition_crossfade = 48, }; void Init(int fflags = 0, float fadet = 250.f) @@ -318,6 +323,8 @@ class ScreenJobRunner : Object UI int terminateState; int fadeticks; int last_paused_tic; + + native static void setTransition(int type); void Init(bool clearbefore_, bool skipall_) { @@ -379,6 +386,10 @@ class ScreenJobRunner : Object UI { jobs[index].fadestate = !paused && jobs[index].flags & ScreenJob.fadein? ScreenJob.fadein : ScreenJob.visible; jobs[index].Start(); + if (jobs[index].flags & ScreenJob.transition_mask) + { + setTransition((jobs[index].flags & ScreenJob.transition_mask) >> ScreenJob.Transition_Shift); + } } } diff --git a/wadsrc/static/zscript/ui/intermission.zs b/wadsrc/static/zscript/ui/intermission.zs index 2c4c8895c..76032aeb0 100644 --- a/wadsrc/static/zscript/ui/intermission.zs +++ b/wadsrc/static/zscript/ui/intermission.zs @@ -41,8 +41,9 @@ class StatusScreenJob : ScreenJob { StatusScreen controller; - ScreenJob Init(StatusScreen scr) + ScreenJob Init(StatusScreen scr, bool allowwipe) { + if (allowwipe && wipetype != 0) flags |= wipetype << ScreenJob.transition_shift; controller = scr; return self; } @@ -75,7 +76,7 @@ class DoomCutscenes ui } if (inter) { - runner.Append(new("IntermissionScreenJob").Init(inter)); + runner.Append(new("IntermissionScreenJob").Init(inter, status != nullptr)); } } }