Allow sys_lang to be saved to config

This commit is contained in:
Robert Beckebans 2021-05-08 15:05:47 +02:00
parent 0814287639
commit d7a96ca21b
5 changed files with 697 additions and 462 deletions

View file

@ -339,6 +339,10 @@ Using the models argument will also export all needed models by entity declarati
* Added invertGreen( normalmap.png ) material keyword to allow flipping the Y-Axis for tangent space normal maps
* Changed to sys_lang to be saved to config so it has to be set per cmdline only a single time
* Fixed bug that GOG builds default to Japanese instead of English
_______________________________________

View file

@ -1,5 +1,5 @@
astyle.exe -v --formatted --options=astyle-options.ini --exclude="libs" --exclude="extern" --recursive *.h
astyle.exe -v --formatted --options=astyle-options.ini --exclude="libs" --exclude="extern" --exclude="d3xp/gamesys/SysCvar.cpp" --exclude="d3xp/gamesys/Callbacks.cpp" --exclude="sys/win32/win_cpu.cpp" --exclude="sys/win32/win_main.cpp" --recursive *.cpp
astyle.exe -v --formatted --options=astyle-options.ini --exclude="libs" --exclude="extern" --exclude="d3xp/gamesys/SysCvar.cpp" --exclude="d3xp/gamesys/Callbacks.cpp" --exclude="sys/win32/win_cpu.cpp" --recursive *.cpp
astyle.exe -v --formatted --options=astyle-options.ini --recursive libs/imgui/*.h
astyle.exe -v --formatted --options=astyle-options.ini --recursive libs/imgui/*.cpp

View file

@ -387,7 +387,7 @@ void idInternalCVar::Set( const char* newValue, bool force, bool fromServer )
if( flags & CVAR_INIT )
{
common->Printf( "%s is write protected.\n", nameString.c_str() );
common->Printf( "%s is write protected and can only be set from the cmdline (or autoexec.cfg).\n", nameString.c_str() );
return;
}
}

View file

@ -37,7 +37,8 @@ const char* sysLanguageNames[] =
const int numLanguages = sizeof( sysLanguageNames ) / sizeof sysLanguageNames[ 0 ] - 1;
idCVar sys_lang( "sys_lang", ID_LANG_ENGLISH, CVAR_SYSTEM | CVAR_INIT, "", sysLanguageNames, idCmdSystem::ArgCompletion_String<sysLanguageNames> );
// RB: allow sys_lang to be saved to config so it has to be set per cmdline only a single time
idCVar sys_lang( "sys_lang", ID_LANG_ENGLISH, CVAR_SYSTEM | CVAR_INIT | CVAR_ARCHIVE, "", sysLanguageNames, idCmdSystem::ArgCompletion_String<sysLanguageNames> );
idSysLocal sysLocal;
idSys* sys = &sysLocal;
@ -295,6 +296,12 @@ const char* Sys_DefaultLanguage()
return ID_LANG_ENGLISH;
}
// GK: Prevent sys_lang to revert to english if is set manually
if( idStr::Icmp( ID_LANG_ENGLISH, sys_lang.GetString() ) != 0 )
{
return sys_lang.GetString();
}
idStr fileName;
//D3XP: Instead of just loading a single lang file for each language
@ -329,14 +336,14 @@ const char* Sys_DefaultLanguage()
}
else
{
if( currentLangList.Find( ID_LANG_JAPANESE ) )
{
sys_lang.SetString( ID_LANG_JAPANESE );
}
else if( currentLangList.Find( ID_LANG_ENGLISH ) )
if( currentLangList.Find( ID_LANG_ENGLISH ) )
{
sys_lang.SetString( ID_LANG_ENGLISH );
}
else if( currentLangList.Find( ID_LANG_JAPANESE ) )
{
sys_lang.SetString( ID_LANG_JAPANESE );
}
else if( currentLangList.Find( ID_LANG_FRENCH ) )
{
sys_lang.SetString( ID_LANG_FRENCH );

File diff suppressed because it is too large Load diff