- properly pause the screen job player if the menu is open.

Still needs a bit of work for movies with embedded streaming sound.
This commit is contained in:
Christoph Oelckers 2021-04-16 22:03:01 +02:00
parent 2942e011bf
commit 1852c0b802
4 changed files with 14 additions and 12 deletions

View file

@ -137,7 +137,7 @@ public:
if (sound == -1) if (sound == -1)
soundEngine->StopAllChannels(); soundEngine->StopAllChannels();
else if (SoundEnabled()) else if (SoundEnabled())
soundEngine->StartSound(SOURCE_None, nullptr, nullptr, CHAN_AUTO, CHANF_UI, sound, 1.f, ATTN_NONE); soundEngine->StartSound(SOURCE_None, nullptr, nullptr, CHAN_AUTO, CHANF_NONE, sound, 1.f, ATTN_NONE);
} }
} }
if (!nostopsound && curframe == numframes && soundEngine->GetSoundPlayingInfo(SOURCE_None, nullptr, -1)) return true; if (!nostopsound && curframe == numframes && soundEngine->GetSoundPlayingInfo(SOURCE_None, nullptr, -1)) return true;
@ -444,7 +444,7 @@ public:
if (sound == -1) if (sound == -1)
soundEngine->StopAllChannels(); soundEngine->StopAllChannels();
else if (SoundEnabled()) else if (SoundEnabled())
soundEngine->StartSound(SOURCE_None, nullptr, nullptr, CHAN_AUTO, CHANF_UI, sound, 1.f, ATTN_NONE); soundEngine->StartSound(SOURCE_None, nullptr, nullptr, CHAN_AUTO, CHANF_NONE, sound, 1.f, ATTN_NONE);
} }
} }
lastsoundframe = soundframe; lastsoundframe = soundframe;
@ -632,7 +632,7 @@ public:
if (sound == -1) if (sound == -1)
soundEngine->StopAllChannels(); soundEngine->StopAllChannels();
else if (SoundEnabled()) else if (SoundEnabled())
soundEngine->StartSound(SOURCE_None, nullptr, nullptr, CHAN_AUTO, CHANF_UI, sound, 1.f, ATTN_NONE); soundEngine->StartSound(SOURCE_None, nullptr, nullptr, CHAN_AUTO, CHANF_NONE, sound, 1.f, ATTN_NONE);
} }
} }
} }

View file

@ -128,7 +128,7 @@ class ScreenJobRunner
int actionState; int actionState;
int terminateState; int terminateState;
int fadeticks = 0; int fadeticks = 0;
int last_M_Active_Tic = -1; int last_paused_tic = -1;
public: public:
ScreenJobRunner(JobDesc* jobs_, int count, CompletionFunc completion_, bool clearbefore_) ScreenJobRunner(JobDesc* jobs_, int count, CompletionFunc completion_, bool clearbefore_)
@ -210,7 +210,7 @@ public:
bool OnEvent(event_t* ev) bool OnEvent(event_t* ev)
{ {
if (index >= jobs.Size()) return false; if (paused || index >= jobs.Size()) return false;
if (jobs[index].job->state != DScreenJob::running) return false; if (jobs[index].job->state != DScreenJob::running) return false;
return jobs[index].job->OnEvent(ev); return jobs[index].job->OnEvent(ev);
} }
@ -223,6 +223,7 @@ public:
void OnTick() void OnTick()
{ {
if (paused) return;
if (index >= jobs.Size()) if (index >= jobs.Size())
{ {
//DeleteJobs(); //DeleteJobs();
@ -257,9 +258,9 @@ public:
} }
// ensure that we won't go back in time if the menu is dismissed without advancing our ticker // ensure that we won't go back in time if the menu is dismissed without advancing our ticker
bool menuon = M_Active(); bool menuon = paused;
if (menuon) last_M_Active_Tic = jobs[index].job->ticks; if (menuon) last_paused_tic = jobs[index].job->ticks;
else if (last_M_Active_Tic == jobs[index].job->ticks) menuon = true; else if (last_paused_tic == jobs[index].job->ticks) menuon = true;
double smoothratio = menuon ? 1. : I_GetTimeFrac(); double smoothratio = menuon ? 1. : I_GetTimeFrac();
if (actionState == State_Clear) if (actionState == State_Clear)
@ -343,7 +344,7 @@ void ScreenJobTick()
if (runner) runner->OnTick(); if (runner) runner->OnTick();
} }
void ScreenJobDraw() bool ScreenJobDraw()
{ {
// we cannot recover from this because we have no completion callback to call. // we cannot recover from this because we have no completion callback to call.
if (!runner) if (!runner)
@ -351,7 +352,7 @@ void ScreenJobDraw()
// We can get here before a gameaction has been processed. In that case just draw a black screen and wait. // We can get here before a gameaction has been processed. In that case just draw a black screen and wait.
if (gameaction == ga_nothing) I_Error("Trying to run a non-existent screen job"); if (gameaction == ga_nothing) I_Error("Trying to run a non-existent screen job");
twod->ClearScreen(); twod->ClearScreen();
return; return false;
} }
auto res = runner->RunFrame(); auto res = runner->RunFrame();
if (!res) if (!res)
@ -359,5 +360,6 @@ void ScreenJobDraw()
assert((gamestate != GS_INTERMISSION && gamestate != GS_INTRO) || gameaction != ga_nothing); assert((gamestate != GS_INTERMISSION && gamestate != GS_INTRO) || gameaction != ga_nothing);
DeleteScreenJob(); DeleteScreenJob();
} }
return res;
} }

View file

@ -143,7 +143,7 @@ void EndScreenJob();
void DeleteScreenJob(); void DeleteScreenJob();
bool ScreenJobResponder(event_t* ev); bool ScreenJobResponder(event_t* ev);
void ScreenJobTick(); void ScreenJobTick();
void ScreenJobDraw(); bool ScreenJobDraw();
struct AnimSound struct AnimSound
{ {

View file

@ -193,7 +193,7 @@ static void Intermission(MapRecord *from_map, MapRecord *to_map)
gameaction = ga_nextlevel; gameaction = ga_nextlevel;
} }
}, true, true); });
} }
} }