- enforce that localized graphics need to be the same size as the one they replace.

This is one of those things where the work needed to make it robust stands in no relation to the gain.
This simply isn't worth the hassle of going through the entire code and fixing every single use of the 2D texture drawing functions.

Unfortunately this means that the graphics items for the menu cannot be replaced this way because their size will most likely differ, but considering that the only candidates for this are the contents of Doom's main menu, the episode menu, the skill menu and the single player summary screen, it's simply not worth it.

In all these cases the IWAD contents can just as easily be replaced with text and user mods which want to offer localized menus will have to work within the confines of the system, e.g. making sure that all menu items are designed to have proper size for substitution to work or by requesting text based menus, which will be added as a modding feature later.
This commit is contained in:
Christoph Oelckers 2019-02-20 00:42:02 +01:00
parent 5f25fbb2e3
commit 4eb8b53d95
1 changed files with 22 additions and 13 deletions

View File

@ -1044,21 +1044,30 @@ void FTextureManager::AddLocalizedVariants()
FTextureID tex = CheckForTexture(entry.name, ETextureType::MiscPatch);
if (tex.isValid())
{
tokens[1].ToLower();
auto langids = tokens[1].Split("-", FString::TOK_SKIPEMPTY);
auto lang = langids.Last();
for (auto &lang : langids)
FTexture *otex = GetTexture(origTex);
FTexture *ntex = GetTexture(tex);
if (otex->GetDisplayWidth() != ntex->GetDisplayWidth() || otex->GetDisplayHeight() != ntex->GetDisplayHeight())
{
if (lang.Len() == 2 || lang.Len() == 3)
Printf("Localized texture %s must be the same size as the one it replaces\n", entry.name);
}
else
{
tokens[1].ToLower();
auto langids = tokens[1].Split("-", FString::TOK_SKIPEMPTY);
auto lang = langids.Last();
for (auto &lang : langids)
{
uint32_t langid = MAKE_ID(lang[0], lang[1], lang[2], 0);
uint64_t comboid = (uint64_t(langid) << 32) | tex.GetIndex();
LocalizedTextures.Insert(comboid, GetTexture(origTex));
Textures[origTex.GetIndex()].HasLocalization = true;
}
else
{
Printf("Invalid language ID in texture %s\n", entry.name);
if (lang.Len() == 2 || lang.Len() == 3)
{
uint32_t langid = MAKE_ID(lang[0], lang[1], lang[2], 0);
uint64_t comboid = (uint64_t(langid) << 32) | tex.GetIndex();
LocalizedTextures.Insert(comboid, GetTexture(origTex));
Textures[origTex.GetIndex()].HasLocalization = true;
}
else
{
Printf("Invalid language ID in texture %s\n", entry.name);
}
}
}
}