From 3de922bc194ca96c0938f9552130f1dda830414f Mon Sep 17 00:00:00 2001 From: Marianne Gagnon Date: Sat, 30 Jan 2016 18:11:58 -0500 Subject: [PATCH 1/2] Fix animated textures not working on animated meshes. FIxes #2432 --- src/tracks/track_object_presentation.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/tracks/track_object_presentation.cpp b/src/tracks/track_object_presentation.cpp index 409deaff9..08357029a 100644 --- a/src/tracks/track_object_presentation.cpp +++ b/src/tracks/track_object_presentation.cpp @@ -492,6 +492,10 @@ void TrackObjectPresentationMesh::init(const XMLNode* xml_node, m_frame_end = node->getEndFrame(); if (xml_node) xml_node->get("frame-end", &m_frame_end); + + if (World::getWorld() && World::getWorld()->getTrack() && xml_node) + World::getWorld()->getTrack() + ->handleAnimatedTextures(m_node, *xml_node); } else { From 87862c27ae10361441098ff5609f435679217f86 Mon Sep 17 00:00:00 2001 From: Benau Date: Sun, 31 Jan 2016 10:16:12 +0800 Subject: [PATCH 2/2] Fix #2127 --- src/guiengine/scalable_font.cpp | 1 + src/states_screens/race_gui_base.cpp | 23 ++++++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/guiengine/scalable_font.cpp b/src/guiengine/scalable_font.cpp index 9e665cf19..bf8301814 100644 --- a/src/guiengine/scalable_font.cpp +++ b/src/guiengine/scalable_font.cpp @@ -483,6 +483,7 @@ std::set ScalableFont::getPreloadCharacters(const GUIEngine::TTFLoading for (u32 i = 47; i < 59; ++i) preload_char.insert((wchar_t)i); //Include chars used by timer and laps count only + preload_char.insert((wchar_t)120); //Used when displaying multiple items, e.g. 6x break; case T_BOLD: preload_char = translations->getCurrentAllChar(); //Loading unique characters diff --git a/src/states_screens/race_gui_base.cpp b/src/states_screens/race_gui_base.cpp index 3e4c52f21..3639898c8 100644 --- a/src/states_screens/race_gui_base.cpp +++ b/src/states_screens/race_gui_base.cpp @@ -297,7 +297,7 @@ void RaceGUIBase::cleanupMessages(const float dt) /** Draws the powerup icons on the screen (called once for each player). * \param kart The kart for which to draw the powerup icons. * \param viewport The viewport into which to draw the icons. - * \param scaling The scaling to use when draing the icons. + * \param scaling The scaling to use when drawing the icons. */ void RaceGUIBase::drawPowerupIcons(const AbstractKart* kart, const core::recti &viewport, @@ -309,8 +309,13 @@ void RaceGUIBase::drawPowerupIcons(const AbstractKart* kart, || kart->hasFinishedRace()) return; int n = kart->getPowerup()->getNum() ; + int many_powerups = 0; if (n<1) return; // shouldn't happen, but just in case - if (n>5) n=5; // Display at most 5 items + if (n>5) + { + many_powerups = n; + n = 1; + } int nSize = (int)(64.0f*std::min(scaling.X, scaling.Y)); @@ -320,6 +325,8 @@ void RaceGUIBase::drawPowerupIcons(const AbstractKart* kart, - (n * itemSpacing)/2; int y1 = viewport.UpperLeftCorner.Y + (int)(20 * scaling.Y); + int x2 = 0; + assert(powerup != NULL); assert(powerup->getIcon() != NULL); video::ITexture *t=powerup->getIcon()->getTexture(); @@ -328,11 +335,21 @@ void RaceGUIBase::drawPowerupIcons(const AbstractKart* kart, for ( int i = 0 ; i < n ; i++ ) { - int x2 = (int)(x1+i*itemSpacing); + x2 = (int)(x1+i*itemSpacing); core::rect pos(x2, y1, x2+nSize, y1+nSize); draw2DImage(t, pos, rect, NULL, NULL, true); } // for i + + if (many_powerups > 0) + { + gui::ScalableFont* font = GUIEngine::getHighresDigitFont(); + core::rect pos(x2+nSize, y1, x2+nSize+nSize, y1+nSize); + font->setScale(1.5f); + font->draw(StringUtils::toWString(many_powerups)+L"x", + pos, video::SColor(255, 255, 255, 255)); + font->setScale(1.0f); + } } // drawPowerupIcons // ----------------------------------------------------------------------------