Merge remote-tracking branch 'origin/master' into battleAI
This commit is contained in:
commit
8a0cbea933
@ -1,6 +1,6 @@
|
||||
# root CMakeLists for the SuperTuxKart project
|
||||
project(SuperTuxKart)
|
||||
set(PROJECT_VERSION "0.8.1")
|
||||
set(PROJECT_VERSION "0.9.1")
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.4)
|
||||
if(NOT (CMAKE_MAJOR_VERSION VERSION_LESS 3))
|
||||
@ -15,7 +15,6 @@ if (NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "STKRelease")
|
||||
endif()
|
||||
|
||||
option(USE_WIIUSE "Support for wiimote input devices" ON)
|
||||
option(USE_FRIBIDI "Support for right-to-left languages" ON)
|
||||
option(CHECK_ASSETS "Check if assets are installed in ../stk-assets" ON)
|
||||
option(USE_SYSTEM_ANGELSCRIPT "Use system angelscript instead of built-in angelscript. If you enable this option, make sure to use a compatible version." OFF)
|
||||
@ -32,7 +31,9 @@ else()
|
||||
endif()
|
||||
|
||||
if(MINGW OR CYGWIN)
|
||||
set(USE_WIIUSE OFF)
|
||||
option(USE_WIIUSE "Support for wiimote input devices" OFF)
|
||||
else()
|
||||
option(USE_WIIUSE "Support for wiimote input devices" ON)
|
||||
endif()
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
|
@ -42,13 +42,22 @@
|
||||
#include <hidsdi.h>
|
||||
#include <setupapi.h>
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#if defined(__MINGW32__) && __GNUC__ < 5
|
||||
/* this prototype is missing from the mingw headers so we must add it
|
||||
or suffer linker errors. */
|
||||
|
||||
#ifndef HIDAPI
|
||||
#define HIDAPI
|
||||
#endif
|
||||
|
||||
#ifndef BOOLEAN
|
||||
#define BOOLEAN BOOL
|
||||
#endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
HIDAPI BOOL NTAPI HidD_SetOutputReport(HANDLE, PVOID, ULONG);
|
||||
HIDAPI BOOLEAN NTAPI HidD_SetOutputReport(HANDLE, PVOID, ULONG);
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
|
@ -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;
|
||||
|
||||
|
@ -41,7 +41,7 @@ extern "C" {
|
||||
#elif defined(ANDROID)
|
||||
# include <GLES/gl.h>
|
||||
#elif defined(WIN32)
|
||||
# define _WINSOCKAPI_
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
#else
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
|
@ -82,6 +82,7 @@ please use the included version."
|
||||
using namespace irr;
|
||||
|
||||
#ifdef WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#if defined(__linux__) && !defined(ANDROID)
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "graphics/shaders.hpp"
|
||||
#include "graphics/shared_gpu_objects.hpp"
|
||||
#include "graphics/stk_mesh_scene_node.hpp"
|
||||
#include "graphics/weather.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "karts/kart_model.hpp"
|
||||
@ -1634,6 +1635,22 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode,
|
||||
}
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
}
|
||||
|
||||
// Handle lightning rendering
|
||||
{
|
||||
PROFILER_PUSH_CPU_MARKER("- Lightning", 0xFF, 0x00, 0x00);
|
||||
ScopedGPUTimer Timer(irr_driver->getGPUTimer(Q_LIGHTNING));
|
||||
if (World::getWorld() != NULL)
|
||||
{
|
||||
Weather* m_weather = World::getWorld()->getWeather();
|
||||
|
||||
if (m_weather != NULL && m_weather->shouldLightning())
|
||||
{
|
||||
renderLightning(m_weather->getIntensity());
|
||||
}
|
||||
}
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
}
|
||||
|
||||
// Workaround a bug with srgb fbo on sandy bridge windows
|
||||
if (!CVS->isARBUniformBufferObjectUsable())
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "audio/sfx_manager.hpp"
|
||||
#include "graphics/weather.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "states_screens/race_gui.hpp"
|
||||
#include "utils/random_generator.hpp"
|
||||
|
||||
|
||||
@ -28,11 +27,12 @@
|
||||
|
||||
Weather::Weather(bool lightning, std::string sound)
|
||||
{
|
||||
m_lightning = lightning;
|
||||
m_lightning_enabled = lightning;
|
||||
m_thunder_sound = NULL;
|
||||
m_weather_sound = NULL;
|
||||
m_lightning = 0.0f;
|
||||
|
||||
if (m_lightning)
|
||||
if (m_lightning_enabled)
|
||||
{
|
||||
m_thunder_sound = SFXManager::get()->createSoundSource("thunder");
|
||||
}
|
||||
@ -61,27 +61,30 @@ Weather::~Weather()
|
||||
|
||||
void Weather::update(float dt)
|
||||
{
|
||||
if (m_lightning)
|
||||
if (!m_lightning_enabled)
|
||||
return;
|
||||
|
||||
if (World::getWorld()->getRaceGUI() == NULL)
|
||||
return;
|
||||
|
||||
m_next_lightning -= dt;
|
||||
|
||||
if (m_next_lightning < 0.0f)
|
||||
{
|
||||
m_next_lightning -= dt;
|
||||
|
||||
if (m_next_lightning < 0.0f)
|
||||
startLightning();
|
||||
|
||||
if (m_thunder_sound)
|
||||
{
|
||||
RaceGUIBase* gui_base = World::getWorld()->getRaceGUI();
|
||||
|
||||
if (gui_base != NULL)
|
||||
{
|
||||
gui_base->doLightning();
|
||||
|
||||
if (m_thunder_sound)
|
||||
{
|
||||
m_thunder_sound->play();
|
||||
}
|
||||
}
|
||||
|
||||
RandomGenerator g;
|
||||
m_next_lightning = 35 + (float)g.get(35);
|
||||
m_thunder_sound->play();
|
||||
}
|
||||
|
||||
RandomGenerator g;
|
||||
m_next_lightning = 35 + (float)g.get(35);
|
||||
}
|
||||
|
||||
if (m_lightning > 0.0f)
|
||||
{
|
||||
m_lightning -= dt;
|
||||
}
|
||||
} // update
|
||||
|
||||
@ -95,3 +98,12 @@ void Weather::playSound()
|
||||
m_weather_sound->play();
|
||||
}
|
||||
}
|
||||
|
||||
irr::core::vector3df Weather::getIntensity()
|
||||
{
|
||||
irr::core::vector3df value = {0.7f * m_lightning,
|
||||
0.7f * m_lightning,
|
||||
0.7f * std::min(1.0f, m_lightning * 1.5f)};
|
||||
|
||||
return value;
|
||||
}
|
||||
|
@ -19,12 +19,15 @@
|
||||
#ifndef HEADER_WEATHER_HPP
|
||||
#define HEADER_WEATHER_HPP
|
||||
|
||||
#include <vector3d.h>
|
||||
|
||||
class SFXBase;
|
||||
|
||||
class Weather
|
||||
{
|
||||
bool m_lightning;
|
||||
bool m_lightning_enabled;
|
||||
float m_next_lightning;
|
||||
float m_lightning;
|
||||
|
||||
SFXBase* m_thunder_sound;
|
||||
SFXBase* m_weather_sound;
|
||||
@ -35,6 +38,12 @@ public:
|
||||
|
||||
void update(float dt);
|
||||
void playSound();
|
||||
|
||||
/** Set the flag that a lightning should be shown. */
|
||||
void startLightning() { m_lightning = 1.0f; }
|
||||
bool shouldLightning() { return m_lightning > 0.0f; }
|
||||
|
||||
irr::core::vector3df getIntensity();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "guiengine/engine.hpp"
|
||||
#include "guiengine/skin.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
#include <clocale>
|
||||
@ -62,7 +63,8 @@ ScalableFont::ScalableFont(IGUIEnvironment *env, TTFLoadingType type)
|
||||
// don't grab environment, to avoid circular references
|
||||
m_video_driver = m_gui_env->getVideoDriver();
|
||||
|
||||
m_spritebank = m_gui_env->addEmptySpriteBank((std::to_string(type)).c_str());
|
||||
m_spritebank = m_gui_env->addEmptySpriteBank(
|
||||
(StringUtils::toString(type)).c_str());
|
||||
if (m_spritebank)
|
||||
m_spritebank->grab();
|
||||
}
|
||||
@ -688,11 +690,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 +826,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();
|
||||
}
|
||||
}
|
||||
|
@ -52,6 +52,7 @@ namespace irr {
|
||||
# include <dirent.h>
|
||||
# include <unistd.h>
|
||||
#else
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <direct.h>
|
||||
# include <windows.h>
|
||||
# include <stdio.h>
|
||||
|
@ -122,8 +122,6 @@
|
||||
# include <unistd.h>
|
||||
# endif
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# define _WINSOCKAPI_
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
# ifdef _MSC_VER
|
||||
# include <direct.h>
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
#else
|
||||
# include <sys/time.h>
|
||||
|
@ -361,7 +361,7 @@ void PhysicalObject::init()
|
||||
return;
|
||||
} // switch node->getType()
|
||||
|
||||
std::auto_ptr<TriangleMesh> triangle_mesh(new TriangleMesh());
|
||||
std::unique_ptr<TriangleMesh> triangle_mesh(new TriangleMesh());
|
||||
|
||||
for(unsigned int i=0; i<mesh->getMeshBufferCount(); i++)
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -59,7 +59,6 @@ namespace irr
|
||||
RaceGUIBase::RaceGUIBase()
|
||||
{
|
||||
m_ignore_unimportant_messages = false;
|
||||
m_lightning = 0.0f;
|
||||
m_max_font_height = GUIEngine::getFontHeight() + 10;
|
||||
m_small_font_max_height = GUIEngine::getSmallFontHeight() + 5;
|
||||
//I18N: as in "ready, set, go", shown at the beginning of the race
|
||||
@ -341,7 +340,6 @@ void RaceGUIBase::drawPowerupIcons(const AbstractKart* kart,
|
||||
*/
|
||||
void RaceGUIBase::renderGlobal(float dt)
|
||||
{
|
||||
if (m_lightning > 0.0f) m_lightning -= dt;
|
||||
|
||||
} // renderGlobal
|
||||
|
||||
@ -412,73 +410,7 @@ void RaceGUIBase::preRenderCallback(const Camera *camera)
|
||||
// ----------------------------------------------------------------------------
|
||||
void RaceGUIBase::renderPlayerView(const Camera *camera, float dt)
|
||||
{
|
||||
if (CVS->isGLSL())
|
||||
{
|
||||
if (m_lightning > 0.0f)
|
||||
{
|
||||
core::vector3df intensity = {0.7f * m_lightning,
|
||||
0.7f * m_lightning,
|
||||
0.7f * std::min(1.0f, m_lightning * 1.5f)};
|
||||
irr_driver->getPostProcessing()->renderLightning(intensity);
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
const core::recti &viewport = camera->getViewport();
|
||||
|
||||
if (m_lightning > 0.0f)
|
||||
{
|
||||
GLint glviewport[4];
|
||||
glviewport[0] = viewport.UpperLeftCorner.X;
|
||||
glviewport[1] = viewport.UpperLeftCorner.Y;
|
||||
glviewport[2] = viewport.LowerRightCorner.X;
|
||||
glviewport[3] = viewport.LowerRightCorner.Y;
|
||||
//glGetIntegerv(GL_VIEWPORT, glviewport);
|
||||
|
||||
if (!irr::video::useCoreContext)
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDisable(GL_BLEND);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_ONE, GL_ONE);
|
||||
glColor4f(0.7f*m_lightning, 0.7f*m_lightning, 0.7f*std::min(1.0f, m_lightning*1.5f), 1.0f);
|
||||
glEnable(GL_COLOR_MATERIAL);
|
||||
glDisable(GL_CULL_FACE);
|
||||
glBegin(GL_QUADS);
|
||||
|
||||
glVertex3d(glviewport[0],glviewport[1],0);
|
||||
glVertex3d(glviewport[0],glviewport[3],0);
|
||||
glVertex3d(glviewport[2],glviewport[3],0);
|
||||
glVertex3d(glviewport[2],glviewport[1],0);
|
||||
glEnd();
|
||||
if (!irr::video::useCoreContext)
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
else
|
||||
{
|
||||
GLint glviewport[4];
|
||||
glGetIntegerv(GL_VIEWPORT, glviewport);
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDisable(GL_BLEND);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glColor4f(0.0f, 0.0f, 0.0f, 0.4f);
|
||||
|
||||
glEnable(GL_COLOR_MATERIAL);
|
||||
glDisable(GL_CULL_FACE);
|
||||
glBegin(GL_QUADS);
|
||||
|
||||
glVertex3d(glviewport[0],glviewport[1],0);
|
||||
glVertex3d(glviewport[0],glviewport[3],0);
|
||||
glVertex3d(glviewport[2],glviewport[3],0);
|
||||
glVertex3d(glviewport[2],glviewport[1],0);
|
||||
glEnd();
|
||||
glEnable(GL_BLEND);
|
||||
}
|
||||
#endif
|
||||
} // renderPlayerView
|
||||
|
||||
|
||||
|
@ -68,9 +68,6 @@ public:
|
||||
}; // KartIconDisplayInfo
|
||||
|
||||
private:
|
||||
/** Delight in seconds between lightnings. */
|
||||
float m_lightning;
|
||||
|
||||
/** True if unimportant messags (like item messages) should not
|
||||
* be displayed. */
|
||||
bool m_ignore_unimportant_messages;
|
||||
@ -239,9 +236,6 @@ public:
|
||||
// ------------------------------------------------------------------------
|
||||
virtual void clearAllMessages() { m_messages.clear(); }
|
||||
|
||||
/** Set the flag that a lightning should be shown. */
|
||||
void doLightning() { m_lightning = 1.0f; }
|
||||
|
||||
void drawGlobalPlayerIcons(int bottom_margin);
|
||||
|
||||
}; // RaceGUIBase
|
||||
|
@ -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]);
|
||||
}
|
||||
|
@ -28,6 +28,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
|
@ -74,6 +74,7 @@ Profiler profiler;
|
||||
|
||||
// --- Begin portable precise timer ---
|
||||
#ifdef WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
double getTimeMilliseconds()
|
||||
|
@ -55,6 +55,7 @@ enum QueryPerf
|
||||
Q_BLOOM,
|
||||
Q_TONEMAP,
|
||||
Q_MOTIONBLUR,
|
||||
Q_LIGHTNING,
|
||||
Q_MLAA,
|
||||
Q_GUI,
|
||||
Q_LAST
|
||||
|
@ -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
|
||||
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
#ifdef WIN32
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# define _WINSOCKAPI_
|
||||
# include <windows.h>
|
||||
# include <time.h>
|
||||
#else
|
||||
|
@ -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…
x
Reference in New Issue
Block a user