diff --git a/src/graphics/2dutils.cpp b/src/graphics/2dutils.cpp index 70890e541..8abbfe379 100644 --- a/src/graphics/2dutils.cpp +++ b/src/graphics/2dutils.cpp @@ -338,26 +338,12 @@ void draw2DImage(const video::ITexture* texture, const core::rect& sourceRect, const core::rect* clip_rect, const video::SColor* const colors, - bool use_alpha_channel_of_texture, - bool draw_translucently) + bool use_alpha_channel_of_texture) { - video::SColor translucence[4] = - { - (unsigned)-1, (unsigned)-1, (unsigned)-1, (unsigned)-1 - }; - for (unsigned i = 0; i < 4; i++) - { - if (colors) - translucence[i] = colors[i]; - if (draw_translucently) - translucence[i].setAlpha(128); - } - if (!CVS->isGLSL()) { irr_driver->getVideoDriver()->draw2DImage(texture, destRect, sourceRect, - clip_rect, draw_translucently ? translucence : colors, - use_alpha_channel_of_texture); + clip_rect, colors, use_alpha_channel_of_texture); return; } @@ -390,10 +376,9 @@ void draw2DImage(const video::ITexture* texture, (s32)render_target_size.Height - clip_rect->LowerRightCorner.Y, clip_rect->getWidth(), clip_rect->getHeight()); } - if (draw_translucently || colors) + if (colors) { - drawTexColoredQuad(texture, draw_translucently ? translucence : colors, - width, height, center_pos_x, + drawTexColoredQuad(texture, colors, width, height, center_pos_x, center_pos_y, tex_center_pos_x, tex_center_pos_y, tex_width, tex_height); } diff --git a/src/graphics/2dutils.hpp b/src/graphics/2dutils.hpp index e7802b234..8fd757acc 100644 --- a/src/graphics/2dutils.hpp +++ b/src/graphics/2dutils.hpp @@ -49,7 +49,7 @@ void draw2DImage(const irr::video::ITexture* texture, const irr::core::rect& sourceRect, const irr::core::rect* clipRect, const irr::video::SColor* const colors, - bool useAlphaChannelOfTexture, bool draw_translucently = false); + bool useAlphaChannelOfTexture); void draw2DImageRotationColor(irr::video::ITexture* texture, const irr::core::rect& destRect, diff --git a/src/states_screens/race_gui.cpp b/src/states_screens/race_gui.cpp index 6e4168a68..18c2574e1 100644 --- a/src/states_screens/race_gui.cpp +++ b/src/states_screens/race_gui.cpp @@ -579,6 +579,8 @@ void RaceGUI::drawGlobalMiniMap() if (ctf_world) { Vec3 draw_at; + video::SColor translucence((unsigned)-1); + translucence.setAlpha(128); if (!ctf_world->isRedFlagInBase()) { track->mapPoint2MiniMap(Track::getCurrentTrack()->getRedFlag().getOrigin(), @@ -588,7 +590,7 @@ void RaceGUI::drawGlobalMiniMap() lower_y -(int)(draw_at.getY()+(m_minimap_player_size/2.2f)), m_map_left+(int)(draw_at.getX()+(m_minimap_player_size/1.4f)), lower_y -(int)(draw_at.getY()-(m_minimap_player_size/2.2f))); - draw2DImage(m_red_flag, rp, rs, NULL, NULL, true, true); + draw2DImage(m_red_flag, rp, rs, NULL, translucence, true); } Vec3 pos = ctf_world->getRedHolder() == -1 ? ctf_world->getRedFlag() : ctf_world->getKart(ctf_world->getRedHolder())->getSmoothedTrans().getOrigin(); @@ -610,7 +612,7 @@ void RaceGUI::drawGlobalMiniMap() lower_y -(int)(draw_at.getY()+(m_minimap_player_size/2.2f)), m_map_left+(int)(draw_at.getX()+(m_minimap_player_size/1.4f)), lower_y -(int)(draw_at.getY()-(m_minimap_player_size/2.2f))); - draw2DImage(m_blue_flag, rp, rs, NULL, NULL, true, true); + draw2DImage(m_blue_flag, rp, rs, NULL, translucence, true); } pos = ctf_world->getBlueHolder() == -1 ? ctf_world->getBlueFlag() : diff --git a/src/states_screens/race_gui_base.cpp b/src/states_screens/race_gui_base.cpp index 8d1a57e7b..3bf00d277 100644 --- a/src/states_screens/race_gui_base.cpp +++ b/src/states_screens/race_gui_base.cpp @@ -1129,7 +1129,12 @@ void RaceGUIBase::drawPlayerIcon(AbstractKart *kart, int x, int y, int w, { const core::rect rect(core::position2d(0,0), icon->getSize()); - draw2DImage(icon, pos, rect, NULL, NULL, true, kart->isGhostKart()); + video::SColor translucence((unsigned)-1); + translucence.setAlpha(128); + if (kart->isGhostKart()) + draw2DImage(icon, pos, rect, NULL, translucence, true); + else + draw2DImage(icon, pos, rect, NULL, NULL, true); } //draw status info - icon fade out in case of rescue/explode