From 6305714493cf02a3a1439dd6545dfb8b50c4afbb Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 10 Jan 2020 21:36:46 +0100 Subject: [PATCH] - fixed some issues with RR's Route66 add-on. The new movies weren't played because the names did not match. Transition from the last level of Ep1 to the first one of Ep2 did not work. Selection with command line switch wasn't reliable. --- source/common/filesystem/filesystem.cpp | 24 ++++++++++++++++-------- source/common/gamecontrol.cpp | 16 +++++++++++----- source/common/gamecontrol.h | 3 ++- source/common/initfs.cpp | 1 + source/rr/src/screens.cpp | 4 ++-- wadsrc/static/engine/grpinfo.txt | 1 + 6 files changed, 33 insertions(+), 16 deletions(-) diff --git a/source/common/filesystem/filesystem.cpp b/source/common/filesystem/filesystem.cpp index 3d3557cdd..ee086b958 100644 --- a/source/common/filesystem/filesystem.cpp +++ b/source/common/filesystem/filesystem.cpp @@ -151,19 +151,27 @@ void FileSystem::DeleteStuff(const TArray& deletelumps, int numgamefile { // This must account for the game directory being inserted at index 2. // Deletion may only occur in the main game file, the directory and the add-on, there are no secondary dependencies, i.e. more than two game files. - numgamefiles++; - if (deletelumps.Size()) - for (uint32_t i = 0; i < FileInfo.Size(); i++) + numgamefiles++; + for (auto str : deletelumps) { - if (FileInfo[i].rfnum >= 1 && FileInfo[i].rfnum <= numgamefiles) - { - auto cmp = FileInfo[i].lump->LumpName[FResourceLump::FullNameType].GetChars(); - for (auto &str : deletelumps) + FString renameTo; + auto ndx = str.IndexOf("*"); + if (ndx >= 0) + { + renameTo = FName(str.Mid(ndx + 1)); + str.Truncate(ndx); + } + FName check = FName(str); + + for (uint32_t i = 0; i < FileInfo.Size(); i++) + { + if (FileInfo[i].rfnum >= 1 && FileInfo[i].rfnum <= numgamefiles && check == FileInfo[i].lump->LumpName[FResourceLump::FullNameType]) { - if (!str.CompareNoCase(cmp)) + if (renameTo.IsEmpty()) { for (auto& n : FileInfo[i].lump->LumpName) n = NAME_None; } + else FileInfo[i].lump->LumpNameSetup(renameTo); } } } diff --git a/source/common/gamecontrol.cpp b/source/common/gamecontrol.cpp index 489b2dcc5..c647a9016 100644 --- a/source/common/gamecontrol.cpp +++ b/source/common/gamecontrol.cpp @@ -156,6 +156,10 @@ void UserConfig::ProcessOptions() DefaultCon = "GAME66.CON"; const char* argv[] = { "tilesa66.art" , "tilesb66.art" }; AddArt.reset(new FArgs(2, argv)); + toBeDeleted.Push("turd66.anm*turdmov.anm"); + toBeDeleted.Push("turd66.voc*turdmov.voc"); + toBeDeleted.Push("end66.anm*rr_outro.anm"); + toBeDeleted.Push("end66.voc*rr_outro.voc"); } else if (Args->CheckParm("-cryptic")) { @@ -191,9 +195,13 @@ void UserConfig::ProcessOptions() Args->CollectFiles("-def", defs, ".def"); DefaultDef = Args->CheckValue("-def"); - static const char* cons[] = { "-con", "-x", nullptr }; - Args->CollectFiles("-con", cons, ".con"); - DefaultCon = Args->CheckValue("-con"); + if (DefaultCon.IsEmpty()) + { + static const char* cons[] = { "-con", "-x", nullptr }; + Args->CollectFiles("-con", cons, ".con"); + DefaultCon = Args->CheckValue("-con"); + if (DefaultCon.IsEmpty()) DefaultCon = Args->CheckValue("-ini"); + } static const char* demos[] = { "-playback", "-d", "-demo", nullptr }; Args->CollectFiles("-demo", demos, ".dmo"); @@ -218,8 +226,6 @@ void UserConfig::ProcessOptions() Args->CollectFiles("-art", ".art"); AddArt.reset(Args->GatherFiles("-art")); - CommandIni = Args->CheckValue("-ini"); - nologo = Args->CheckParm("-nologo") || Args->CheckParm("-quick"); nomusic = Args->CheckParm("-nomusic"); nosound = Args->CheckParm("-nosfx"); diff --git a/source/common/gamecontrol.h b/source/common/gamecontrol.h index eeb724511..e242a0c17 100644 --- a/source/common/gamecontrol.h +++ b/source/common/gamecontrol.h @@ -63,6 +63,7 @@ struct UserConfig std::unique_ptr AddFiles; std::unique_ptr AddFilesPre; //To be added before the main directory. Only for legacy options. std::unique_ptr AddArt; + TArray toBeDeleted; bool nomonsters = false; bool nosound = false; @@ -109,7 +110,7 @@ enum GAMEFLAG_EXHUMED = 0x00002000, GAMEFLAG_PSEXHUMED = 0x00003000, // the two games really are the same, except for the name and the publisher. GAMEFLAG_STANDALONE = 0x00004000, - GAMEFLAGMASK = 0x00000FFF, // flags allowed from grpinfo + GAMEFLAGMASK = 0x00003FFF, // flags allowed from grpinfo }; diff --git a/source/common/initfs.cpp b/source/common/initfs.cpp index 4a1bd31c5..8db571bd7 100644 --- a/source/common/initfs.cpp +++ b/source/common/initfs.cpp @@ -383,6 +383,7 @@ void InitFileSystem(TArray& groups) { todelete.Append(g.FileInfo.tobedeleted); } + todelete.Append(userConfig.toBeDeleted); fileSystem.InitMultipleFiles(Files, todelete, groups.Size()); FILE* f = fopen("filesystem.dir", "wb"); diff --git a/source/rr/src/screens.cpp b/source/rr/src/screens.cpp index 0690b0c73..1528248c4 100644 --- a/source/rr/src/screens.cpp +++ b/source/rr/src/screens.cpp @@ -1509,8 +1509,8 @@ static void G_BonusCutscenes(void) videoClearScreen(0L); videoNextPage(); } - ud.level_number = 0; - ud.volume_number = 1; + m_level_number = ud.level_number = 0; + ud.m_volume_number = ud.volume_number = 1; ud.eog = 0; fadepal(0, 0, 0, 0, 252, 4); inputState.ClearAllInput(); diff --git a/wadsrc/static/engine/grpinfo.txt b/wadsrc/static/engine/grpinfo.txt index 6c768f07f..0759375dc 100644 --- a/wadsrc/static/engine/grpinfo.txt +++ b/wadsrc/static/engine/grpinfo.txt @@ -345,6 +345,7 @@ grpinfo dependency RR_CRC loadart "TILESA66.ART", "TILESB66.ART" // replaces TILES009 and TILES023. gamefilter "Redneck.Route66" + deletecontent "turd66.anm*turdmov.anm", "turd66.voc*turdmov.voc", "end66.anm*rr_outro.anm", "end66.voc*rr_outro.voc" // This renames instead of deleting } grpinfo