From 51aeb6dd39a852118067586d8f07def22852c59c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 1 May 2021 20:54:57 +0200 Subject: [PATCH] - fixed issues with skipping over an entire cutscene. This must never destroy the last element of the cutscene because it is still needed to draw something while shutdown is performed. --- wadsrc/static/zscript/games/duke/ui/cutscenes.zs | 10 ++++++---- wadsrc/static/zscript/screenjob.zs | 6 ++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/wadsrc/static/zscript/games/duke/ui/cutscenes.zs b/wadsrc/static/zscript/games/duke/ui/cutscenes.zs index 38dcdd375..6909a46ac 100644 --- a/wadsrc/static/zscript/games/duke/ui/cutscenes.zs +++ b/wadsrc/static/zscript/games/duke/ui/cutscenes.zs @@ -188,13 +188,15 @@ class DukeCutscenes // Note: must be class, not struct, otherwise we cannot easi 7, DukeSnd.INTRO4_3 + 1, 12, DukeSnd.INTRO4_2 + 1, 26, DukeSnd.INTRO4_4 + 1); - runner.Append(MoviePlayerJob.CreateWithSoundinfo("vol42a.anm", soundinfo, MoviePlayer.NOSOUNDCUTOFF, 14, 14, 14)); + let m = MoviePlayerJob.CreateWithSoundinfo("vol42a.anm", soundinfo, MoviePlayer.NOSOUNDCUTOFF, 14, 14, 14); + if (m) m.skipover = true; + runner.Append(m); soundinfo.Pushv( 10, DukeSnd.INTRO4_6 + 1); - runner.Append(MoviePlayerJob.CreateWithSoundinfo("vol43a.anm", soundinfo, 0, 10, 10, 10)); - - runner.skipall = true; + m = MoviePlayerJob.CreateWithSoundinfo("vol43a.anm", soundinfo, 0, 10, 10, 10); + if (m) m.skipover = true; + runner.Append(m); } //--------------------------------------------------------------------------- diff --git a/wadsrc/static/zscript/screenjob.zs b/wadsrc/static/zscript/screenjob.zs index 53c6d8a94..dd7763cd9 100644 --- a/wadsrc/static/zscript/screenjob.zs +++ b/wadsrc/static/zscript/screenjob.zs @@ -8,6 +8,8 @@ class ScreenJob : Object int ticks; int jobstate; + bool skipover; + enum EJobState { running = 0, // normal operation @@ -395,9 +397,9 @@ class ScreenJobRunner : Object if (index >= 0) jobs[index].Destroy(); index++; - while (index < jobs.Size() && (jobs[index] == null || (skip && skipall))) + while (index < jobs.Size() && (jobs[index] == null || (skip && jobs[index].skipover))) { - if (jobs[index] != null) jobs[index].Destroy(); + if (jobs[index] != null && index < jobs.Size() - 1) jobs[index].Destroy(); // may not delete the last element - we still need it for shutting down. index++; } actionState = clearbefore ? State_Clear : State_Run;