diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b5f72c2c8..7860358ef7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -408,7 +408,6 @@ add_subdirectory( wadsrc ) add_subdirectory( wadsrc_bm ) add_subdirectory( wadsrc_lights ) add_subdirectory( wadsrc_extra ) -add_subdirectory( wadsrc_hacxextra ) add_subdirectory( src ) if( NOT CMAKE_CROSSCOMPILING ) diff --git a/src/gamedata/w_wad.cpp b/src/gamedata/w_wad.cpp index 0d28b2a186..878ee2fd4b 100644 --- a/src/gamedata/w_wad.cpp +++ b/src/gamedata/w_wad.cpp @@ -147,6 +147,7 @@ void FWadCollection::InitMultipleFiles (TArray &filenames, const TArray int baselump = NumLumps; AddFile (filenames[i]); } + MoveIWadModifiers(); NumLumps = LumpInfo.Size(); if (NumLumps == 0) @@ -1053,6 +1054,43 @@ void FWadCollection::FixMacHexen() } } +//========================================================================== +// +// MoveIWadModifiers +// +// Moves all content from the after_iwad subfolder of the internal +// resources to the first positions in the lump directory after the IWAD. +// Used to allow modifying content in the base files, this is needed +// so that Hacx and Harmony can override some content that clashes +// with localization. +// +//========================================================================== + +void FWadCollection::MoveIWadModifiers() +{ + TArray lumpsToMove; + + unsigned i; + for (i = 0; i < LumpInfo.Size(); i++) + { + auto& li = LumpInfo[i]; + if (li.wadnum >= GetIwadNum()) break; + if (li.lump->FullName.Left(11).CompareNoCase("after_iwad/") == 0) + { + lumpsToMove.Push(li); + LumpInfo.Delete(i--); + } + } + if (lumpsToMove.Size() == 0) return; + for (; i < LumpInfo.Size() && LumpInfo[i].wadnum <= Wads.GetMaxIwadNum(); i++); + for (auto& li : lumpsToMove) + { + li.lump->LumpNameSetup(li.lump->FullName.Mid(11)); + li.wadnum = Wads.GetMaxIwadNum(); // pretend this comes from the IWAD itself. + LumpInfo.Insert(i++, li); + } +} + //========================================================================== // // W_FindLump diff --git a/src/gamedata/w_wad.h b/src/gamedata/w_wad.h index 414174bd05..a51ac80c8e 100644 --- a/src/gamedata/w_wad.h +++ b/src/gamedata/w_wad.h @@ -221,6 +221,7 @@ private: void RenameNerve(); void FixMacHexen(); void DeleteAll(); + void MoveIWadModifiers(); FileReader * GetFileReader(int wadnum); // Gets a FileReader object to the entire WAD }; diff --git a/wadsrc/static/iwadinfo.txt b/wadsrc/static/iwadinfo.txt index 7f699f7bff..a80db21802 100644 --- a/wadsrc/static/iwadinfo.txt +++ b/wadsrc/static/iwadinfo.txt @@ -82,7 +82,6 @@ IWad Mapinfo = "mapinfo/hacx.txt" MustContain = "MAP01", "HACX-R" BannerColors = "00 00 a8", "a8 a8 a8" - Load = ":hacx_gzdoom_stuff.pk3" DeleteLumps = "FONTDEFS" } diff --git a/wadsrc_hacxextra/CMakeLists.txt b/wadsrc_hacxextra/CMakeLists.txt deleted file mode 100644 index 9dfad40207..0000000000 --- a/wadsrc_hacxextra/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -cmake_minimum_required( VERSION 2.8.7 ) - -add_pk3(hacx_gzdoom_stuff.pk3 ${CMAKE_CURRENT_SOURCE_DIR}/static)