From 6beefb829cbcdc52a4e8388e64a213576b1c3097 Mon Sep 17 00:00:00 2001 From: Fouks0 <42526046+Fouks0@users.noreply.github.com> Date: Thu, 17 Oct 2019 21:07:52 +0200 Subject: [PATCH] Show everyone's items with the left characters icons (#4027) --- src/states_screens/race_gui_base.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/states_screens/race_gui_base.cpp b/src/states_screens/race_gui_base.cpp index 50caa0a2d..77bb1ad9a 100644 --- a/src/states_screens/race_gui_base.cpp +++ b/src/states_screens/race_gui_base.cpp @@ -1075,6 +1075,27 @@ void RaceGUIBase::drawPlayerIcon(AbstractKart *kart, int x, int y, int w, draw2DImage(icon, pos4, rect4, NULL, NULL, true); } + // Current item(s) and how many if > 1 + const Powerup* powerup = kart->getPowerup(); + if (powerup->getType() != PowerupManager::POWERUP_NOTHING && !kart->hasFinishedRace()) + { + int numberItems = kart->getPowerup()->getNum(); + video::ITexture *iconItem = powerup->getIcon()->getTexture(); + assert(iconItem); + + const core::rect rect(core::position2d(0,0), iconItem->getSize()); + const core::rect posItem(x + w/2, y + w/2, x + 5*w/4, y + 5*w/4); + draw2DImage(iconItem, posItem, rect, NULL, NULL, true); + + if (numberItems > 1) + { + gui::ScalableFont* font = GUIEngine::getHighresDigitFont(); + const core::rect posNumber(x + w, y + w/4, x + 7*w/4, y + w); + font->setScale(3.f*((float) w)/(4.f*(float)font->getDimension(L"X").Height)); + font->draw(StringUtils::toWString(numberItems), posNumber, video::SColor(255, 255, 255, 255)); + } + } + //Plunger if (kart->getBlockedByPlungerTicks()>0) {