- tested all of Duke's and RR's cutscenes.

This commit is contained in:
Christoph Oelckers 2021-04-27 00:01:25 +02:00
parent 06abc0cfe2
commit 3c27ec8cbd
13 changed files with 86 additions and 56 deletions

View file

@ -138,6 +138,10 @@ void S_StopCustomStream(SoundStream *stream)
void S_PauseAllCustomStreams(bool on) void S_PauseAllCustomStreams(bool on)
{ {
static bool paused = false;
if (paused == on) return;
paused = on;
for (auto s : customStreams) for (auto s : customStreams)
{ {
s->SetPaused(on); s->SetPaused(on);

View file

@ -416,10 +416,8 @@ DEFINE_ACTION_FUNCTION_NATIVE(FDynArray_I32, Push, ArrayPush<FDynArray_I32 COMMA
DEFINE_ACTION_FUNCTION(FDynArray_I32, PushV) DEFINE_ACTION_FUNCTION(FDynArray_I32, PushV)
{ {
PARAM_SELF_STRUCT_PROLOGUE(FDynArray_I32); PARAM_SELF_STRUCT_PROLOGUE(FDynArray_I32);
PARAM_INT(val);
PARAM_VA_POINTER(va_reginfo); // Get the hidden type information array PARAM_VA_POINTER(va_reginfo); // Get the hidden type information array
self->Push(val); VMVa_List args = { param + 1, 0, numparam - 2, va_reginfo + 1 };
VMVa_List args = { param + 3, 0, numparam - 4, va_reginfo + 3 };
while (args.curindex < args.numargs) while (args.curindex < args.numargs)
{ {
if (args.reginfo[args.curindex] == REGT_INT) if (args.reginfo[args.curindex] == REGT_INT)

View file

@ -337,8 +337,7 @@ DEFINE_ACTION_FUNCTION(_TexMan, GetName)
static int CheckForTexture(const FString& name, int type, int flags) static int CheckForTexture(const FString& name, int type, int flags)
{ {
// ForceLookup is intentionally blocked here, this flag is for internal use only. return TexMan.CheckForTexture(name, static_cast<ETextureType>(type), flags).GetIndex();
return TexMan.CheckForTexture(name, static_cast<ETextureType>(type), (flags & ~FTextureManager::TEXMAN_ForceLookup)).GetIndex();
} }
DEFINE_ACTION_FUNCTION_NATIVE(_TexMan, CheckForTexture, CheckForTexture) DEFINE_ACTION_FUNCTION_NATIVE(_TexMan, CheckForTexture, CheckForTexture)

View file

@ -223,6 +223,13 @@ bool StartCutscene(CutsceneDef& cs, int flags, CompletionFunc completion_)
return false; return false;
} }
bool StartCutscene(const char* s, int flags, CompletionFunc completion)
{
CutsceneDef def;
def.function = s;
return StartCutscene(def, 0, completion);
}
void DeleteScreenJob() void DeleteScreenJob()
{ {
@ -311,6 +318,28 @@ void PlayLogos(gameaction_t complete_ga, gameaction_t def_ga, bool stopmusic)
} }
} }
CCMD(testcutscene)
{
if (argv.argc() < 2)
{
Printf("Usage: testcutscene <buildfunction>\n");
return;
}
try
{
CutsceneDef def;
def.function = argv[1];
if (StartCutscene(def, 0, [](bool) { }))
{
C_HideConsole();
}
}
catch (const CRecoverableError& err)
{
Printf("Unable to play cutscene\n");
}
}
/* /*
Duke: Duke:
if (!userConfig.nologo) fi.ShowLogo([](bool) { gameaction = ga_mainmenunostopsound; }); if (!userConfig.nologo) fi.ShowLogo([](bool) { gameaction = ga_mainmenunostopsound; });

View file

@ -200,4 +200,7 @@ bool ScreenJobResponder(event_t* ev);
bool ScreenJobTick(); bool ScreenJobTick();
void ScreenJobDraw(); void ScreenJobDraw();
struct CutsceneDef;
bool StartCutscene(CutsceneDef& cs, int flags, CompletionFunc completion);
bool StartCutscene(const char* s, int flags, CompletionFunc completion);
void PlayLogos(gameaction_t complete_ga, gameaction_t def_ga, bool stopmusic); void PlayLogos(gameaction_t complete_ga, gameaction_t def_ga, bool stopmusic);

View file

@ -145,34 +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); DrawText(twod, BigFont, CR_UNTRANSLATED, x, y - 12, text, DTA_FullscreenScale, FSMode_Fit320x200, DTA_Alpha, alpha, TAG_DONE);
} }
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void showtwoscreens(const CompletionFunc& completion)
{
#if 0
TArray<DScreenJob*> jobs;
jobs.Push(Create<DImageScreen>(3291));
jobs.Push(Create<DImageScreen>(3290));
RunScreenJob(jobs, completion);
#endif
}
void doorders(const CompletionFunc& completion)
{
#if 0
TArray<DScreenJob*> jobs;
for (int i = 0; i < 4; i++)
jobs.Push(Create<DImageScreen>(ORDERING + i));
RunScreenJob(jobs, completion);
#endif
}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
// //

View file

@ -162,9 +162,6 @@ int hits(DDukeActor* snum);
DDukeActor* LocateTheLocator(int n, int sectnum); DDukeActor* LocateTheLocator(int n, int sectnum);
void clearcamera(player_struct* ps); void clearcamera(player_struct* ps);
void showtwoscreens(const CompletionFunc& func);
void doorders(const CompletionFunc& func);
void LoadActor(DDukeActor* i, int p, int x); void LoadActor(DDukeActor* i, int p, int x);
void execute(DDukeActor* s, int p, int d); void execute(DDukeActor* s, int p, int d);
void makeitfall(DDukeActor* s); void makeitfall(DDukeActor* s);

View file

@ -94,20 +94,20 @@ void GameInterface::ExitFromMenu()
{ {
auto runbonus = [=](auto completion) auto runbonus = [=](auto completion)
{ {
// MP scoreboard // MP scoreboard
if (playerswhenstarted > 1 && !ud.coop) if (playerswhenstarted > 1 && !ud.coop)
{ {
dobonus(1, completion); dobonus(1, completion);
} }
else completion(false); else completion(false);
}; };
auto runtwoscreens = [](auto completion) auto runtwoscreens = [](auto completion)
{ {
// shareware and TEN screens // shareware and TEN screens
if (isShareware() && !isRR()) if (isShareware() && !isRR())
showtwoscreens(completion); StartCutscene("DukeCutscenes.BuildSharewareExit", 0, completion);
else completion(false); else completion(false);
}; };
runbonus([=](bool aborted) { runtwoscreens(endthegame); }); runbonus([=](bool aborted) { runtwoscreens(endthegame); });

View file

@ -926,7 +926,6 @@ void enterlevel(MapRecord *mi, int gamemode)
OnEvent(EVENT_ENTERLEVEL); OnEvent(EVENT_ENTERLEVEL);
// Stop all sounds // Stop all sounds
S_ResumeSound(false);
FX_StopAllSounds(); FX_StopAllSounds();
FX_SetReverb(0); FX_SetReverb(0);
@ -1078,7 +1077,7 @@ void exitlevel(MapRecord *nextlevel)
if (ud.multimode < 2) if (ud.multimode < 2)
{ {
if (isShareware()) if (isShareware())
doorders([](bool) { gameaction = ga_startup; }); StartCutscene("DukeCutscenes.BuildSharewareOrder", 0, [](bool) { gameaction = ga_startup; });
else gameaction = ga_startup; else gameaction = ga_startup;
return; return;
} }

View file

@ -0,0 +1,25 @@
// Cutscene definitions for Duke
definecutscene intro
{
function RRCutscenes.BuildIntro
}
definecutscene map e1l7 // episode 1
{
outro
{
function RRCutscenes.BuildE1End
}
}
definecutscene episode 2
{
outro
{
function RRCutscenes.BuildE2End
}
}
definecutscene summary RRCutscenes.BuildSPSummary
definecutscene mpsummary DukeCutscenes.BuildMPSummary // identical with Duke's

View file

@ -181,14 +181,14 @@ class DukeCutscenes // Note: must be class, not struct, otherwise we cannot easi
12, DukeSnd.SHORT_CIRCUIT + 1, 12, DukeSnd.SHORT_CIRCUIT + 1,
18, DukeSnd.INTRO4_5 + 1, 18, DukeSnd.INTRO4_5 + 1,
34, DukeSnd.SHORT_CIRCUIT + 1); 34, DukeSnd.SHORT_CIRCUIT + 1);
runner.Append(MoviePlayerJob.CreateWithSoundinfo("vol41a1.anm", soundinfo, 0, 10, 10, 10)); runner.Append(MoviePlayerJob.CreateWithSoundinfo("vol41a.anm", soundinfo, MoviePlayer.NOSOUNDCUTOFF, 10, 10, 10));
soundinfo.Pushv( soundinfo.Pushv(
1, DukeSnd.INTRO4_1 + 1, 1, DukeSnd.INTRO4_1 + 1,
7, DukeSnd.INTRO4_3 + 1, 7, DukeSnd.INTRO4_3 + 1,
12, DukeSnd.INTRO4_2 + 1, 12, DukeSnd.INTRO4_2 + 1,
26, DukeSnd.INTRO4_4 + 1); 26, DukeSnd.INTRO4_4 + 1);
runner.Append(MoviePlayerJob.CreateWithSoundinfo("vol42a.anm", soundinfo, 0, 14, 14, 14)); runner.Append(MoviePlayerJob.CreateWithSoundinfo("vol42a.anm", soundinfo, MoviePlayer.NOSOUNDCUTOFF, 14, 14, 14));
soundinfo.Pushv( soundinfo.Pushv(
10, DukeSnd.INTRO4_6 + 1); 10, DukeSnd.INTRO4_6 + 1);
@ -322,7 +322,7 @@ class RRCutscenes
{ {
Array<int> soundinfo; Array<int> soundinfo;
soundinfo.Pushv(1, RRSnd.LN_FINAL + 1); soundinfo.Pushv(1, RRSnd.LN_FINAL + 1);
runner.Append(MoviePlayerJob.CreateWithSoundinfo("rr_outro.anm", soundinfo, 0, 9, 9, 9)); runner.Append(MoviePlayerJob.CreateWithSoundinfo("rr_outro.anm", soundinfo, MoviePlayer.NOSOUNDCUTOFF, 9, 9, 9));
runner.Append(ImageScreen.CreateNamed("TENSCREEN")); runner.Append(ImageScreen.CreateNamed("TENSCREEN"));
} }
else else

View file

@ -412,11 +412,11 @@ class Episode4Text : SkippableScreenJob
override void Draw(double sm) override void Draw(double sm)
{ {
Screen.ClearScreen(); Screen.ClearScreen();
Duke.BigText(160, 60, "$Thanks to all our"); Duke.BigText(160, 60, "$Thanks to all our", 0);
Duke.BigText(160, 60 + 16, "$fans for giving"); Duke.BigText(160, 60 + 16, "$fans for giving", 0);
Duke.BigText(160, 60 + 16 + 16, "$us big heads."); Duke.BigText(160, 60 + 16 + 16, "$us big heads.", 0);
Duke.BigText(160, 70 + 16 + 16 + 16, "$Look for a Duke Nukem 3D"); Duke.BigText(160, 70 + 16 + 16 + 16, "$Look for a Duke Nukem 3D", 0);
Duke.BigText(160, 70 + 16 + 16 + 16 + 16, "$sequel soon."); Duke.BigText(160, 70 + 16 + 16 + 16 + 16, "$sequel soon.", 0);
} }
override void Start() override void Start()

View file

@ -437,7 +437,7 @@ class ScreenJobRunner : Object
virtual bool OnEvent(InputEvent ev) virtual bool OnEvent(InputEvent ev)
{ {
if (paused || index >= jobs.Size()) return false; if (paused || index < 0 || index >= jobs.Size()) return false;
if (jobs[index].jobstate != ScreenJob.running) return false; if (jobs[index].jobstate != ScreenJob.running) return false;
return jobs[index].OnEvent(ev); return jobs[index].OnEvent(ev);
} }
@ -481,6 +481,10 @@ class ScreenJobRunner : Object
virtual bool RunFrame(double smoothratio) virtual bool RunFrame(double smoothratio)
{ {
if (index < 0)
{
AdvanceJob(false);
}
// 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
if (index < jobs.Size()) if (index < jobs.Size())
{ {