- 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.
This commit is contained in:
Christoph Oelckers 2019-03-17 09:27:07 +01:00
parent aa9c484b3b
commit ba13a540e4
8 changed files with 17 additions and 10 deletions

View File

@ -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")

View File

@ -121,6 +121,7 @@ struct gameinfo_t
bool dontcrunchcorpses;
bool correctprintbold;
bool forcetextinmenus;
bool forcenogfxsubstitution;
TArray<FName> creditPages;
TArray<FName> finalePages;
TArray<FName> infoPages;

View File

@ -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);

View File

@ -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<DListMenuDescriptor*>(*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.

View File

@ -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);
}
}

View File

@ -3,5 +3,6 @@ include "mapinfo/doom2.txt"
gameinfo
{
cursorpic = "cursor"
forcenogfxsubstitution = true
}

View File

@ -4,5 +4,6 @@ gameinfo
{
cursorpic = "cursor"
statusbarclass = "HarmonyStatusBar"
forcenogfxsubstitution = true
}

View File

@ -4,5 +4,6 @@ gameinfo
{
swapmenu = true
cursorpic = "cursor"
forcenogfxsubstitution = true
}