From 9176d75580d10a7d9ad4f8ab77ef18d6ffbe247e Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Mon, 14 Dec 2015 11:47:46 +0200 Subject: [PATCH] Fix incorrect small font rendering with Hexen Mac IWAD Unused high resolution font lumps broke composite font logic Small font had doubled height because of that, at least alternate HUD and inter-hub text messages had noticeable visual issues --- src/w_wad.cpp | 36 ++++++++++++++++++++++++++++++++++++ src/w_wad.h | 1 + 2 files changed, 37 insertions(+) diff --git a/src/w_wad.cpp b/src/w_wad.cpp index efeb38571..552228557 100644 --- a/src/w_wad.cpp +++ b/src/w_wad.cpp @@ -184,6 +184,7 @@ void FWadCollection::InitMultipleFiles (TArray &filenames) } RenameNerve(); RenameSprites(); + FixMacHexen(); // [RH] Set up hash table FirstLumpIndex = new DWORD[NumLumps]; @@ -956,6 +957,41 @@ void FWadCollection::RenameNerve () } } +//========================================================================== +// +// FixMacHexen +// +// Rename unused high resolution font lumps because they are incorrectly +// treated as extended characters +// +//========================================================================== + +void FWadCollection::FixMacHexen() +{ + if (GAME_Hexen != gameinfo.gametype) + { + return; + } + + for (int i = GetFirstLump(IWAD_FILENUM), last = GetLastLump(IWAD_FILENUM); i <= last; ++i) + { + assert(IWAD_FILENUM == LumpInfo[i].wadnum); + + FResourceLump* const lump = LumpInfo[i].lump; + char* const name = lump->Name; + + // Unwanted lumps are named like FONTA??1 + + if (8 == strlen(name) + && MAKE_ID('F', 'O', 'N', 'T') == lump->dwName + && 'A' == name[4] && '1' == name[7] + && isdigit(name[5]) && isdigit(name[6])) + { + name[0] = '\0'; + } + } +} + //========================================================================== // // W_FindLump diff --git a/src/w_wad.h b/src/w_wad.h index 323f12df2..dcac6a1b2 100644 --- a/src/w_wad.h +++ b/src/w_wad.h @@ -238,6 +238,7 @@ protected: private: void RenameSprites(); void RenameNerve(); + void FixMacHexen(); void DeleteAll(); };