From 88dfb938659b72d7bc00643be2e26dcbb67c8f05 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 26 Apr 2021 01:20:49 +0200 Subject: [PATCH] - redid Duke cutscene code to use functions, not classes as exports and added the missing screens. Functions are better because they allow doing more in the internal setup code. --- source/games/duke/src/2d_d.cpp | 118 --------- source/games/duke/src/namelist_d.h | 5 + .../static/zscript/games/duke/ui/cutscenes.zs | 245 +++++++++++------- wadsrc/static/zscript/screenjob.zs | 9 +- 4 files changed, 169 insertions(+), 208 deletions(-) diff --git a/source/games/duke/src/2d_d.cpp b/source/games/duke/src/2d_d.cpp index 407459072..3ec25ccaa 100644 --- a/source/games/duke/src/2d_d.cpp +++ b/source/games/duke/src/2d_d.cpp @@ -178,124 +178,6 @@ void Logo_d(const CompletionFunc &completion) } -#if 0 -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - -static void bonussequence_d(int num, TArray& jobs) -{ - static const AnimSound cineov2sound[] = - { - { 1, WIND_AMBIENCE+1 }, - { 26, ENDSEQVOL2SND1+1 }, - { 36, ENDSEQVOL2SND2+1 }, - { 54, THUD+1 }, - { 62, ENDSEQVOL2SND3+1 }, - { 75, ENDSEQVOL2SND4 + 1 }, - { 81, ENDSEQVOL2SND5 + 1 }, - { 115, ENDSEQVOL2SND6 + 1 }, - { 124, ENDSEQVOL2SND7 + 1 }, - { -1, -1 } - }; - - static const AnimSound cineov3sound[] = - { - { 1, WIND_REPEAT + 1 }, - { 98, DUKE_GRUNT + 1 }, - { 102, THUD + 1 }, - { 102, SQUISHED + 1 }, - { 124, ENDSEQVOL3SND3 + 1 }, - { 134, ENDSEQVOL3SND2 + 1 }, - { 158, PIPEBOMB_EXPLODE + 1 }, - { -1,-1 } - }; - - static const AnimSound dukedcsound[] = - { - { 144, ENDSEQVOL3SND3 + 1 }, - { -1,-1 } - }; - - static const AnimSound vol4e1[] = - { - { 3, DUKE_UNDERWATER+1 }, - { 35, VOL4ENDSND1+1 }, - { -1,-1 } - }; - - static const AnimSound vol4e2[] = - { - { 11, DUKE_UNDERWATER+1 }, - { 20, VOL4ENDSND1+1 }, - { 39, VOL4ENDSND2+1 }, - { 50, -1 }, - { -1,-1 } - }; - - static const AnimSound vol4e3[] = - { - { 1, BOSS4_DEADSPEECH+1 }, - { 40, VOL4ENDSND1+1 }, - { 40, DUKE_UNDERWATER+1 }, - { 50, BIGBANG+1 }, - { -1,-1 } - }; - - - static const int framespeed_10[] = { 10, 10, 10 }; - static const int framespeed_14[] = { 14, 14, 14 }; - static const int framespeed_18[] = { 18, 18, 18 }; - - switch (num) - { - case 0: - jobs.Push(Create()); - jobs.Push(Create(E1ENDSCREEN, DScreenJob::fadein|DScreenJob::fadeout|DScreenJob::stopmusic, 0x7fffffff)); - break; - - case 1: - Mus_Stop(); - jobs.Push(PlayVideo("cineov2.anm", cineov2sound, framespeed_18)); - jobs.Push(Create()); - break; - - case 2: - Mus_Stop(); - if (g_gameType & GAMEFLAG_DUKEDC) - { - jobs.Push(PlayVideo("radlogo.anm", dukedcsound, framespeed_10)); - } - else - { - jobs.Push(PlayVideo("cineov3.anm", cineov3sound, framespeed_10)); - jobs.Push(Create(200, DScreenJob::stopsound)); - jobs.Push(Create()); - if (!isPlutoPak()) jobs.Push(Create(TexMan.GetGameTextureByName("DUKETEAM.ANM", false, FTextureManager::TEXMAN_ForceLookup), - DScreenJob::fadein | DScreenJob::fadeout | DScreenJob::stopsound, 0x7fffffff)); - } - break; - - case 3: - Mus_Stop(); - jobs.Push(PlayVideo("vol4e1.anm", vol4e1, framespeed_10)); - jobs.Push(PlayVideo("vol4e2.anm", vol4e2, framespeed_10)); - jobs.Push(PlayVideo("vol4e3.anm", vol4e3, framespeed_10)); - jobs.Push(Create()); - jobs.Push(Create(TexMan.GetGameTextureByName("DUKETEAM.ANM", false, FTextureManager::TEXMAN_ForceLookup), - DScreenJob::fadein | DScreenJob::fadeout | DScreenJob::stopsound, 0x7fffffff)); - break; - - case 4: - Mus_Stop(); - jobs.Push(Create()); - break; - } -} -#endif - //--------------------------------------------------------------------------- // // diff --git a/source/games/duke/src/namelist_d.h b/source/games/duke/src/namelist_d.h index 6da94e0b1..d05332000 100644 --- a/source/games/duke/src/namelist_d.h +++ b/source/games/duke/src/namelist_d.h @@ -608,8 +608,13 @@ x(VICTORY7, 3266) x(VICTORY8, 3267) x(VICTORY9, 3268) x(ORDERING, 3270) +x(ORDERING1, 3271) +x(ORDERING2, 3272) +x(ORDERING3, 3273) x(TEXTSTORY, 3280) x(LOADSCREEN, 3281) +x(SWEXIT2, 3290) +x(SWEXIT1, 3291) x(E1ENDSCREEN, 3292) x(E2ENDSCREEN, 3293) x(BORNTOBEWILDSCREEN, 3370) diff --git a/wadsrc/static/zscript/games/duke/ui/cutscenes.zs b/wadsrc/static/zscript/games/duke/ui/cutscenes.zs index 2bb3e1d5f..abe63c188 100644 --- a/wadsrc/static/zscript/games/duke/ui/cutscenes.zs +++ b/wadsrc/static/zscript/games/duke/ui/cutscenes.zs @@ -26,18 +26,16 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms */ //------------------------------------------------------------------------- - -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - -class DukeIntro : ScreenJobRunner +class DukeCutscenes { - void Init() + //--------------------------------------------------------------------------- + // + // + // + //--------------------------------------------------------------------------- + + static void BuildIntro(ScreenJobRunner runner) { - Super.Init(); Raze.StopMusic(); Raze.StopAllSounds(); @@ -49,41 +47,33 @@ class DukeIntro : ScreenJobRunner soundinfo.Pushv( 1, DukeSnd.FLY_BY+1, 19, DukeSnd.PIPEBOMB_EXPLODE+1); - jobs.Push(MoviePlayerJob.CreateWithSoundinfo("logo.anm", soundinfo, 0, 9, 9, 9)); + runner.Append(MoviePlayerJob.CreateWithSoundinfo("logo.anm", soundinfo, 0, 9, 9, 9)); } - if (!Raze.isNam()) jobs.Push(new("DRealmsScreen").Init()); + if (!Raze.isNam()) runner.Append(new("DRealmsScreen").Init()); } - jobs.Push(new("DukeTitleScreen").Init()); + runner.Append(new("DukeTitleScreen").Init()); } -} -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // + // + //--------------------------------------------------------------------------- -class DukeE1End : ScreenJobRunner -{ - void Init() + static void BuildE1End(ScreenJobRunner runner) { - Super.Init(); - jobs.Push(new("Episode1End1").Init()); - jobs.Push(ImageScreen.CreateNamed("E1ENDSCREEN", ScreenJob.fadein|ScreenJob.fadeout|ScreenJob.stopmusic, 0x7fffffff)); + runner.Append(new("Episode1End1").Init()); + runner.Append(ImageScreen.CreateNamed("E1ENDSCREEN", ScreenJob.fadein|ScreenJob.fadeout|ScreenJob.stopmusic, 0x7fffffff)); } -} -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // + // + //--------------------------------------------------------------------------- -class DukeE2End : ScreenJobRunner -{ - void Init() + static void BuildE2End(ScreenJobRunner runner) { - Super.Init(); Array soundinfo; soundinfo.Pushv( 1, DukeSnd.WIND_AMBIENCE+1, @@ -96,22 +86,18 @@ class DukeE2End : ScreenJobRunner 115, DukeSnd.ENDSEQVOL2SND6 + 1, 124, DukeSnd.ENDSEQVOL2SND7 + 1); - jobs.Push(MoviePlayerJob.CreateWithSoundinfo("cineov2.anm", soundinfo, 0, 18, 18, 18)); - jobs.Push(new("E2EndScreen").Init()); + runner.Append(MoviePlayerJob.CreateWithSoundinfo("cineov2.anm", soundinfo, 0, 18, 18, 18)); + runner.Append(new("E2EndScreen").Init()); } -} -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // + // + //--------------------------------------------------------------------------- -class DukeE3End : ScreenJobRunner -{ - void Init() + static void BuildE3End(ScreenJobRunner runner) { - Super.Init(); Array soundinfo; soundinfo.Pushv( 1, DukeSnd.WIND_REPEAT + 1, @@ -122,79 +108,162 @@ class DukeE3End : ScreenJobRunner 134, DukeSnd.ENDSEQVOL3SND2 + 1, 158, DukeSnd.PIPEBOMB_EXPLODE + 1); - jobs.Push(MoviePlayerJob.CreateWithSoundinfo("cineov3.anm", soundinfo, 0, 10, 10, 10)); - jobs.Push(BlackScreen.Create(200, ScreenJob.stopsound)); - jobs.Push(new("Episode3End").Init()); - if (!Raze.isPlutoPak()) jobs.Push(ImageScreen.CreateNamed("DUKETEAM.ANM", ScreenJob.fadein | ScreenJob.fadeout | ScreenJob.stopsound, 0x7fffffff)); + runner.Append(MoviePlayerJob.CreateWithSoundinfo("cineov3.anm", soundinfo, 0, 10, 10, 10)); + runner.Append(BlackScreen.Create(200, ScreenJob.stopsound)); + runner.Append(new("Episode3End").Init()); + if (!Raze.isPlutoPak()) runner.Append(ImageScreen.CreateNamed("DUKETEAM.ANM", ScreenJob.fadein | ScreenJob.fadeout | ScreenJob.stopsound, 0x7fffffff)); } -} -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // + // + //--------------------------------------------------------------------------- -class DukeDCEnd : ScreenJobRunner -{ - void Init() + static void BuildDCEnd(ScreenJobRunner runner) { - Super.Init(); Array soundinfo; soundinfo.Pushv(144, DukeSnd.ENDSEQVOL3SND3 + 1); - jobs.Push(MoviePlayerJob.CreateWithSoundinfo("radlogo.anm", soundinfo, 0, 10, 10, 10)); + runner.Append(MoviePlayerJob.CreateWithSoundinfo("radlogo.anm", soundinfo, 0, 10, 10, 10)); } -} -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // + // + //--------------------------------------------------------------------------- -class DukeE4End : ScreenJobRunner -{ - void Init() + static void BuildE4End(ScreenJobRunner runner) { - Super.Init(true, true); Array soundinfo; soundinfo.Pushv( 3, DukeSnd.DUKE_UNDERWATER+1, 35, DukeSnd.VOL4ENDSND1+1); - jobs.Push(MoviePlayerJob.CreateWithSoundinfo("vol4e1.anm", soundinfo, 0, 10, 10, 10)); + runner.Append(MoviePlayerJob.CreateWithSoundinfo("vol4e1.anm", soundinfo, 0, 10, 10, 10)); soundinfo.Pushv( 11, DukeSnd.DUKE_UNDERWATER+1, 20, DukeSnd.VOL4ENDSND1+1, 39, DukeSnd.VOL4ENDSND2+1, 50, -1); - jobs.Push(MoviePlayerJob.CreateWithSoundinfo("vol4e2.anm", soundinfo, 0, 10, 10, 10)); + runner.Append(MoviePlayerJob.CreateWithSoundinfo("vol4e2.anm", soundinfo, 0, 10, 10, 10)); soundinfo.Pushv( 1, DukeSnd.BOSS4_DEADSPEECH+1, 40, DukeSnd.VOL4ENDSND1+1, 40, DukeSnd.DUKE_UNDERWATER+1, 50, DukeSnd.BIGBANG+1); - jobs.Push(MoviePlayerJob.CreateWithSoundinfo("vol4e3.anm", soundinfo, 0, 10, 10, 10)); + runner.Append(MoviePlayerJob.CreateWithSoundinfo("vol4e3.anm", soundinfo, 0, 10, 10, 10)); - jobs.Push(new("Episode4Text").Init()); - jobs.Push(ImageScreen.CreateNamed("DUKETEAM.ANM", ScreenJob.fadein | ScreenJob.fadeout | ScreenJob.stopsound, 0x7fffffff)); + runner.Append(new("Episode4Text").Init()); + runner.Append(ImageScreen.CreateNamed("DUKETEAM.ANM", ScreenJob.fadein | ScreenJob.fadeout | ScreenJob.stopsound, 0x7fffffff)); } -} -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- + //--------------------------------------------------------------------------- + // + // + // + //--------------------------------------------------------------------------- -class DukeE5End : ScreenJobRunner -{ - void Init() + static void BuildE5End(ScreenJobRunner runner) { - Super.Init(); - jobs.Push(new("Episode5End").Init()); + runner.Append(new("Episode5End").Init()); } + + +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + + static void BuildE4Intro(ScreenJobRunner runner) + { + Array soundinfo; + + Duke.PlaySpecialMusic(Duke.MUS_BRIEFING); + soundinfo.Pushv( + 1, DukeSnd.INTRO4_B + 1, + 12, DukeSnd.SHORT_CIRCUIT + 1, + 18, DukeSnd.INTRO4_5 + 1, + 34, DukeSnd.SHORT_CIRCUIT + 1); + runner.Append(MoviePlayerJob.CreateWithSoundinfo("vol41a1.anm", soundinfo, 0, 10, 10, 10)); + + soundinfo.Pushv( + 1, DukeSnd.INTRO4_1 + 1, + 7, DukeSnd.INTRO4_3 + 1, + 12, DukeSnd.INTRO4_2 + 1, + 26, DukeSnd.INTRO4_4 + 1); + runner.Append(MoviePlayerJob.CreateWithSoundinfo("vol42a.anm", soundinfo, 0, 14, 14, 14)); + + soundinfo.Pushv( + 10, DukeSnd.INTRO4_6 + 1); + runner.Append(MoviePlayerJob.CreateWithSoundinfo("vol43a.anm", soundinfo, 0, 10, 10, 10)); + + runner.skipall = true; + } + + //--------------------------------------------------------------------------- + // + // + // + //--------------------------------------------------------------------------- + + static void BuildMPSummary(ScreenJobRunner runner, int playerswhenstarted) + { + runner.Append(new("DukeMultiplayerBonusScreen").Init(playerswhenstarted)); + } + + //--------------------------------------------------------------------------- + // + // + // + //--------------------------------------------------------------------------- + + static void BuildSPSummary(ScreenJobRunner runner, MapRecord map, int kills_, int maxkills_, int secrets_, int maxsecrets_, int supersecrets_, int time_, bool cheated) + { + let screen = SummaryScreenBase(new("DukeLevelSummaryScreen").Init()); + if (screen) screen.SetParameters(map, kills_, maxkills_, secrets_, maxsecrets_, supersecrets_, time_, cheated); + runner.Append(screen); + } + + //--------------------------------------------------------------------------- + // + // + // + //--------------------------------------------------------------------------- + + static void BuildSharewareExit(ScreenJobRunner runner) + { + runner.Append(ImageScreen.CreateNamed("SWEXIT1")); + runner.Append(ImageScreen.CreateNamed("SWEXIT2")); + } + + //--------------------------------------------------------------------------- + // + // + // + //--------------------------------------------------------------------------- + + static void BuildSharewareOrder(ScreenJobRunner runner) + { + runner.Append(ImageScreen.CreateNamed("ORDERING")); + runner.Append(ImageScreen.CreateNamed("ORDERING1")); + runner.Append(ImageScreen.CreateNamed("ORDERING2")); + runner.Append(ImageScreen.CreateNamed("ORDERING3")); + } + + //--------------------------------------------------------------------------- + // + // + // + //--------------------------------------------------------------------------- + + static void BuildLoading(ScreenJobRunner runner, MapRecord map) + { + runner.Append(new("DukeLoadScreen").Init(map)); + } + } diff --git a/wadsrc/static/zscript/screenjob.zs b/wadsrc/static/zscript/screenjob.zs index 9fd418dfb..e41f62dab 100644 --- a/wadsrc/static/zscript/screenjob.zs +++ b/wadsrc/static/zscript/screenjob.zs @@ -349,7 +349,7 @@ class ScreenJobRunner : Object DeleteJobs(); } - void DeleteJobs() + protected void DeleteJobs() { // Free all allocated resources now. for (int i = 0; i < jobs.Size(); i++) @@ -359,13 +359,18 @@ class ScreenJobRunner : Object jobs.Clear(); } + void Append(ScreenJob job) + { + jobs.Push(job); + } + //--------------------------------------------------------------------------- // // // //--------------------------------------------------------------------------- - void AdvanceJob(bool skip) + protected void AdvanceJob(bool skip) { if (index == jobs.Size()-1) {