- use flags instead of bools.

This commit is contained in:
Christoph Oelckers 2021-04-22 00:18:53 +02:00
parent af3eac8456
commit fb5e2fe0c0
7 changed files with 19 additions and 12 deletions

View file

@ -317,14 +317,14 @@ public:
ScreenJobRunner *runner;
void RunScreenJob(JobDesc* jobs, int count, CompletionFunc completion, bool clearbefore, bool blockingui, bool skipall)
void RunScreenJob(JobDesc* jobs, int count, CompletionFunc completion, int flags)
{
assert(completion != nullptr);
videoclearFade();
if (count)
{
runner = new ScreenJobRunner(jobs, count, completion, clearbefore, skipall);
gameaction = blockingui? ga_intro : ga_intermission;
runner = new ScreenJobRunner(jobs, count, completion, !(flags & SJ_DONTCLEAR), !!(flags & SJ_SKIPALL));
gameaction = (flags & SJ_BLOCKUI)? ga_intro : ga_intermission;
}
else
{

View file

@ -138,8 +138,15 @@ struct JobDesc
//bool ignoreifskipped;
};
enum
{
SJ_DONTCLEAR = 1,
SJ_BLOCKUI = 2,
SJ_SKIPALL = 4
};
void RunScreenJob(JobDesc *jobs, int count, CompletionFunc completion, bool clearbefore = true, bool blockingui = false, bool skipall = false);
void RunScreenJob(JobDesc *jobs, int count, CompletionFunc completion, int flags = 0);
void EndScreenJob();
void DeleteScreenJob();
bool ScreenJobResponder(event_t* ev);

View file

@ -89,7 +89,7 @@ void playlogos()
RunScreenJob(jobs, job, [](bool) {
Mus_Stop();
gameaction = ga_mainmenu;
}, true, true);
}, SJ_BLOCKUI);
}
void playSmk(const char *smk, const char *wav, int wavid, CompletionFunc func)

View file

@ -307,7 +307,7 @@ void Logo_d(const CompletionFunc &completion)
}
else S_PlaySpecialMusic(MUS_INTRO);
jobs[job++] = { Create<DTitleScreen>(), []() { S_PlaySound(NITEVISION_ONOFF, CHAN_AUTO, CHANF_UI); } };
RunScreenJob(jobs, job, completion, true, true);
RunScreenJob(jobs, job, completion, SJ_BLOCKUI);
}
//---------------------------------------------------------------------------
@ -1131,7 +1131,7 @@ void e4intro(const CompletionFunc& completion)
jobs[job++] = { PlayVideo("vol41a.anm", vol41a, framespeed_10), nullptr };
jobs[job++] = { PlayVideo("vol42a.anm", vol42a, framespeed_14), nullptr };
jobs[job++] = { PlayVideo("vol43a.anm", vol43a, framespeed_10), nullptr };
RunScreenJob(jobs, job, completion, true, false, true);
RunScreenJob(jobs, job, completion, SJ_SKIPALL);
}
//---------------------------------------------------------------------------

View file

@ -204,7 +204,7 @@ void Logo_r(const CompletionFunc& completion)
{
jobs[job++] = { PlayVideo("redint.mve"), nullptr };
}
RunScreenJob(jobs, job, completion, true, true);
RunScreenJob(jobs, job, completion, SJ_BLOCKUI);
}
//---------------------------------------------------------------------------

View file

@ -528,7 +528,7 @@ void DoTitle(CompletionFunc completion)
jobs[job++] = { PlayMovie("book.mov") };
jobs[job++] = { Create<DMainTitle>() };
RunScreenJob(jobs, job, completion, true, true);
RunScreenJob(jobs, job, completion, SJ_BLOCKUI);
}

View file

@ -92,7 +92,7 @@ void Logo(const CompletionFunc& completion)
int job = 0;
jobs[job++] = { Create<DSWDRealmsScreen>() };
jobs[job++] = { PlayVideo("sw.anm", logosound, logoframetimes, true)};
RunScreenJob(jobs, job, completion, true, true);
RunScreenJob(jobs, job, completion, SJ_BLOCKUI);
}
else completion(false);
}
@ -623,7 +623,7 @@ void StatScreen(int FinishAnim, CompletionFunc completion)
{
jobs[job++] = { Create<DSWMultiSummaryScreen>() };
}
RunScreenJob(jobs, job, completion, true);
RunScreenJob(jobs, job, completion);
}
//---------------------------------------------------------------------------
@ -638,7 +638,7 @@ void SybexScreen(CompletionFunc completion)
else
{
JobDesc job = { Create<DImageScreen>(tileGetTexture(5261), DScreenJob::fadein | DScreenJob::fadeout, 0x7fffffff) };
RunScreenJob(&job, 1, completion, true, true);
RunScreenJob(&job, 1, completion, SJ_BLOCKUI);
}
}