From a919e526ecd955aed5f0d23f74680bacaf44cafe Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 19 Apr 2021 21:39:44 +0200 Subject: [PATCH 1/5] - SW: the intro's sound may not be paused when the menu opens. --- source/core/movie/movieplayer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/core/movie/movieplayer.cpp b/source/core/movie/movieplayer.cpp index 10e3e52c2..80b6fca7b 100644 --- a/source/core/movie/movieplayer.cpp +++ b/source/core/movie/movieplayer.cpp @@ -137,7 +137,7 @@ public: if (sound == -1) soundEngine->StopAllChannels(); else if (SoundEnabled()) - soundEngine->StartSound(SOURCE_None, nullptr, nullptr, CHAN_AUTO, CHANF_NONE, sound, 1.f, ATTN_NONE); + soundEngine->StartSound(SOURCE_None, nullptr, nullptr, CHAN_AUTO, nostopsound? CHANF_UI : CHANF_NONE, sound, 1.f, ATTN_NONE); } } if (!nostopsound && curframe == numframes && soundEngine->GetSoundPlayingInfo(SOURCE_None, nullptr, -1)) return true; From 321bfe86f8d24954b892efaae0493b2a9a5cda97 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Tue, 20 Apr 2021 20:07:20 +1000 Subject: [PATCH 2/5] - `DSkippableScreenJob::OnEvent()`: Ensure previously ignored keys don't cause a screenjob to skip. * Volume up/down on the keyboard when trying to listen to a cut-scene shouldn't skip it. --- source/core/screenjob.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/core/screenjob.cpp b/source/core/screenjob.cpp index 02cdd3ede..87cd92b79 100644 --- a/source/core/screenjob.cpp +++ b/source/core/screenjob.cpp @@ -61,8 +61,13 @@ bool DSkippableScreenJob::OnEvent(event_t* evt) { if (evt->type == EV_KeyDown) { - state = skipped; - Skipped(); + auto& key = evt->data1; + bool ignoredkeys = key == KEY_VOLUMEDOWN || key == KEY_VOLUMEUP || (key > KEY_LASTJOYBUTTON && key < KEY_PAD_LTHUMB_RIGHT); + if (!ignoredkeys) + { + state = skipped; + Skipped(); + } } return true; } From 0c5729b0f69f77c75349f898db80bba1c77af0f6 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Tue, 20 Apr 2021 21:33:42 +1000 Subject: [PATCH 3/5] - SW: Ensure all sprite angles are backed up in the ticker. * Fixes #326. --- source/games/sw/src/player.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index 351df2422..37c80e1a9 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -6892,6 +6892,12 @@ MoveSkipSavePos(void) } } } + + // back up all sprite angles. + for (int i = 0; i < MAXSPRITES; i++) + { + sprite[i].backupang(); + } } From 9e40e49c2cb026f6871b3df8bbfacd25ab2eb765 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 20 Apr 2021 15:01:26 +0200 Subject: [PATCH 4/5] - generalized the special key handling for skipping cutscenes. --- source/core/inputstate.h | 11 +++++++++++ source/core/screenjob.cpp | 12 ++++-------- source/games/duke/src/2d_d.cpp | 2 +- source/games/duke/src/2d_r.cpp | 2 +- source/games/exhumed/src/2d.cpp | 6 +++--- source/games/sw/src/2d.cpp | 2 +- 6 files changed, 21 insertions(+), 14 deletions(-) diff --git a/source/core/inputstate.h b/source/core/inputstate.h index 01996f41a..dd457046e 100644 --- a/source/core/inputstate.h +++ b/source/core/inputstate.h @@ -126,3 +126,14 @@ inline void resetForcedSyncInput() { gamesetinput = false; } + +inline bool specialKeyEvent(event_t* ev) +{ + if (ev->type == EV_KeyDown || ev->type == EV_KeyUp) + { + int key = ev->data1; + if (key == KEY_VOLUMEDOWN || key == KEY_VOLUMEUP || (key > KEY_LASTJOYBUTTON && key < KEY_PAD_LTHUMB_RIGHT)) return true; + } + return false; +} + diff --git a/source/core/screenjob.cpp b/source/core/screenjob.cpp index 87cd92b79..f2417dc5b 100644 --- a/source/core/screenjob.cpp +++ b/source/core/screenjob.cpp @@ -59,15 +59,10 @@ IMPLEMENT_CLASS(DImageScreen, true, false) bool DSkippableScreenJob::OnEvent(event_t* evt) { - if (evt->type == EV_KeyDown) + if (evt->type == EV_KeyDown && !specialKeyEvent(evt)) { - auto& key = evt->data1; - bool ignoredkeys = key == KEY_VOLUMEDOWN || key == KEY_VOLUMEUP || (key > KEY_LASTJOYBUTTON && key < KEY_PAD_LTHUMB_RIGHT); - if (!ignoredkeys) - { - state = skipped; - Skipped(); - } + state = skipped; + Skipped(); } return true; } @@ -230,6 +225,7 @@ public: } if (jobs[index].job->state != DScreenJob::running) return false; + return jobs[index].job->OnEvent(ev); } diff --git a/source/games/duke/src/2d_d.cpp b/source/games/duke/src/2d_d.cpp index 34e6d8a97..c26c7ad14 100644 --- a/source/games/duke/src/2d_d.cpp +++ b/source/games/duke/src/2d_d.cpp @@ -858,7 +858,7 @@ public: bool OnEvent(event_t* ev) override { - if (ev->type == EV_KeyDown) + if (ev->type == EV_KeyDown && !specialKeyEvent(ev)) { if ((displaystate & printStatsAll) != printStatsAll) { diff --git a/source/games/duke/src/2d_r.cpp b/source/games/duke/src/2d_r.cpp index caf2440a5..25d52ac8a 100644 --- a/source/games/duke/src/2d_r.cpp +++ b/source/games/duke/src/2d_r.cpp @@ -400,7 +400,7 @@ public: bool OnEvent(event_t* ev) override { - if (ev->type == EV_KeyDown) + if (ev->type == EV_KeyDown && !specialKeyEvent(ev)) { if ((displaystate & printStatsAll) != printStatsAll) { diff --git a/source/games/exhumed/src/2d.cpp b/source/games/exhumed/src/2d.cpp index 8606ab507..2acd24315 100644 --- a/source/games/exhumed/src/2d.cpp +++ b/source/games/exhumed/src/2d.cpp @@ -808,7 +808,7 @@ public: } return true; } - state = skipped; + if (!specialKeyEvent(ev)) state = skipped; return true; } return false; @@ -1163,7 +1163,7 @@ private: bool OnEvent(event_t* ev) { - if (ev->type == EV_KeyDown) skiprequest = true; + if (ev->type == EV_KeyDown && !specialKeyEvent(ev)) skiprequest = true; return true; } @@ -1278,7 +1278,7 @@ public: bool OnEvent(event_t* ev) { - if (ev->type == EV_KeyDown) skiprequest = true; + if (ev->type == EV_KeyDown && !specialKeyEvent(ev)) skiprequest = true; return true; } diff --git a/source/games/sw/src/2d.cpp b/source/games/sw/src/2d.cpp index ce85b1bbf..9c982f0c6 100644 --- a/source/games/sw/src/2d.cpp +++ b/source/games/sw/src/2d.cpp @@ -389,7 +389,7 @@ private: bool OnEvent(event_t* ev) override { - if (ev->type == EV_KeyDown) + if (ev->type == EV_KeyDown && !specialKeyEvent(ev)) { if (State >= s_BonusRest && State < &s_BonusRest[countof(s_BonusRest)]) { From 588fa5ffe2011912c616b9cf76052d25452c82d3 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 20 Apr 2021 20:00:47 +0200 Subject: [PATCH 5/5] - fixed: FileSystem.CreatePathlessCopy must set the copy to not have a full path. Otherwise it may evade special lookup rules for music and not be found --- source/common/filesystem/filesystem.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/source/common/filesystem/filesystem.cpp b/source/common/filesystem/filesystem.cpp index dae98edf5..563ace705 100644 --- a/source/common/filesystem/filesystem.cpp +++ b/source/common/filesystem/filesystem.cpp @@ -63,12 +63,14 @@ struct FileSystem::LumpRecord int rfnum; int Namespace; int resourceId; + int flags; void SetFromLump(int filenum, FResourceLump* lmp) { lump = lmp; rfnum = filenum; linkedTexture = nullptr; + flags = 0; if (lump->Flags & LUMPF_SHORTNAME) { @@ -487,7 +489,7 @@ int FileSystem::CheckNumForName (const char *name, int space) // from a Zip return that. WADs don't know these namespaces and single lumps must // work as well. if (space > ns_specialzipdirectory && lump.Namespace == ns_global && - !(lump.lump->Flags & LUMPF_FULLPATH)) break; + !((lump.lump->Flags ^lump.flags) & LUMPF_FULLPATH)) break; } i = NextLumpIndex[i]; } @@ -796,7 +798,7 @@ int FileSystem::GetFileFlags (int lump) return 0; } - return FileInfo[lump].lump->Flags; + return FileInfo[lump].lump->Flags ^ FileInfo[lump].flags; } //========================================================================== @@ -1532,11 +1534,19 @@ bool FileSystem::CreatePathlessCopy(const char *name, int id, int /*flags*/) auto oldlump = FileInfo[lump]; int slash = oldlump.longName.LastIndexOf('/'); - if (slash == -1) return true; // already is pathless. + // Note: already pathless entries must be duplica + + if (slash == -1) + { + FileInfo[lump].flags = LUMPF_FULLPATH; + return true; // already is pathless. + } + // just create a new reference to the original data with a different name. oldlump.longName = oldlump.longName.Mid(slash + 1); oldlump.resourceId = id; + oldlump.flags = LUMPF_FULLPATH; FileInfo.Push(oldlump); return true; }