diff --git a/src/c_cmds.cpp b/src/c_cmds.cpp index aa0af97b3..3f927a54f 100644 --- a/src/c_cmds.cpp +++ b/src/c_cmds.cpp @@ -1243,10 +1243,12 @@ CCMD(secret) FString levelname; level_info_t *info = FindLevelInfo(mapname); const char *ln = !(info->flags & LEVEL_LOOKUPLEVELNAME)? info->LevelName.GetChars() : GStrings[info->LevelName.GetChars()]; - levelname.Format("%s - %s\n", mapname, ln); - size_t llen = levelname.Len() - 1; + levelname.Format("%s - %s", mapname, ln); + Printf(TEXTCOLOR_YELLOW "%s\n", levelname.GetChars()); + size_t llen = levelname.Len(); + levelname = ""; for(size_t ii=0; ii 3) ? + MAKE_ID('e', 'n', 'u', '\0') : + MAKE_ID(language[0], language[1], language[2], '\0'); + currentLanguageSet.Clear(); auto checkone = [&](uint32_t lang_id) @@ -389,11 +395,8 @@ void FStringTable::UpdateLanguage() checkone(dehacked_table); checkone(global_table); - for (int i = 0; i < 4; ++i) - { - checkone(LanguageIDs[i]); - checkone(LanguageIDs[i] & MAKE_ID(0xff, 0xff, 0, 0)); - } + checkone(LanguageID); + checkone(LanguageID & MAKE_ID(0xff, 0xff, 0, 0)); checkone(default_table); } diff --git a/src/gamedata/textures/texturemanager.cpp b/src/gamedata/textures/texturemanager.cpp index d1f0ba91c..9ae7989a0 100644 --- a/src/gamedata/textures/texturemanager.cpp +++ b/src/gamedata/textures/texturemanager.cpp @@ -1300,17 +1300,20 @@ int FTextureManager::PalCheck(int tex) // FTextureManager :: PalCheck // //========================================================================== +EXTERN_CVAR(String, language) int FTextureManager::ResolveLocalizedTexture(int tex) { - for(int i = 0; i < 4; i++) - { - uint32_t lang = LanguageIDs[i]; - uint64_t index = (uint64_t(lang) << 32) + tex; - if (auto pTex = LocalizedTextures.CheckKey(index)) return *pTex; - index = (uint64_t(lang & MAKE_ID(255, 255, 0, 0)) << 32) + tex; - if (auto pTex = LocalizedTextures.CheckKey(index)) return *pTex; - } + size_t langlen = strlen(language); + int lang = (langlen < 2 || langlen > 3) ? + MAKE_ID('e', 'n', 'u', '\0') : + MAKE_ID(language[0], language[1], language[2], '\0'); + + uint64_t index = (uint64_t(lang) << 32) + tex; + if (auto pTex = LocalizedTextures.CheckKey(index)) return *pTex; + index = (uint64_t(lang & MAKE_ID(255, 255, 0, 0)) << 32) + tex; + if (auto pTex = LocalizedTextures.CheckKey(index)) return *pTex; + return tex; } diff --git a/src/posix/cocoa/i_system.mm b/src/posix/cocoa/i_system.mm index 8ef18d985..04a645540 100644 --- a/src/posix/cocoa/i_system.mm +++ b/src/posix/cocoa/i_system.mm @@ -68,21 +68,6 @@ ticcmd_t* I_BaseTiccmd() -// -// SetLanguageIDs -// -void SetLanguageIDs() -{ - size_t langlen = strlen(language); - - uint32_t lang = (langlen < 2 || langlen > 3) - ? MAKE_ID('e', 'n', 'u', '\0') - : MAKE_ID(language[0], language[1], language[2], '\0'); - - LanguageIDs[3] = LanguageIDs[2] = LanguageIDs[1] = LanguageIDs[0] = lang; -} - - double PerfToSec, PerfToMillisec; static void CalculateCPUSpeed() diff --git a/src/posix/i_system.h b/src/posix/i_system.h index 7e6837824..e6cd95cf8 100644 --- a/src/posix/i_system.h +++ b/src/posix/i_system.h @@ -45,16 +45,6 @@ struct WadStuff; #define SHARE_DIR "/usr/local/share/" #endif -// Index values into the LanguageIDs array -enum -{ - LANGIDX_UserPreferred, - LANGIDX_UserDefault, - LANGIDX_SysPreferred, - LANGIDX_SysDefault -}; -extern uint32_t LanguageIDs[4]; -extern void SetLanguageIDs (); // Called by DoomMain. void I_Init (void); diff --git a/src/posix/sdl/i_system.cpp b/src/posix/sdl/i_system.cpp index a9c94ba1f..2b8fd9155 100644 --- a/src/posix/sdl/i_system.cpp +++ b/src/posix/sdl/i_system.cpp @@ -92,20 +92,6 @@ void I_EndRead(void) } -// -// SetLanguageIDs -// -void SetLanguageIDs () -{ - size_t langlen = strlen(language); - - uint32_t lang = (langlen < 2 || langlen > 3) ? - MAKE_ID('e','n','u','\0') : - MAKE_ID(language[0],language[1],language[2],'\0'); - - LanguageIDs[3] = LanguageIDs[2] = LanguageIDs[1] = LanguageIDs[0] = lang; -} - // // I_Init // diff --git a/src/win32/i_system.cpp b/src/win32/i_system.cpp index 4087e1ec9..cc7727cd0 100644 --- a/src/win32/i_system.cpp +++ b/src/win32/i_system.cpp @@ -273,65 +273,6 @@ void I_DetectOS(void) info.dwBuildNumber, info.szCSDVersion); } -//========================================================================== -// -// SubsetLanguageIDs -// -// Helper function for SetLanguageIDs. -// -//========================================================================== - -static void SubsetLanguageIDs(LCID id, LCTYPE type, int idx) -{ - char buf[8]; - LCID langid; - char *idp; - - if (!GetLocaleInfoA(id, type, buf, 8)) - return; - langid = MAKELCID(strtoul(buf, NULL, 16), SORT_DEFAULT); - if (!GetLocaleInfoA(langid, LOCALE_SABBREVLANGNAME, buf, 8)) - return; - idp = (char *)(&LanguageIDs[idx]); - memset (idp, 0, 4); - idp[0] = tolower(buf[0]); - idp[1] = tolower(buf[1]); - idp[2] = tolower(buf[2]); - idp[3] = 0; -} - -//========================================================================== -// -// SetLanguageIDs -// -//========================================================================== - -void SetLanguageIDs() -{ - size_t langlen = strlen(language); - - if (langlen < 2 || langlen > 3) - { - memset(LanguageIDs, 0, sizeof(LanguageIDs)); - SubsetLanguageIDs(LOCALE_USER_DEFAULT, LOCALE_ILANGUAGE, 0); - SubsetLanguageIDs(LOCALE_USER_DEFAULT, LOCALE_IDEFAULTLANGUAGE, 1); - SubsetLanguageIDs(LOCALE_SYSTEM_DEFAULT, LOCALE_ILANGUAGE, 2); - SubsetLanguageIDs(LOCALE_SYSTEM_DEFAULT, LOCALE_IDEFAULTLANGUAGE, 3); - } - else - { - uint32_t lang = 0; - - ((uint8_t *)&lang)[0] = (language)[0]; - ((uint8_t *)&lang)[1] = (language)[1]; - ((uint8_t *)&lang)[2] = (language)[2]; - LanguageIDs[0] = lang; - LanguageIDs[1] = lang; - LanguageIDs[2] = lang; - LanguageIDs[3] = lang; - } -} - //========================================================================== // // CalculateCPUSpeed diff --git a/src/win32/i_system.h b/src/win32/i_system.h index d03f21044..5a5b663f9 100644 --- a/src/win32/i_system.h +++ b/src/win32/i_system.h @@ -34,17 +34,6 @@ struct ticcmd_t; struct WadStuff; -// Index values into the LanguageIDs array -enum -{ - LANGIDX_UserPreferred, - LANGIDX_UserDefault, - LANGIDX_SysPreferred, - LANGIDX_SysDefault -}; -extern uint32_t LanguageIDs[4]; -extern void SetLanguageIDs (); - // [RH] Detects the OS the game is running under. void I_DetectOS (void);