Don't crash if some textures are missing
This commit is contained in:
parent
8a25edf2cc
commit
8885119974
@ -540,7 +540,8 @@ void RaceGUI::drawGlobalMiniMap()
|
|||||||
lower_y -(int)(draw_at.getY()-marker_half_size));
|
lower_y -(int)(draw_at.getY()-marker_half_size));
|
||||||
|
|
||||||
// Highlight the player icons with some backgorund image.
|
// Highlight the player icons with some backgorund image.
|
||||||
if (kart->getController()->isLocalPlayerController())
|
if (kart->getController()->isLocalPlayerController() &&
|
||||||
|
m_icons_frame != NULL)
|
||||||
{
|
{
|
||||||
video::SColor colors[4];
|
video::SColor colors[4];
|
||||||
for (unsigned int i=0;i<4;i++)
|
for (unsigned int i=0;i<4;i++)
|
||||||
|
@ -73,13 +73,13 @@ RaceGUIBase::RaceGUIBase()
|
|||||||
m_music_icon = irr_driver->getTexture("notes.png");
|
m_music_icon = irr_driver->getTexture("notes.png");
|
||||||
if (!m_music_icon)
|
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");
|
m_plunger_face = irr_driver->getTexture("plungerface.png");
|
||||||
if (!m_plunger_face)
|
if (!m_plunger_face)
|
||||||
{
|
{
|
||||||
Log::fatal("RaceGuiBase",
|
Log::error("RaceGuiBase",
|
||||||
"Can't find 'plungerface.png' texture, aborting.");
|
"Can't find 'plungerface.png' texture, aborting.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ RaceGUIBase::RaceGUIBase()
|
|||||||
m_icons_frame = irr_driver->getTexture("icons-frame.png");
|
m_icons_frame = irr_driver->getTexture("icons-frame.png");
|
||||||
if (!m_icons_frame)
|
if (!m_icons_frame)
|
||||||
{
|
{
|
||||||
Log::fatal("RaceGuiBase",
|
Log::error("RaceGuiBase",
|
||||||
"Can't find 'icons-frame.png' texture, aborting.");
|
"Can't find 'icons-frame.png' texture, aborting.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -590,17 +590,20 @@ void RaceGUIBase::drawGlobalMusicDescription()
|
|||||||
true /* vcenter */);
|
true /* vcenter */);
|
||||||
|
|
||||||
// Draw music icon
|
// Draw music icon
|
||||||
int iconSizeX = (int)(ICON_SIZE*resize + x_pulse*resize*resize);
|
if (m_music_icon != NULL)
|
||||||
int iconSizeY = (int)(ICON_SIZE*resize + y_pulse*resize*resize);
|
{
|
||||||
|
int iconSizeX = (int)(ICON_SIZE*resize + x_pulse*resize*resize);
|
||||||
|
int iconSizeY = (int)(ICON_SIZE*resize + y_pulse*resize*resize);
|
||||||
|
|
||||||
core::rect<s32> dest(noteX-iconSizeX/2+20,
|
core::rect<s32> dest(noteX-iconSizeX/2+20,
|
||||||
noteY-iconSizeY/2+ICON_SIZE/2,
|
noteY-iconSizeY/2+ICON_SIZE/2,
|
||||||
noteX+iconSizeX/2+20,
|
noteX+iconSizeX/2+20,
|
||||||
noteY+iconSizeY/2+ICON_SIZE/2);
|
noteY+iconSizeY/2+ICON_SIZE/2);
|
||||||
const core::rect<s32> source(core::position2d<s32>(0,0),
|
const core::rect<s32> source(core::position2d<s32>(0,0),
|
||||||
m_music_icon->getSize());
|
m_music_icon->getSize());
|
||||||
|
|
||||||
draw2DImage(m_music_icon, dest, source, NULL, NULL, true);
|
draw2DImage(m_music_icon, dest, source, NULL, NULL, true);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
} // drawGlobalMusicDescription
|
} // drawGlobalMusicDescription
|
||||||
|
|
||||||
@ -870,7 +873,8 @@ void RaceGUIBase::drawGlobalPlayerIcons(int bottom_margin)
|
|||||||
const core::rect<s32> pos(x, y, x+w, y+w);
|
const core::rect<s32> pos(x, y, x+w, y+w);
|
||||||
|
|
||||||
//to bring to light the player's icon: add a background
|
//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];
|
video::SColor colors[4];
|
||||||
for (unsigned int i=0;i<4;i++)
|
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);
|
m_plunger_offset.Y += (int)(m_plunger_speed.Y * dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
const int plunger_size = (int)(0.6f * screen_width);
|
if (m_plunger_face != NULL)
|
||||||
int offset_y = viewport.UpperLeftCorner.Y + viewport.getHeight()/2
|
{
|
||||||
- plunger_size/2 - m_plunger_offset.Y;
|
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
|
int plunger_x = viewport.UpperLeftCorner.X + screen_width/2
|
||||||
- plunger_size/2;
|
- plunger_size/2;
|
||||||
|
|
||||||
plunger_x += (int)m_plunger_offset.X;
|
plunger_x += (int)m_plunger_offset.X;
|
||||||
core::rect<s32> dest(plunger_x, offset_y,
|
core::rect<s32> dest(plunger_x, offset_y,
|
||||||
plunger_x+plunger_size, offset_y+plunger_size);
|
plunger_x+plunger_size, offset_y+plunger_size);
|
||||||
|
|
||||||
const core::rect<s32> source(core::position2d<s32>(0,0),
|
const core::rect<s32> source(core::position2d<s32>(0,0),
|
||||||
m_plunger_face->getSize());
|
m_plunger_face->getSize());
|
||||||
|
|
||||||
draw2DImage(m_plunger_face, dest, source,
|
draw2DImage(m_plunger_face, dest, source,
|
||||||
&viewport /* clip */,
|
&viewport /* clip */,
|
||||||
NULL /* color */,
|
NULL /* color */,
|
||||||
true /* alpha */ );
|
true /* alpha */ );
|
||||||
|
}
|
||||||
#endif // !SERVER_ONLY
|
#endif // !SERVER_ONLY
|
||||||
} // drawPlungerInFace
|
} // drawPlungerInFace
|
||||||
|
|
||||||
|
@ -127,6 +127,9 @@ private:
|
|||||||
/** Musical notes icon (for music description and credits) */
|
/** Musical notes icon (for music description and credits) */
|
||||||
video::ITexture* m_music_icon;
|
video::ITexture* m_music_icon;
|
||||||
|
|
||||||
|
/** Texture for the 'plunger in the face' texture. */
|
||||||
|
video::ITexture* m_plunger_face;
|
||||||
|
|
||||||
/** Translated strings 'ready', 'set', 'go'. */
|
/** Translated strings 'ready', 'set', 'go'. */
|
||||||
core::stringw m_string_ready, m_string_set, m_string_go, m_string_goal;
|
core::stringw m_string_ready, m_string_set, m_string_go, m_string_goal;
|
||||||
|
|
||||||
@ -146,8 +149,6 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
protected:
|
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
|
/** State of the plunger: From the 'init' states the plunger switches
|
||||||
* between two slow moving states ('shakily moving') till the end of
|
* between two slow moving states ('shakily moving') till the end of
|
||||||
|
@ -477,7 +477,8 @@ void RaceGUIOverworld::drawGlobalMiniMap()
|
|||||||
lower_y -(int)(draw_at.getY()-marker_half_size));
|
lower_y -(int)(draw_at.getY()-marker_half_size));
|
||||||
|
|
||||||
// Highlight the player icons with some backgorund image.
|
// Highlight the player icons with some backgorund image.
|
||||||
if (kart->getController()->isLocalPlayerController())
|
if (kart->getController()->isLocalPlayerController() &&
|
||||||
|
m_icons_frame != NULL)
|
||||||
{
|
{
|
||||||
video::SColor colors[4];
|
video::SColor colors[4];
|
||||||
for (unsigned int i=0;i<4;i++)
|
for (unsigned int i=0;i<4;i++)
|
||||||
|
Loading…
Reference in New Issue
Block a user