- switched intro movie playing over to the new system

Not tested yet.
This commit is contained in:
Christoph Oelckers 2021-04-26 22:56:37 +02:00
parent af8d06994a
commit 1166b00af2
11 changed files with 69 additions and 120 deletions

View File

@ -193,16 +193,13 @@ void AddGenericVideo(DObject* runner, const FString& fn, int soundid, int fps)
void CutsceneDef::Create(DObject* runner)
{
if (function.CompareNoCase("none") != 0)
if (function.IsNotEmpty())
{
if (function.IsNotEmpty())
{
CallCreateFunction(function, runner);
}
else if (video.IsNotEmpty())
{
AddGenericVideo(runner, video, sound, framespersec);
}
CallCreateFunction(function, runner);
}
else if (video.IsNotEmpty())
{
AddGenericVideo(runner, video, sound, framespersec);
}
}
@ -212,12 +209,17 @@ void CutsceneDef::Create(DObject* runner)
//
//=============================================================================
void StartCutscene(CutsceneDef& cs, int flags, CompletionFunc completion_)
bool StartCutscene(CutsceneDef& cs, int flags, CompletionFunc completion_)
{
completion = completion_;
runner = CreateRunner();
cs.Create(runner);
gameaction = (flags & SJ_BLOCKUI) ? ga_intro : ga_intermission;
if (cs.function.CompareNoCase("none") != 0)
{
completion = completion_;
runner = CreateRunner();
cs.Create(runner);
gameaction = (flags & SJ_BLOCKUI) ? ga_intro : ga_intermission;
return true;
}
return false;
}
@ -291,3 +293,48 @@ void ScreenJobDraw()
}
}
}
void PlayLogos(gameaction_t complete_ga, gameaction_t def_ga, bool stopmusic)
{
Mus_Stop();
FX_StopAllSounds(); // JBF 20031228
if (userConfig.nologo)
{
gameaction = def_ga;
}
else
{
if (!StartCutscene(globalCutscenes.Intro, SJ_BLOCKUI, [=](bool) { gameaction = complete_ga; })) gameaction = def_ga;
}
}
/*
Duke:
if (!userConfig.nologo) fi.ShowLogo([](bool) { gameaction = ga_mainmenunostopsound; });
else gameaction = ga_mainmenunostopsound;
Blood:
if (!userConfig.nologo && gGameOptions.nGameType == 0) playlogos();
else
{
gameaction = ga_mainmenu;
}
RunScreenJob(jobs, [](bool) {
Mus_Stop();
gameaction = ga_mainmenu;
}, SJ_BLOCKUI);
Exhumed:
if (!userConfig.nologo) DoTitle([](bool) { gameaction = ga_mainmenu; });
else gameaction = ga_mainmenu;
SW:
if (!userConfig.nologo) Logo([](bool)
{
gameaction = ga_mainmenunostopsound;
});
else gameaction = ga_mainmenu;
*/

View File

@ -4,6 +4,7 @@
#include "v_2ddrawer.h"
#include "d_eventbase.h"
#include "s_soundinternal.h"
#include "gamestate.h"
using CompletionFunc = std::function<void(bool)>;
struct JobDesc;
@ -195,3 +196,5 @@ void DeleteScreenJob();
bool ScreenJobResponder(event_t* ev);
bool ScreenJobTick();
void ScreenJobDraw();
void PlayLogos(gameaction_t complete_ga, gameaction_t def_ga, bool stopmusic);

View File

@ -528,11 +528,7 @@ void GameInterface::Startup()
}
else
{
if (!userConfig.nologo && gGameOptions.nGameType == 0) playlogos();
else
{
gameaction = ga_mainmenu;
}
PlayLogos(ga_mainmenu, ga_mainmenu, true);
}
}

View File

