Skip to content

Commit

Permalink
- merged the Hacx extra stuff into zd_extra.pk3 and added the ability…
Browse files Browse the repository at this point in the history
… to inject data into the resource directory after the IWAD so that the base resources can provide content that can override IWAD data if broken or not usable.

Hacx in particular needs this to fix a handful of buggy actors and to override the IWAD's MAPINFO which is not localizable.
  • Loading branch information
coelckers committed Jul 15, 2019
1 parent 8177583 commit 7916ceb
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 5 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Expand Up @@ -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 )
Expand Down
38 changes: 38 additions & 0 deletions src/gamedata/w_wad.cpp
Expand Up @@ -147,6 +147,7 @@ void FWadCollection::InitMultipleFiles (TArray<FString> &filenames, const TArray
int baselump = NumLumps;
AddFile (filenames[i]);
}
MoveIWadModifiers();

NumLumps = LumpInfo.Size();
if (NumLumps == 0)
Expand Down Expand Up @@ -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<LumpRecord> 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
Expand Down
1 change: 1 addition & 0 deletions src/gamedata/w_wad.h
Expand Up @@ -221,6 +221,7 @@ class FWadCollection
void RenameNerve();
void FixMacHexen();
void DeleteAll();
void MoveIWadModifiers();
FileReader * GetFileReader(int wadnum); // Gets a FileReader object to the entire WAD
};

Expand Down
1 change: 0 additions & 1 deletion wadsrc/static/iwadinfo.txt
Expand Up @@ -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"
}

Expand Down
3 changes: 0 additions & 3 deletions wadsrc_hacxextra/CMakeLists.txt

This file was deleted.

0 comments on commit 7916ceb

Please sign in to comment.