Merge branch 'upstream/master' into kart-properties
This commit is contained in:
commit
12a1227f20
@ -524,6 +524,19 @@ void Camera::getCameraSettings(float *above_kart, float *cam_angle,
|
||||
*/
|
||||
void Camera::update(float dt)
|
||||
{
|
||||
if (m_kart == NULL)
|
||||
{
|
||||
if (race_manager->getNumLocalPlayers() < 2)
|
||||
{
|
||||
Vec3 pos(m_camera->getPosition());
|
||||
SFXManager::get()->positionListener(pos,
|
||||
Vec3(m_camera->getTarget()) - pos,
|
||||
Vec3(0, 1, 0));
|
||||
}
|
||||
|
||||
return; // cameras not attached to kart must be positioned manually
|
||||
}
|
||||
|
||||
if (race_manager->getNumLocalPlayers() < 2)
|
||||
{
|
||||
Vec3 heading(sin(m_kart->getHeading()), 0.0f, cos(m_kart->getHeading()));
|
||||
@ -531,9 +544,7 @@ void Camera::update(float dt)
|
||||
heading,
|
||||
Vec3(0, 1, 0));
|
||||
}
|
||||
|
||||
if (m_kart == NULL) return; // cameras not attached to kart must be positioned manually
|
||||
|
||||
|
||||
float above_kart, cam_angle, side_way, distance;
|
||||
bool smoothing;
|
||||
|
||||
|
@ -688,11 +688,13 @@ core::dimension2d<u32> ScalableFont::getDimension(const wchar_t* text) const
|
||||
|
||||
if (gp_creator->getNewChar().size() > 0 && !m_is_hollow_copy && m_scale == 1)
|
||||
{
|
||||
Log::debug("ScalableFont::getDimension", "New character(s) %s discoverd, perform lazy loading",
|
||||
StringUtils::wide_to_utf8(gp_creator->getNewChar().c_str()).c_str());
|
||||
Log::debug("ScalableFont::getDimension",
|
||||
"New character(s) %s discoverd, perform lazy loading",
|
||||
StringUtils::wideToUtf8(gp_creator->getNewChar()).c_str());
|
||||
|
||||
if (!GUIEngine::getFont()->lazyLoadChar())
|
||||
Log::error("ScalableFont::lazyLoadChar", "Can't insert new char into glyph pages.");
|
||||
Log::error("ScalableFont::lazyLoadChar",
|
||||
"Can't insert new char into glyph pages.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -822,19 +824,24 @@ void ScalableFont::doDraw(const core::stringw& text,
|
||||
[GUIEngine::getFont()->getSpriteNoFromChar(&c)].Frames[0].textureNumber
|
||||
== m_spritebank->getTextureCount() - 1) //Prevent overwriting texture used by billboard text
|
||||
{
|
||||
Log::debug("ScalableFont::doDraw", "Character used by billboard text is in the last glyph page of normal font."
|
||||
" Create a new glyph page for new characters inserted later to prevent it from being removed.");
|
||||
Log::debug("ScalableFont::doDraw",
|
||||
"Character used by billboard text is in the last "
|
||||
"glyph page of normal font. Create a new glyph "
|
||||
"page for new characters inserted later to prevent "
|
||||
"it from being removed.");
|
||||
GUIEngine::getFont()->forceNewPage();
|
||||
}
|
||||
}
|
||||
|
||||
if (gp_creator->getNewChar().size() > 0 && !m_is_hollow_copy && m_scale == 1)
|
||||
{
|
||||
Log::debug("ScalableFont::doDraw", "New character(s) %s discoverd, perform lazy loading",
|
||||
StringUtils::wide_to_utf8(gp_creator->getNewChar().c_str()).c_str());
|
||||
Log::debug("ScalableFont::doDraw",
|
||||
"New character(s) %s discoverd, perform lazy loading",
|
||||
StringUtils::wideToUtf8(gp_creator->getNewChar()).c_str());
|
||||
|
||||
if (!GUIEngine::getFont()->lazyLoadChar())
|
||||
Log::error("ScalableFont::lazyLoadChar", "Can't insert new char into glyph pages.");
|
||||
Log::error("ScalableFont::lazyLoadChar",
|
||||
"Can't insert new char into glyph pages.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -282,7 +282,7 @@ bool CGUIEditBox::processKey(const SEvent& event)
|
||||
|
||||
core::stringw s;
|
||||
s = Text.subString(realmbgn, realmend - realmbgn).c_str();
|
||||
Operator->copyToClipboard(StringUtils::wide_to_utf8(s.c_str()).c_str());
|
||||
Operator->copyToClipboard(StringUtils::wideToUtf8(s).c_str());
|
||||
}
|
||||
break;
|
||||
case KEY_KEY_X:
|
||||
@ -295,7 +295,7 @@ bool CGUIEditBox::processKey(const SEvent& event)
|
||||
// copy
|
||||
core::stringw sc;
|
||||
sc = Text.subString(realmbgn, realmend - realmbgn).c_str();
|
||||
Operator->copyToClipboard(StringUtils::wide_to_utf8(sc.c_str()).c_str());
|
||||
Operator->copyToClipboard(StringUtils::wideToUtf8(sc).c_str());
|
||||
|
||||
if (isEnabled())
|
||||
{
|
||||
@ -331,13 +331,13 @@ bool CGUIEditBox::processKey(const SEvent& event)
|
||||
{
|
||||
// insert text
|
||||
core::stringw s = Text.subString(0, CursorPos);
|
||||
s.append(StringUtils::utf8_to_wide(p));
|
||||
s.append(StringUtils::utf8ToWide(p));
|
||||
s.append( Text.subString(CursorPos, Text.size()-CursorPos) );
|
||||
|
||||
if (!Max || s.size()<=Max) // thx to Fish FH for fix
|
||||
{
|
||||
Text = s;
|
||||
s = StringUtils::utf8_to_wide(p);
|
||||
s = StringUtils::utf8ToWide(p);
|
||||
CursorPos += s.size();
|
||||
}
|
||||
}
|
||||
@ -346,13 +346,13 @@ bool CGUIEditBox::processKey(const SEvent& event)
|
||||
// replace text
|
||||
|
||||
core::stringw s = Text.subString(0, realmbgn);
|
||||
s.append(StringUtils::utf8_to_wide(p));
|
||||
s.append(StringUtils::utf8ToWide(p));
|
||||
s.append( Text.subString(realmend, Text.size()-realmend) );
|
||||
|
||||
if (!Max || s.size()<=Max) // thx to Fish FH for fix
|
||||
{
|
||||
Text = s;
|
||||
s = StringUtils::utf8_to_wide(p);
|
||||
s = StringUtils::utf8ToWide(p);
|
||||
CursorPos = realmbgn + s.size();
|
||||
}
|
||||
}
|
||||
|
@ -55,14 +55,14 @@ namespace Scripting
|
||||
DeviceConfig* config = device->getConfiguration();
|
||||
PlayerAction ScriptAction = (PlayerAction)Enum_value;
|
||||
irr::core::stringw control = config->getBindingAsString(ScriptAction);
|
||||
std::string key = StringUtils::wide_to_utf8(control.c_str());
|
||||
std::string key = StringUtils::wideToUtf8(control);
|
||||
return key;
|
||||
}
|
||||
|
||||
/** Show the specified message in a popup */
|
||||
void displayModalMessage(std::string* input)
|
||||
{
|
||||
irr::core::stringw out = StringUtils::utf8_to_wide(input->c_str());
|
||||
irr::core::stringw out = StringUtils::utf8ToWide(*input);
|
||||
new TutorialMessageDialog((out), true);
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ namespace Scripting
|
||||
/** Display text in the center of the screen for a few seconds */
|
||||
void displayOverlayMessage(std::string* input)
|
||||
{
|
||||
irr::core::stringw msg = StringUtils::utf8_to_wide(input->c_str());
|
||||
irr::core::stringw msg = StringUtils::utf8ToWide(*input);
|
||||
std::vector<core::stringw> parts =
|
||||
StringUtils::split(msg, '\n', false);
|
||||
|
||||
@ -92,7 +92,7 @@ namespace Scripting
|
||||
{
|
||||
irr::core::stringw out = translations->fribidize(translations->w_gettext(input->c_str()));
|
||||
|
||||
return StringUtils::wide_to_utf8(out.c_str());
|
||||
return StringUtils::wideToUtf8(out);
|
||||
}
|
||||
|
||||
/** Translate string and insert values. e.g. GUI::translate("Hello %s !", "John") */
|
||||
@ -101,11 +101,11 @@ namespace Scripting
|
||||
irr::core::stringw out = translations->w_gettext(formatString->c_str());
|
||||
|
||||
out = StringUtils::insertValues(out,
|
||||
StringUtils::utf8_to_wide(arg1->c_str()));
|
||||
StringUtils::utf8ToWide(*arg1));
|
||||
|
||||
out = translations->fribidize(out);
|
||||
|
||||
return StringUtils::wide_to_utf8(out.c_str());
|
||||
return StringUtils::wideToUtf8(out);
|
||||
}
|
||||
|
||||
/** Translate string and insert values. e.g. GUI::translate("Hello %s !", "John") */
|
||||
@ -114,12 +114,12 @@ namespace Scripting
|
||||
irr::core::stringw out = translations->w_gettext(formatString->c_str());
|
||||
|
||||
out = StringUtils::insertValues(out,
|
||||
StringUtils::utf8_to_wide(arg1->c_str()),
|
||||
StringUtils::utf8_to_wide(arg2->c_str()));
|
||||
StringUtils::utf8ToWide(*arg1),
|
||||
StringUtils::utf8ToWide(*arg2));
|
||||
|
||||
out = translations->fribidize(out);
|
||||
|
||||
return StringUtils::wide_to_utf8(out.c_str());
|
||||
return StringUtils::wideToUtf8(out);
|
||||
}
|
||||
|
||||
/** Translate string and insert values. e.g. GUI::translate("Hello %s !", "John") */
|
||||
@ -129,13 +129,13 @@ namespace Scripting
|
||||
irr::core::stringw out = translations->w_gettext(formatString->c_str());
|
||||
|
||||
out = StringUtils::insertValues(out,
|
||||
StringUtils::utf8_to_wide(arg1->c_str()),
|
||||
StringUtils::utf8_to_wide(arg2->c_str()),
|
||||
StringUtils::utf8_to_wide(arg3->c_str()));
|
||||
StringUtils::utf8ToWide(*arg1),
|
||||
StringUtils::utf8ToWide(*arg2),
|
||||
StringUtils::utf8ToWide(*arg3));
|
||||
|
||||
out = translations->fribidize(out);
|
||||
|
||||
return StringUtils::wide_to_utf8(out.c_str());
|
||||
return StringUtils::wideToUtf8(out);
|
||||
}
|
||||
/** @}*/
|
||||
/** @}*/
|
||||
|
@ -86,7 +86,7 @@ namespace Scripting
|
||||
|
||||
void createTextBillboard(std::string* text, SimpleVec3* location)
|
||||
{
|
||||
core::stringw wtext = StringUtils::utf8_to_wide(text->c_str());
|
||||
core::stringw wtext = StringUtils::utf8ToWide(*text);
|
||||
core::dimension2d<u32> textsize = GUIEngine::getHighresDigitFont()
|
||||
->getDimension(wtext.c_str());
|
||||
|
||||
|
@ -52,53 +52,58 @@ namespace Scripting
|
||||
/** Replaces placeholders with values. Note, in angelscript, omit the trailing number.
|
||||
* e.g. Utils::insertValues("Hello %s !", "world");
|
||||
*/
|
||||
std::string insertValues(std::string* formatString, std::string* arg1)
|
||||
std::string insertValues(std::string* format_string, std::string* arg1)
|
||||
{
|
||||
irr::core::stringw out = StringUtils::insertValues(StringUtils::utf8_to_wide(formatString->c_str()),
|
||||
StringUtils::utf8_to_wide(arg1->c_str()));
|
||||
irr::core::stringw out =
|
||||
StringUtils::insertValues(StringUtils::utf8ToWide(*format_string),
|
||||
StringUtils::utf8ToWide(*arg1));
|
||||
|
||||
return StringUtils::wide_to_utf8(out.c_str());
|
||||
return StringUtils::wideToUtf8(out);
|
||||
}
|
||||
|
||||
/** Replaces placeholders with values. Note, in angelscript, omit the trailing number.
|
||||
* e.g. Utils::insertValues("Hello %s %s !", "John", "Doe");
|
||||
*/
|
||||
std::string insertValues(std::string* formatString, std::string* arg1, std::string* arg2)
|
||||
std::string insertValues(std::string* format_string, std::string* arg1, std::string* arg2)
|
||||
{
|
||||
irr::core::stringw out = StringUtils::insertValues(StringUtils::utf8_to_wide(formatString->c_str()),
|
||||
StringUtils::utf8_to_wide(arg1->c_str()),
|
||||
StringUtils::utf8_to_wide(arg2->c_str()));
|
||||
irr::core::stringw out =
|
||||
StringUtils::insertValues(StringUtils::utf8ToWide(*format_string),
|
||||
StringUtils::utf8ToWide(*arg1),
|
||||
StringUtils::utf8ToWide(*arg2));
|
||||
|
||||
return StringUtils::wide_to_utf8(out.c_str());
|
||||
return StringUtils::wideToUtf8(out);
|
||||
}
|
||||
|
||||
/** Replaces placeholders with values. Note, in angelscript, omit the trailing number.
|
||||
* e.g. Utils::insertValues("Hello %s %s %s !", "Mr", "John", "Doe");
|
||||
*/
|
||||
std::string insertValues(std::string* formatString, std::string* arg1, std::string* arg2,
|
||||
std::string insertValues(std::string* format_string, std::string* arg1, std::string* arg2,
|
||||
std::string* arg3)
|
||||
{
|
||||
irr::core::stringw out = StringUtils::insertValues(StringUtils::utf8_to_wide(formatString->c_str()),
|
||||
StringUtils::utf8_to_wide(arg1->c_str()),
|
||||
StringUtils::utf8_to_wide(arg2->c_str()),
|
||||
StringUtils::utf8_to_wide(arg3->c_str()));
|
||||
irr::core::stringw out =
|
||||
StringUtils::insertValues(StringUtils::utf8ToWide(*format_string),
|
||||
StringUtils::utf8ToWide(*arg1),
|
||||
StringUtils::utf8ToWide(*arg2),
|
||||
StringUtils::utf8ToWide(*arg3));
|
||||
|
||||
return StringUtils::wide_to_utf8(out.c_str());
|
||||
return StringUtils::wideToUtf8(out);
|
||||
}
|
||||
|
||||
/** Replaces placeholders with values. Note, in angelscript, omit the trailing number.
|
||||
* e.g. Utils::insertValues("%s %s %s %s !", "Hello", "Mr", "John", "Doe");
|
||||
*/
|
||||
std::string insertValues(std::string* formatString, std::string* arg1, std::string* arg2,
|
||||
std::string* arg3, std::string* arg4)
|
||||
std::string insertValues(std::string* format_string, std::string* arg1,
|
||||
std::string* arg2, std::string* arg3,
|
||||
std::string* arg4)
|
||||
{
|
||||
irr::core::stringw out = StringUtils::insertValues(StringUtils::utf8_to_wide(formatString->c_str()),
|
||||
StringUtils::utf8_to_wide(arg1->c_str()),
|
||||
StringUtils::utf8_to_wide(arg2->c_str()),
|
||||
StringUtils::utf8_to_wide(arg3->c_str()),
|
||||
StringUtils::utf8_to_wide(arg4->c_str()));
|
||||
irr::core::stringw out =
|
||||
StringUtils::insertValues(StringUtils::utf8ToWide(*format_string),
|
||||
StringUtils::utf8ToWide(*arg1),
|
||||
StringUtils::utf8ToWide(*arg2),
|
||||
StringUtils::utf8ToWide(*arg3),
|
||||
StringUtils::utf8ToWide(*arg4));
|
||||
|
||||
return StringUtils::wide_to_utf8(out.c_str());
|
||||
return StringUtils::wideToUtf8(out);
|
||||
}
|
||||
|
||||
/** Runs the script function specified by the given string */
|
||||
|
@ -229,7 +229,7 @@ void CustomVideoSettingsDialog::updateActivation()
|
||||
{
|
||||
bool light = getWidget<CheckBoxWidget>("dynamiclight")->getState();
|
||||
getWidget<CheckBoxWidget>("motionblur")->setActive(light);
|
||||
getWidget<CheckBoxWidget>("dof")->setActive(true);
|
||||
getWidget<CheckBoxWidget>("dof")->setActive(light);
|
||||
getWidget<SpinnerWidget>("shadows")->setActive(light);
|
||||
getWidget<CheckBoxWidget>("mlaa")->setActive(light);
|
||||
getWidget<CheckBoxWidget>("ssao")->setActive(light);
|
||||
|
@ -198,7 +198,7 @@ void OptionsScreenUI::init()
|
||||
{
|
||||
std::string code_name = (*lang_list)[n];
|
||||
std::string s_name = tinygettext::Language::from_name(code_name).get_name();
|
||||
core::stringw nice_name = StringUtils::utf8_to_wide(s_name.c_str());
|
||||
core::stringw nice_name = StringUtils::utf8ToWide(s_name);
|
||||
nice_lang_list.push_back(nice_name);
|
||||
nice_name_2_id[nice_name] = code_name;
|
||||
}
|
||||
|
@ -55,6 +55,7 @@ void RegisterScreen::init()
|
||||
m_info_widget = getWidget<LabelWidget>("info");
|
||||
assert(m_info_widget);
|
||||
m_info_widget->setDefaultColor();
|
||||
m_info_widget->setText(L"", false);
|
||||
m_options_widget = getWidget<RibbonWidget>("options");
|
||||
assert(m_options_widget);
|
||||
m_password_widget = getWidget<TextBoxWidget>("password");
|
||||
|
@ -221,7 +221,7 @@ std::set<wchar_t> Dictionary::get_all_used_chars()
|
||||
const std::vector<std::string>& msgstrs = i->second;
|
||||
for (unsigned int k = 0; k < msgstrs.size(); k++)
|
||||
{
|
||||
irr::core::stringw ws = translations->fribidize((StringUtils::utf8_to_wide(msgstrs[k].c_str())).c_str());
|
||||
irr::core::stringw ws = translations->fribidize((StringUtils::utf8ToWide(msgstrs[k])).c_str());
|
||||
for (unsigned int l = 0; l < ws.size(); ++l)
|
||||
UsedChars.insert(ws[l]);
|
||||
}
|
||||
@ -234,7 +234,7 @@ std::set<wchar_t> Dictionary::get_all_used_chars()
|
||||
const std::vector<std::string>& msgstrs = j->second;
|
||||
for (unsigned int k = 0; k < msgstrs.size(); k++)
|
||||
{
|
||||
irr::core::stringw ws = translations->fribidize((StringUtils::utf8_to_wide(msgstrs[k].c_str())).c_str());
|
||||
irr::core::stringw ws = translations->fribidize((StringUtils::utf8ToWide(msgstrs[k])).c_str());
|
||||
for (unsigned int l = 0; l < ws.size(); ++l)
|
||||
UsedChars.insert(ws[l]);
|
||||
}
|
||||
|
@ -686,7 +686,7 @@ namespace StringUtils
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
std::string wide_to_utf8(const wchar_t* input)
|
||||
std::string wideToUtf8(const wchar_t* input)
|
||||
{
|
||||
static std::vector<char> utf8line;
|
||||
utf8line.clear();
|
||||
@ -695,11 +695,19 @@ namespace StringUtils
|
||||
utf8line.push_back(0);
|
||||
|
||||
return std::string(&utf8line[0]);
|
||||
}
|
||||
} // wideToUtf8
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Converts the irrlicht wide string to an utf8-encoded std::string.
|
||||
*/
|
||||
std::string wideToUtf8(const irr::core::stringw& input)
|
||||
{
|
||||
return wideToUtf8(input.c_str());
|
||||
} // wideToUtf8
|
||||
|
||||
irr::core::stringw utf8_to_wide(const char* input)
|
||||
// ------------------------------------------------------------------------
|
||||
/** Converts the irrlicht wide string to an utf8-encoded std::string. */
|
||||
irr::core::stringw utf8ToWide(const char* input)
|
||||
{
|
||||
static std::vector<wchar_t> utf16line;
|
||||
utf16line.clear();
|
||||
@ -708,7 +716,14 @@ namespace StringUtils
|
||||
utf16line.push_back(0);
|
||||
|
||||
return irr::core::stringw(&utf16line[0]);
|
||||
}
|
||||
} // utf8ToWide
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Converts a utf8-encoded std::string into an irrlicht wide string. */
|
||||
irr::core::stringw utf8ToWide(const std::string &input)
|
||||
{
|
||||
return utf8ToWide(input.c_str());
|
||||
} // utf8ToWide
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Converts a version string (in the form of 'X.Y.Za-rcU' into an
|
||||
|
@ -226,8 +226,10 @@ namespace StringUtils
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
std::string wide_to_utf8(const wchar_t* input);
|
||||
irr::core::stringw utf8_to_wide(const char* input);
|
||||
irr::core::stringw utf8ToWide(const char* input);
|
||||
irr::core::stringw utf8ToWide(const std::string &input);
|
||||
std::string wideToUtf8(const wchar_t* input);
|
||||
std::string wideToUtf8(const irr::core::stringw& input);
|
||||
|
||||
} // namespace StringUtils
|
||||
|
||||
|
@ -449,7 +449,7 @@ bool Translations::isRTLText(const wchar_t *in_ptr)
|
||||
*/
|
||||
const wchar_t* Translations::w_gettext(const wchar_t* original, const char* context)
|
||||
{
|
||||
std::string in = StringUtils::wide_to_utf8(original);
|
||||
std::string in = StringUtils::wideToUtf8(original);
|
||||
return w_gettext(in.c_str(), context);
|
||||
}
|
||||
|
||||
@ -473,7 +473,7 @@ const wchar_t* Translations::w_gettext(const char* original, const char* context
|
||||
if (original_t == original)
|
||||
{
|
||||
static irr::core::stringw converted_string;
|
||||
converted_string = StringUtils::utf8_to_wide(original);
|
||||
converted_string = StringUtils::utf8ToWide(original);
|
||||
|
||||
#if TRANSLATE_VERBOSE
|
||||
std::wcout << L" translation : " << converted_string << std::endl;
|
||||
@ -485,7 +485,7 @@ const wchar_t* Translations::w_gettext(const char* original, const char* context
|
||||
//for (int n=0;; n+=4)
|
||||
|
||||
static core::stringw original_tw;
|
||||
original_tw = StringUtils::utf8_to_wide(original_t.c_str());
|
||||
original_tw = StringUtils::utf8ToWide(original_t);
|
||||
|
||||
const wchar_t* out_ptr = original_tw.c_str();
|
||||
if (REMOVE_BOM) out_ptr++;
|
||||
@ -506,8 +506,8 @@ const wchar_t* Translations::w_gettext(const char* original, const char* context
|
||||
*/
|
||||
const wchar_t* Translations::w_ngettext(const wchar_t* singular, const wchar_t* plural, int num, const char* context)
|
||||
{
|
||||
std::string in = StringUtils::wide_to_utf8(singular);
|
||||
std::string in2 = StringUtils::wide_to_utf8(plural);
|
||||
std::string in = StringUtils::wideToUtf8(singular);
|
||||
std::string in2 = StringUtils::wideToUtf8(plural);
|
||||
return w_ngettext(in.c_str(), in2.c_str(), num, context);
|
||||
}
|
||||
|
||||
@ -524,8 +524,7 @@ const wchar_t* Translations::w_ngettext(const char* singular, const char* plural
|
||||
m_dictionary.translate_plural(singular, plural, num) :
|
||||
m_dictionary.translate_ctxt_plural(context, singular, plural, num));
|
||||
|
||||
static core::stringw str_buffer;
|
||||
str_buffer = StringUtils::utf8_to_wide(res.c_str());
|
||||
static core::stringw str_buffer = StringUtils::utf8ToWide(res);
|
||||
const wchar_t* out_ptr = str_buffer.c_str();
|
||||
if (REMOVE_BOM) out_ptr++;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user