diff --git a/src/states_screens/race_gui.cpp b/src/states_screens/race_gui.cpp index ad080e4a5..4c0eb8f3d 100644 --- a/src/states_screens/race_gui.cpp +++ b/src/states_screens/race_gui.cpp @@ -540,7 +540,8 @@ void RaceGUI::drawGlobalMiniMap() lower_y -(int)(draw_at.getY()-marker_half_size)); // Highlight the player icons with some backgorund image. - if (kart->getController()->isLocalPlayerController()) + if (kart->getController()->isLocalPlayerController() && + m_icons_frame != NULL) { video::SColor colors[4]; for (unsigned int i=0;i<4;i++) diff --git a/src/states_screens/race_gui_base.cpp b/src/states_screens/race_gui_base.cpp index 17f3cc514..0db5a8265 100644 --- a/src/states_screens/race_gui_base.cpp +++ b/src/states_screens/race_gui_base.cpp @@ -73,13 +73,13 @@ RaceGUIBase::RaceGUIBase() m_music_icon = irr_driver->getTexture("notes.png"); if (!m_music_icon) { - Log::fatal("RaceGuiBase", "Can't find 'notes.png' texture, aborting."); + Log::error("RaceGuiBase", "Can't find 'notes.png' texture, aborting."); } m_plunger_face = irr_driver->getTexture("plungerface.png"); if (!m_plunger_face) { - Log::fatal("RaceGuiBase", + Log::error("RaceGuiBase", "Can't find 'plungerface.png' texture, aborting."); } @@ -87,7 +87,7 @@ RaceGUIBase::RaceGUIBase() m_icons_frame = irr_driver->getTexture("icons-frame.png"); if (!m_icons_frame) { - Log::fatal("RaceGuiBase", + Log::error("RaceGuiBase", "Can't find 'icons-frame.png' texture, aborting."); } @@ -590,17 +590,20 @@ void RaceGUIBase::drawGlobalMusicDescription() true /* vcenter */); // Draw music icon - int iconSizeX = (int)(ICON_SIZE*resize + x_pulse*resize*resize); - int iconSizeY = (int)(ICON_SIZE*resize + y_pulse*resize*resize); - - core::rect dest(noteX-iconSizeX/2+20, - noteY-iconSizeY/2+ICON_SIZE/2, - noteX+iconSizeX/2+20, - noteY+iconSizeY/2+ICON_SIZE/2); - const core::rect source(core::position2d(0,0), - m_music_icon->getSize()); - - draw2DImage(m_music_icon, dest, source, NULL, NULL, true); + if (m_music_icon != NULL) + { + int iconSizeX = (int)(ICON_SIZE*resize + x_pulse*resize*resize); + int iconSizeY = (int)(ICON_SIZE*resize + y_pulse*resize*resize); + + core::rect dest(noteX-iconSizeX/2+20, + noteY-iconSizeY/2+ICON_SIZE/2, + noteX+iconSizeX/2+20, + noteY+iconSizeY/2+ICON_SIZE/2); + const core::rect source(core::position2d(0,0), + m_music_icon->getSize()); + + draw2DImage(m_music_icon, dest, source, NULL, NULL, true); + } #endif } // drawGlobalMusicDescription @@ -870,7 +873,8 @@ void RaceGUIBase::drawGlobalPlayerIcons(int bottom_margin) const core::rect pos(x, y, x+w, y+w); //to bring to light the player's icon: add a background - if (kart->getController()->isLocalPlayerController()) + if (kart->getController()->isLocalPlayerController() && + m_icons_frame != NULL) { video::SColor colors[4]; for (unsigned int i=0;i<4;i++) @@ -1066,24 +1070,27 @@ void RaceGUIBase::drawPlungerInFace(const Camera *camera, float dt) m_plunger_offset.Y += (int)(m_plunger_speed.Y * dt); } - const int plunger_size = (int)(0.6f * screen_width); - int offset_y = viewport.UpperLeftCorner.Y + viewport.getHeight()/2 - - plunger_size/2 - m_plunger_offset.Y; - - int plunger_x = viewport.UpperLeftCorner.X + screen_width/2 - - plunger_size/2; - - plunger_x += (int)m_plunger_offset.X; - core::rect dest(plunger_x, offset_y, - plunger_x+plunger_size, offset_y+plunger_size); - - const core::rect source(core::position2d(0,0), - m_plunger_face->getSize()); - - draw2DImage(m_plunger_face, dest, source, - &viewport /* clip */, - NULL /* color */, - true /* alpha */ ); + if (m_plunger_face != NULL) + { + const int plunger_size = (int)(0.6f * screen_width); + int offset_y = viewport.UpperLeftCorner.Y + viewport.getHeight()/2 + - plunger_size/2 - m_plunger_offset.Y; + + int plunger_x = viewport.UpperLeftCorner.X + screen_width/2 + - plunger_size/2; + + plunger_x += (int)m_plunger_offset.X; + core::rect dest(plunger_x, offset_y, + plunger_x+plunger_size, offset_y+plunger_size); + + const core::rect source(core::position2d(0,0), + m_plunger_face->getSize()); + + draw2DImage(m_plunger_face, dest, source, + &viewport /* clip */, + NULL /* color */, + true /* alpha */ ); + } #endif // !SERVER_ONLY } // drawPlungerInFace diff --git a/src/states_screens/race_gui_base.hpp b/src/states_screens/race_gui_base.hpp index 889e0ddbd..c60a721d2 100644 --- a/src/states_screens/race_gui_base.hpp +++ b/src/states_screens/race_gui_base.hpp @@ -127,6 +127,9 @@ private: /** Musical notes icon (for music description and credits) */ video::ITexture* m_music_icon; + /** Texture for the 'plunger in the face' texture. */ + video::ITexture* m_plunger_face; + /** Translated strings 'ready', 'set', 'go'. */ core::stringw m_string_ready, m_string_set, m_string_go, m_string_goal; @@ -146,8 +149,6 @@ private: protected: - /** Texture for the 'plunger in the face' texture. */ - video::ITexture* m_plunger_face; /** State of the plunger: From the 'init' states the plunger switches * between two slow moving states ('shakily moving') till the end of diff --git a/src/states_screens/race_gui_overworld.cpp b/src/states_screens/race_gui_overworld.cpp index eb7b56915..0b7405760 100644 --- a/src/states_screens/race_gui_overworld.cpp +++ b/src/states_screens/race_gui_overworld.cpp @@ -477,7 +477,8 @@ void RaceGUIOverworld::drawGlobalMiniMap() lower_y -(int)(draw_at.getY()-marker_half_size)); // Highlight the player icons with some backgorund image. - if (kart->getController()->isLocalPlayerController()) + if (kart->getController()->isLocalPlayerController() && + m_icons_frame != NULL) { video::SColor colors[4]; for (unsigned int i=0;i<4;i++)