- 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)
soundEngine->StopAllChannels();
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;
@ -444,7 +444,7 @@ public:
if (sound == -1)
soundEngine->StopAllChannels();
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;
@ -632,7 +632,7 @@ public:
if (sound == -1)
soundEngine->StopAllChannels();
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 terminateState;
int fadeticks = 0;
int last_M_Active_Tic = -1;
int last_paused_tic = -1;
public:
ScreenJobRunner(JobDesc* jobs_, int count, CompletionFunc completion_, bool clearbefore_)
@ -210,7 +210,7 @@ public:
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;
return jobs[index].job->OnEvent(ev);
}
@ -223,6 +223,7 @@ public:
void OnTick()
{
if (paused) return;
if (index >= jobs.Size())
{
//DeleteJobs();
@ -257,9 +258,9 @@ public:
}
// ensure that we won't go back in time if the menu is dismissed without advancing our ticker
bool menuon = M_Active();
if (menuon) last_M_Active_Tic = jobs[index].job->ticks;
else if (last_M_Active_Tic == jobs[index].job->ticks) menuon = true;
bool menuon = paused;
if (menuon) last_paused_tic = jobs[index].job->ticks;
else if (last_paused_tic == jobs[index].job->ticks) menuon = true;
double smoothratio = menuon ? 1. : I_GetTimeFrac();
if (actionState == State_Clear)
@ -343,7 +344,7 @@ void ScreenJobTick()
if (runner) runner->OnTick();
}
void ScreenJobDraw()
bool ScreenJobDraw()
{
// we cannot recover from this because we have no completion callback to call.
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.
if (gameaction == ga_nothing) I_Error("Trying to run a non-existent screen job");
twod->ClearScreen();
return;
return false;
}
auto res = runner->RunFrame();
if (!res)
@ -359,5 +360,6 @@ void ScreenJobDraw()
assert((gamestate != GS_INTERMISSION && gamestate != GS_INTRO) || gameaction != ga_nothing);
DeleteScreenJob();
}
return res;
}

View File

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

View File

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