@ -145,39 +145,6 @@ static void BigText(double x, double y, const char* text, int align = -1, double
DrawText(twod, BigFont, CR_UNTRANSLATED, x, y - 12, text, DTA_FullscreenScale, FSMode_Fit320x200, DTA_Alpha, alpha, TAG_DONE);
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void Logo_d(const CompletionFunc &completion)
{
#if 0
Mus_Stop();
FX_StopAllSounds(); // JBF 20031228
static const AnimSound logosound[] =
{
{ 1, FLY_BY+1 },
{ 19, PIPEBOMB_EXPLODE+1 },
{ -1, -1 }
};
static const int logoframetimes[] = { 9, 9, 9 };
TArray<DScreenJob*> jobs;
int job = 0;
if (!userConfig.nologo)
{
if (!isShareware()) jobs.Push(PlayVideo("logo.anm", logosound, logoframetimes));
if (!isNam()) jobs.Push(Create<DDRealmsScreen>());
}
jobs.Push(Create<DTitleScreen>());
RunScreenJob(jobs, completion, SJ_BLOCKUI);
#endif
}
//---------------------------------------------------------------------------
//
//

View File

@ -139,59 +139,6 @@ static void BigText(double x, double y, const char* text, int align, double alph
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void Logo_r(const CompletionFunc& completion)
{
#if 0
Mus_Stop();
FX_StopAllSounds(); // JBF 20031228
static const AnimSound introsound[] =
{
{ 1, 29+1 },
{ -1, -1 }
};
static const AnimSound rednecksound[] =
{
{ 1, 478+1 },
{ -1, -1 }
};
static const AnimSound xatrixsound[] =
{
{ 1, 479+1 },
{ -1, -1 }
};
static const int framespeed[] = { 9, 9, 9 }; // same for all 3 anims
TArray<DScreenJob*> jobs;
if (userConfig.nologo)
{
completion(false);
return;
}
else if (!isRRRA())
{
jobs.Push(PlayVideo("rr_intro.anm", introsound, framespeed));
jobs.Push(PlayVideo("redneck.anm", rednecksound, framespeed));
jobs.Push(PlayVideo("xatlogo.anm", xatrixsound, framespeed));
}
else
{
jobs.Push(PlayVideo("redint.mve"));
}
RunScreenJob(jobs, completion, SJ_BLOCKUI);
#endif
}
#if 0
//---------------------------------------------------------------------------
//

View File

@ -105,8 +105,6 @@ void think_r();
void animatesprites_d(int x, int y, int a, int smoothratio);
void animatesprites_r(int x, int y, int a, int smoothratio);
void Logo_d(const CompletionFunc&);
void Logo_r(const CompletionFunc&);
void InitFonts_d();
void InitFonts_r();
void PrintPaused_d();
@ -120,7 +118,6 @@ void SetDispatcher()
if (!isRR())
{
fi = {
Logo_d,
InitFonts_d,
PrintPaused_d,
@ -167,7 +164,6 @@ void SetDispatcher()
else
{
fi = {
Logo_r,
InitFonts_r,
PrintPaused_r,

View File

@ -71,7 +71,6 @@ struct GameInterface : public ::GameInterface
struct Dispatcher
{
// global stuff
void (*ShowLogo)(const CompletionFunc& completion);
void (*InitFonts)();
void (*PrintPaused)();

View File

@ -133,8 +133,7 @@ void GameInterface::Startup()
}
else
{
if (!userConfig.nologo) fi.ShowLogo([](bool) { gameaction = ga_mainmenunostopsound; });
else gameaction = ga_mainmenunostopsound;
PlayLogos(ga_mainmenunostopsound, ga_mainmenunostopsound, false);
}
}

View File

@ -167,8 +167,7 @@ void GameInterface::Startup()
}
else
{
if (!userConfig.nologo) DoTitle([](bool) { gameaction = ga_mainmenu; });
else gameaction = ga_mainmenu;
PlayLogos(ga_mainmenu, ga_mainmenu, false);
}
}

View File

@ -650,11 +650,7 @@ void GameInterface::Startup()
}
else
{
if (!userConfig.nologo) Logo([](bool)
{
gameaction = ga_mainmenunostopsound;
});
else gameaction = ga_mainmenu;
PlayLogos(ga_mainmenunostopsound, ga_mainmenu, false);
}
}

View File

@ -47,7 +47,7 @@ class ScreenJob : Object
int DrawFrame(double smoothratio)
{
if (jobstate != running) smoothratio = 1; // this is necessary because the ticker won't be incremented anymore to avoid having a negative time span.
if (jobstate != running) smoothratio = 1; // this is necessary to avoid having a negative time span because the ticker won't be incremented anymore.
Draw(smoothratio);
if (jobstate == skipped) return -1;
if (jobstate == finished) return 0;