From fb5e2fe0c03f1f2bc955ca0fd2f59e6ca854d892 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 22 Apr 2021 00:18:53 +0200 Subject: [PATCH] - use flags instead of bools. --- source/core/screenjob.cpp | 6 +++--- source/core/screenjob.h | 9 ++++++++- source/games/blood/src/credits.cpp | 2 +- source/games/duke/src/2d_d.cpp | 4 ++-- source/games/duke/src/2d_r.cpp | 2 +- source/games/exhumed/src/2d.cpp | 2 +- source/games/sw/src/2d.cpp | 6 +++--- 7 files changed, 19 insertions(+), 12 deletions(-) diff --git a/source/core/screenjob.cpp b/source/core/screenjob.cpp index 8f132a5ee..628378b27 100644 --- a/source/core/screenjob.cpp +++ b/source/core/screenjob.cpp @@ -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 { diff --git a/source/core/screenjob.h b/source/core/screenjob.h index 7d90de300..733a8e6f8 100644 --- a/source/core/screenjob.h +++ b/source/core/screenjob.h @@ -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); diff --git a/source/games/blood/src/credits.cpp b/source/games/blood/src/credits.cpp index 90f9cbc9d..98e37caf2 100644 --- a/source/games/blood/src/credits.cpp +++ b/source/games/blood/src/credits.cpp @@ -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) diff --git a/source/games/duke/src/2d_d.cpp b/source/games/duke/src/2d_d.cpp index d3142086c..f59ff35dd 100644 --- a/source/games/duke/src/2d_d.cpp +++ b/source/games/duke/src/2d_d.cpp @@ -307,7 +307,7 @@ void Logo_d(const CompletionFunc &completion) } else S_PlaySpecialMusic(MUS_INTRO); jobs[job++] = { Create(), []() { 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); } //--------------------------------------------------------------------------- diff --git a/source/games/duke/src/2d_r.cpp b/source/games/duke/src/2d_r.cpp index c59c28bb6..a7350a928 100644 --- a/source/games/duke/src/2d_r.cpp +++ b/source/games/duke/src/2d_r.cpp @@ -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); } //--------------------------------------------------------------------------- diff --git a/source/games/exhumed/src/2d.cpp b/source/games/exhumed/src/2d.cpp index 2acd24315..7c0b8da0f 100644 --- a/source/games/exhumed/src/2d.cpp +++ b/source/games/exhumed/src/2d.cpp @@ -528,7 +528,7 @@ void DoTitle(CompletionFunc completion) jobs[job++] = { PlayMovie("book.mov") }; jobs[job++] = { Create() }; - RunScreenJob(jobs, job, completion, true, true); + RunScreenJob(jobs, job, completion, SJ_BLOCKUI); } diff --git a/source/games/sw/src/2d.cpp b/source/games/sw/src/2d.cpp index 9c982f0c6..92cc36ccf 100644 --- a/source/games/sw/src/2d.cpp +++ b/source/games/sw/src/2d.cpp @@ -92,7 +92,7 @@ void Logo(const CompletionFunc& completion) int job = 0; jobs[job++] = { Create() }; 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() }; } - RunScreenJob(jobs, job, completion, true); + RunScreenJob(jobs, job, completion); } //--------------------------------------------------------------------------- @@ -638,7 +638,7 @@ void SybexScreen(CompletionFunc completion) else { JobDesc job = { Create(tileGetTexture(5261), DScreenJob::fadein | DScreenJob::fadeout, 0x7fffffff) }; - RunScreenJob(&job, 1, completion, true, true); + RunScreenJob(&job, 1, completion, SJ_BLOCKUI); } }