- we need to wait a bit before starting the intro scene.

The game timer actually starts before the main loop is ready so we have to wait with the cutscene until the loop is in sync with the timer.
This commit is contained in:
Christoph Oelckers 2021-05-01 19:46:17 +02:00
parent 27799def63
commit b21dadeef0
4 changed files with 12 additions and 2 deletions

View file

@ -49,3 +49,4 @@ enum gameaction_t : int
};
extern gamestate_t gamestate;
extern gameaction_t gameaction;
extern int intermissiondelay;

View file

@ -105,6 +105,7 @@ bool r_NoInterpolate;
int entertic;
int oldentertics;
int gametic;
int intermissiondelay;
FString BackupSaveGame;
@ -349,6 +350,11 @@ static void GameTicker()
break;
case GS_INTERMISSION:
case GS_INTRO:
if (intermissiondelay > 0)
{
intermissiondelay--;
break;
}
if (ScreenJobTick())
{
// synchronize termination with the playsim.
@ -393,7 +399,7 @@ void Display()
case GS_INTRO:
case GS_INTERMISSION:
// screen jobs are not bound by the game ticker so they need to be ticked in the display loop.
ScreenJobDraw();
if (intermissiondelay <= 0) ScreenJobDraw();
break;
case GS_LEVEL:

View file

@ -374,6 +374,8 @@ bool StartCutscene(CutsceneDef& cs, int flags, const CompletionFunc& completion_
runner = nullptr;
return false;
}
if (flags & SJ_DELAY) intermissiondelay = 10; // need to wait a bit at the start to let the timer catch up.
else intermissiondelay = 0;
gameaction = (flags & SJ_BLOCKUI) ? ga_intro : ga_intermission;
}
catch (...)
@ -410,7 +412,7 @@ void PlayLogos(gameaction_t complete_ga, gameaction_t def_ga, bool stopmusic)
}
else
{
if (!StartCutscene(globalCutscenes.Intro, SJ_BLOCKUI, [=](bool) {
if (!StartCutscene(globalCutscenes.Intro, SJ_BLOCKUI|SJ_DELAY, [=](bool) {
gameaction = complete_ga;
})) gameaction = def_ga;
}

View file

@ -13,6 +13,7 @@ void Job_Init();
enum
{
SJ_BLOCKUI = 1,
SJ_DELAY = 2,
};
void EndScreenJob();