From ba13a540e4c84d0bcbf30ed85af80662d95db0e7 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 17 Mar 2019 09:27:07 +0100 Subject: [PATCH] - changed default graphics substitution rules to be more localization friendly. The default was changed to replace graphics if only known content is affected. This also required blocking the feature for Hacx, Harmony and Action Doom 2 which have no localization yet and would fall back on Doom's texts if not blocked. --- src/gamedata/gi.cpp | 1 + src/gamedata/gi.h | 1 + src/gamedata/textures/texturemanager.cpp | 12 +++++++----- src/menu/menu.cpp | 6 +++--- src/posix/sdl/hardware.cpp | 4 ++-- wadsrc/static/mapinfo/hacx.txt | 1 + wadsrc/static/mapinfo/harmony.txt | 1 + wadsrc/static/mapinfo/urbanbrawl.txt | 1 + 8 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/gamedata/gi.cpp b/src/gamedata/gi.cpp index ebced3c7c..f80d80749 100644 --- a/src/gamedata/gi.cpp +++ b/src/gamedata/gi.cpp @@ -397,6 +397,7 @@ void FMapInfoParser::ParseGameInfo() GAMEINFOKEY_BOOL(dontcrunchcorpses, "dontcrunchcorpses") GAMEINFOKEY_BOOL(correctprintbold, "correctprintbold") GAMEINFOKEY_BOOL(forcetextinmenus, "forcetextinmenus") + GAMEINFOKEY_BOOL(forcenogfxsubstitution, "forcenogfxsubstitution") GAMEINFOKEY_BOOL(intermissioncounter, "intermissioncounter") GAMEINFOKEY_BOOL(nightmarefast, "nightmarefast") GAMEINFOKEY_COLOR(dimcolor, "dimcolor") diff --git a/src/gamedata/gi.h b/src/gamedata/gi.h index b5572da73..10bc411c0 100644 --- a/src/gamedata/gi.h +++ b/src/gamedata/gi.h @@ -121,6 +121,7 @@ struct gameinfo_t bool dontcrunchcorpses; bool correctprintbold; bool forcetextinmenus; + bool forcenogfxsubstitution; TArray creditPages; TArray finalePages; TArray infoPages; diff --git a/src/gamedata/textures/texturemanager.cpp b/src/gamedata/textures/texturemanager.cpp index 9ae7989a0..a53a14c58 100644 --- a/src/gamedata/textures/texturemanager.cpp +++ b/src/gamedata/textures/texturemanager.cpp @@ -403,9 +403,11 @@ FTexture *FTextureManager::FindTexture(const char *texname, ETextureType usetype // 3: Only replace if the string is not the default and the graphic comes from the IWAD. Never replace a localized graphic. // 4: Like 1, but lets localized graphics pass. // +// The default is 3, which only replaces known content with non-default texts. +// //========================================================================== -CUSTOM_CVAR(Int, cl_localizationmode,0, CVAR_ARCHIVE) +CUSTOM_CVAR(Int, cl_gfxlocalization, 3, CVAR_ARCHIVE) { if (self < 0 || self > 4) self = 0; } @@ -421,8 +423,8 @@ bool FTextureManager::OkForLocalization(FTextureID texnum, const char *substitut if (!texnum.isValid()) return false; // First the unconditional settings, 0='never' and 1='always'. - if (cl_localizationmode == 1 || gameinfo.forcetextinmenus) return false; - if (cl_localizationmode == 0) return true; + if (cl_gfxlocalization == 1 || gameinfo.forcetextinmenus) return false; + if (cl_gfxlocalization == 0 || gameinfo.forcenogfxsubstitution) return true; uint32_t langtable = 0; if (*substitute == '$') substitute = GStrings.GetString(substitute+1, &langtable); @@ -433,11 +435,11 @@ bool FTextureManager::OkForLocalization(FTextureID texnum, const char *substitut if (localizedTex != texnum.GetIndex()) return true; // Do not substitute a localized variant of the graphics patch. // For mode 4 we are done now. - if (cl_localizationmode == 4) return false; + if (cl_gfxlocalization == 4) return false; // Mode 2 and 3 must reject any text replacement from the default language tables. if ((langtable & MAKE_ID(255,0,0,0)) == MAKE_ID('*', 0, 0, 0)) return true; // Do not substitute if the string comes from the default table. - if (cl_localizationmode == 2) return false; + if (cl_gfxlocalization == 2) return false; // Mode 3 must also reject substitutions for non-IWAD content. int file = Wads.GetLumpFile(Textures[texnum.GetIndex()].Texture->SourceLump); diff --git a/src/menu/menu.cpp b/src/menu/menu.cpp index 6e2339d11..008f13b55 100644 --- a/src/menu/menu.cpp +++ b/src/menu/menu.cpp @@ -405,7 +405,7 @@ DEFINE_ACTION_FUNCTION(DMenu, ActivateMenu) // //============================================================================= -EXTERN_CVAR(Int, cl_localizationmode) +EXTERN_CVAR(Int, cl_gfxlocalization) void M_SetMenu(FName menu, int param) @@ -420,7 +420,7 @@ void M_SetMenu(FName menu, int param) { menu = NAME_MainmenuTextOnly; } - else + else if (cl_gfxlocalization != 0 && !gameinfo.forcenogfxsubstitution) { // For these games we must check up-front if they get localized because in that case another template must be used. DMenuDescriptor **desc = MenuDescriptors.CheckKey(NAME_Mainmenu); @@ -429,7 +429,7 @@ void M_SetMenu(FName menu, int param) if ((*desc)->IsKindOf(RUNTIME_CLASS(DListMenuDescriptor))) { DListMenuDescriptor *ld = static_cast(*desc); - if (ld->mFromEngine && cl_localizationmode != 0) + if (ld->mFromEngine) { // This assumes that replacing one graphic will replace all of them. // So this only checks the "New game" entry for localization capability. diff --git a/src/posix/sdl/hardware.cpp b/src/posix/sdl/hardware.cpp index 61d36abf0..4ea04f4e0 100644 --- a/src/posix/sdl/hardware.cpp +++ b/src/posix/sdl/hardware.cpp @@ -149,11 +149,11 @@ void I_SetFPSLimit(int limit) { FPSLimitTimerEnabled = true; if(timer_create(CLOCK_REALTIME, &FPSLimitEvent, &FPSLimitTimer) == -1) - Printf(DMSG_WARNING, "Failed to create FPS limitter event\n"); + Printf(DMSG_WARNING, "Failed to create FPS limiter event\n"); itimerspec period = { {0, 0}, {0, 0} }; period.it_value.tv_nsec = period.it_interval.tv_nsec = 1000000000 / limit; if(timer_settime(FPSLimitTimer, 0, &period, NULL) == -1) - Printf(DMSG_WARNING, "Failed to set FPS limitter timer\n"); + Printf(DMSG_WARNING, "Failed to set FPS limiter timer\n"); DPrintf(DMSG_NOTIFY, "FPS timer set to %u ms\n", (unsigned int) period.it_interval.tv_nsec / 1000000); } } diff --git a/wadsrc/static/mapinfo/hacx.txt b/wadsrc/static/mapinfo/hacx.txt index 45a511a81..ec6b0bc2e 100644 --- a/wadsrc/static/mapinfo/hacx.txt +++ b/wadsrc/static/mapinfo/hacx.txt @@ -3,5 +3,6 @@ include "mapinfo/doom2.txt" gameinfo { cursorpic = "cursor" + forcenogfxsubstitution = true } diff --git a/wadsrc/static/mapinfo/harmony.txt b/wadsrc/static/mapinfo/harmony.txt index b96689c9f..117d5d175 100644 --- a/wadsrc/static/mapinfo/harmony.txt +++ b/wadsrc/static/mapinfo/harmony.txt @@ -4,5 +4,6 @@ gameinfo { cursorpic = "cursor" statusbarclass = "HarmonyStatusBar" + forcenogfxsubstitution = true } diff --git a/wadsrc/static/mapinfo/urbanbrawl.txt b/wadsrc/static/mapinfo/urbanbrawl.txt index 949be059e..07ddd02da 100644 --- a/wadsrc/static/mapinfo/urbanbrawl.txt +++ b/wadsrc/static/mapinfo/urbanbrawl.txt @@ -4,5 +4,6 @@ gameinfo { swapmenu = true cursorpic = "cursor" + forcenogfxsubstitution = true }