diff --git a/src/gamedata/fonts/font.cpp b/src/gamedata/fonts/font.cpp index 1b93148e8..99d11236f 100644 --- a/src/gamedata/fonts/font.cpp +++ b/src/gamedata/fonts/font.cpp @@ -221,7 +221,8 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla } else { - FTexture *texs[256 - '!'] = {}; + FTexture *texs[256] = {}; + if (lcount > 256 - start) lcount = 256 - start; for (i = 0; i < lcount; i++) { TArray array; @@ -240,10 +241,10 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla if (doomtemplate) { // Handle the misplaced '|'. - if (texs[121 - start] && !texs[120 - start] && !texs[122 - start] && !texs[124 - start]) + if (texs[121 - '!'] && !texs[120 - '!'] && !texs[122 - '!'] && !texs[124 - '!']) { - texs[124 - start] = texs[121 - start]; - texs[121 - start] = nullptr; + texs[124 - '!'] = texs[121 - '!']; + texs[121 - '!'] = nullptr; } } @@ -255,7 +256,7 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla Type = Multilump; if (position < minchar) minchar = position; if (position > maxchar) maxchar = position; - charMap.Insert(position, TexMan.GetTexture(lump)); + charMap.Insert(position, texs[i]); } } } diff --git a/src/gamedata/fonts/v_font.cpp b/src/gamedata/fonts/v_font.cpp index d98babb2b..d29ce57e9 100644 --- a/src/gamedata/fonts/v_font.cpp +++ b/src/gamedata/fonts/v_font.cpp @@ -1524,7 +1524,7 @@ void V_InitFonts() { // The font has been replaced, so we need to create a copy of the original as well. SmallFont = new FFont("SmallFont", "STCFN%.3d", nullptr, HU_FONTSTART, HU_FONTSIZE, HU_FONTSTART, -1); - OriginalSmallFont = new FFont("SmallFont", "FONTA%02u", "defsmallfont", HU_FONTSTART, HU_FONTSIZE, 1, -1, -1, false, true); + OriginalSmallFont = new FFont("SmallFont", "STCFN%.3d", "defsmallfont", HU_FONTSTART, HU_FONTSIZE, HU_FONTSTART, -1, -1, false, true); } else { diff --git a/src/gamedata/textures/texturemanager.cpp b/src/gamedata/textures/texturemanager.cpp index 17e711d66..6e2f00d4c 100644 --- a/src/gamedata/textures/texturemanager.cpp +++ b/src/gamedata/textures/texturemanager.cpp @@ -928,6 +928,7 @@ void FTextureManager::AddTexturesForWad(int wadnum, FMultipatchTextureBuilder &b { int firsttexture = Textures.Size(); int lumpcount = Wads.GetNumLumps(); + bool iwad = wadnum == Wads.GetIwadNum(); FirstTextureForFile.Push(firsttexture); @@ -980,16 +981,33 @@ void FTextureManager::AddTexturesForWad(int wadnum, FMultipatchTextureBuilder &b if (Wads.CheckLumpName(i, "BLOCKMAP")) continue; if (Wads.CheckLumpName(i, "BEHAVIOR")) continue; + bool force = false; // Don't bother looking at this lump if something later overrides it. - if (Wads.CheckNumForName(Name, ns_graphics) != i) continue; + if (Wads.CheckNumForName(Name, ns_graphics) != i) + { + if (iwad) + { + // We need to make an exception for font characters of the SmallFont coming from the IWAD to be able to construct the original font. + if (Name.IndexOf("STCFN") != 0 && Name.IndexOf("FONTA") != 0) continue; + force = true; + } + else continue; + } // skip this if it has already been added as a wall patch. - if (CheckForTexture(Name, ETextureType::WallPatch, 0).Exists()) continue; + if (!force && CheckForTexture(Name, ETextureType::WallPatch, 0).Exists()) continue; } else if (ns == ns_graphics) { - // Don't bother looking this lump if something later overrides it. - if (Wads.CheckNumForName(Name, ns_graphics) != i) continue; + if (Wads.CheckNumForName(Name, ns_graphics) != i) + { + if (iwad) + { + // We need to make an exception for font characters of the SmallFont coming from the IWAD to be able to construct the original font. + if (Name.IndexOf("STCFN") != 0 && Name.IndexOf("FONTA") != 0) continue; + } + else continue; + } } else if (ns >= ns_firstskin) {