- add wipe transition support to the screenjob runner.

This commit is contained in:
Christoph Oelckers 2022-04-25 17:32:23 +02:00
parent 4e72ea1cfa
commit 0de3ff81e1
6 changed files with 39 additions and 6 deletions

View file

@ -279,7 +279,7 @@ Wiper_Melt::Wiper_Melt()
bool Wiper_Melt::Run(int ticks) 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); 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. // 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 Wiper_Burn::Run(int ticks)
{ {
bool done; bool done = false;
BurnTime += ticks; BurnTime += ticks;
ticks *= 2; ticks *= 2;
// Make the fire burn // Make the fire burn
done = false;
while (!done && ticks--) while (!done && ticks--)
{ {
Density = wipe_CalcBurn(BurnArray, WIDTH, HEIGHT, Density); Density = wipe_CalcBurn(BurnArray, WIDTH, HEIGHT, Density);

View file

@ -334,6 +334,21 @@ bool StartCutscene(const char* s, int flags, const CompletionFunc& completion)
return StartCutscene(def, flags, 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;
}
//============================================================================= //=============================================================================
// //
// //

View file

@ -34,6 +34,7 @@ struct SystemCallbacks
void (*FontCharCreated)(FGameTexture* base, FGameTexture* untranslated); void (*FontCharCreated)(FGameTexture* base, FGameTexture* untranslated);
void (*ToggleFullConsole)(); void (*ToggleFullConsole)();
void (*StartCutscene)(bool blockui); void (*StartCutscene)(bool blockui);
void (*SetTransition)(int type);
}; };
extern SystemCallbacks sysCallbacks; extern SystemCallbacks sysCallbacks;

View file

@ -2972,6 +2972,11 @@ static void System_StartCutscene(bool blockui)
gameaction = blockui ? ga_intro : ga_intermission; 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); bool CheckSkipGameOptionBlock(const char* str);
@ -3025,6 +3030,7 @@ static int D_DoomMain_Internal (void)
nullptr, nullptr,
System_ToggleFullConsole, System_ToggleFullConsole,
System_StartCutscene, System_StartCutscene,
System_SetTransition,
}; };

View file

@ -25,6 +25,11 @@ class ScreenJob : Object UI
fadeout = 2, fadeout = 2,
stopmusic = 4, stopmusic = 4,
stopsound = 8, 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) void Init(int fflags = 0, float fadet = 250.f)
@ -318,6 +323,8 @@ class ScreenJobRunner : Object UI
int terminateState; int terminateState;
int fadeticks; int fadeticks;
int last_paused_tic; int last_paused_tic;
native static void setTransition(int type);
void Init(bool clearbefore_, bool skipall_) 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].fadestate = !paused && jobs[index].flags & ScreenJob.fadein? ScreenJob.fadein : ScreenJob.visible;
jobs[index].Start(); jobs[index].Start();
if (jobs[index].flags & ScreenJob.transition_mask)
{
setTransition((jobs[index].flags & ScreenJob.transition_mask) >> ScreenJob.Transition_Shift);
}
} }
} }

View file

@ -41,8 +41,9 @@ class StatusScreenJob : ScreenJob
{ {
StatusScreen controller; StatusScreen controller;
ScreenJob Init(StatusScreen scr) ScreenJob Init(StatusScreen scr, bool allowwipe)
{ {
if (allowwipe && wipetype != 0) flags |= wipetype << ScreenJob.transition_shift;
controller = scr; controller = scr;
return self; return self;
} }
@ -75,7 +76,7 @@ class DoomCutscenes ui
} }
if (inter) if (inter)
{ {
runner.Append(new("IntermissionScreenJob").Init(inter)); runner.Append(new("IntermissionScreenJob").Init(inter, status != nullptr));
} }
} }
} }