Merge branch 'origin/refactor_shaders' into refactor_shaders

This commit is contained in:
hiker 2015-05-08 13:21:13 +10:00
commit 3607cadf62
4 changed files with 54 additions and 23 deletions

Binary file not shown.

View File

@ -10,10 +10,10 @@
</hard>
<medium>
<karts number="4"/>
<requirements time="175"/>
<requirements time="185"/>
</medium>
<easy>
<karts number="4"/>
<requirements time="225"/>
<requirements time="270"/>
</easy>
</challenge>

View File

@ -555,14 +555,10 @@ void cmdLineHelp()
} // cmdLineHelp
//=============================================================================
/** For base options that don't need much to be inited (and, in some cases,
* that need to be read before initing stuff) - it only assumes that
* user config is loaded (necessary to check for blacklisted screen
* resolutions), but nothing else (esp. not kart_properties_manager and
* track_manager, since their search path might be extended by command
* line options).
/** For base options that modify the output (loglevel/color) or exit right
* after being processed (version/help).
*/
int handleCmdLinePreliminary()
int handleCmdLineOutputModifier()
{
if (CommandLine::has("--help") || CommandLine::has("-help") ||
CommandLine::has("-h"))
@ -585,7 +581,36 @@ int handleCmdLinePreliminary()
exit(0);
}
if(CommandLine::has("--gamepad-visualisation") || // only BE
int n;
if(CommandLine::has("--log", &n))
Log::setLogLevel(n);
if(CommandLine::has("--log=nocolor"))
{
Log::disableColor();
Log::verbose("main", "Colours disabled.");
}
if(CommandLine::has("--console"))
UserConfigParams::m_log_errors_to_console=true;
if(CommandLine::has("--no-console"))
UserConfigParams::m_log_errors_to_console=false;
return 0;
}
//=============================================================================
/** For base options that don't need much to be inited (and, in some cases,
* that need to be read before initing stuff) - it only assumes that
* user config is loaded (necessary to check for blacklisted screen
* resolutions), but nothing else (esp. not kart_properties_manager and
* track_manager, since their search path might be extended by command
* line options).
*/
int handleCmdLinePreliminary()
{
if(CommandLine::has("--gamepad-visualisation") || // only BE
CommandLine::has("--gamepad-visualization") ) // both AE and BE
UserConfigParams::m_gamepad_visualisation=true;
if(CommandLine::has("--debug=memory"))
@ -600,17 +625,8 @@ int handleCmdLinePreliminary()
UserConfigParams::m_verbosity |= UserConfigParams::LOG_MISC;
if(CommandLine::has("--debug=all") )
UserConfigParams::m_verbosity |= UserConfigParams::LOG_ALL;
if(CommandLine::has("--console"))
UserConfigParams::m_log_errors_to_console=true;
if(CommandLine::has("--no-console"))
UserConfigParams::m_log_errors_to_console=false;
if(CommandLine::has("--online"))
MainMenuScreen::m_enable_online=true;
if(CommandLine::has("--log=nocolor"))
{
Log::disableColor();
Log::verbose("main", "Colours disabled.");
}
std::string s;
if(CommandLine::has("--stk-config", &s))
@ -700,8 +716,6 @@ int handleCmdLinePreliminary()
UserConfigParams::m_xmas_mode = n;
if (CommandLine::has("--easter", &n))
UserConfigParams::m_easter_ear_mode = n;
if(CommandLine::has("--log", &n))
Log::setLogLevel(n);
return 0;
} // handleCmdLinePreliminary
@ -1238,6 +1252,9 @@ int main(int argc, char *argv[] )
try
{
std::string s;
handleCmdLineOutputModifier();
if(CommandLine::has("--root", &s))
{
FileManager::addRootDirs(s);

View File

@ -96,6 +96,7 @@ wchar_t* utf8_to_wide(const char* input)
// ----------------------------------------------------------------------------
/** Frees the memory allocated for the result of toFribidiChar(). */
#ifdef ENABLE_BIDI
void freeFribidiChar(FriBidiChar *str)
{
#ifdef TEST_BIDI
@ -105,13 +106,16 @@ void freeFribidiChar(FriBidiChar *str)
delete[] str;
#endif
}
#endif
/** Frees the memory allocated for the result of fromFribidiChar(). */
#ifdef ENABLE_BIDI
void freeFribidiChar(wchar_t *str)
{
if (sizeof(wchar_t) != sizeof(FriBidiChar))
delete[] str;
}
#endif
// ----------------------------------------------------------------------------
/** Converts a wstring to a FriBidi-string.
@ -121,6 +125,7 @@ void freeFribidiChar(wchar_t *str)
On linux, the string doesn't need to be converted because wchar_t is
already UTF-32. On windows the string is converted from UTF-16 by this
function. */
#ifdef ENABLE_BIDI
FriBidiChar* toFribidiChar(const wchar_t* str)
{
std::size_t length = wcslen(str);
@ -168,6 +173,7 @@ wchar_t* fromFribidiChar(const FriBidiChar* str)
}
return result;
}
#endif
// ----------------------------------------------------------------------------
Translations::Translations() //: m_dictionary_manager("UTF-16")
@ -422,9 +428,17 @@ bool Translations::isRTLText(const wchar_t *in_ptr)
fribidi_get_bidi_types(fribidiInput, length, types);
freeFribidiChar(fribidiInput);
FriBidiParType type = fribidi_get_par_direction(types, length);
// Declare as RTL if one character is RTL
for (std::size_t i = 0; i < length; i++)
{
if (types[i] == FRIBIDI_TYPE_RTL ||
types[i] == FRIBIDI_TYPE_RLO)
{
delete[] types;
return true;
}
}
delete[] types;
return type == FRIBIDI_PAR_RTL;
}
return false;
#else