diff --git a/src/states_screens/race_result_gui.cpp b/src/states_screens/race_result_gui.cpp index 5ef1b549b..4eccc9113 100644 --- a/src/states_screens/race_result_gui.cpp +++ b/src/states_screens/race_result_gui.cpp @@ -35,6 +35,7 @@ #include "modes/cutscene_world.hpp" #include "modes/demo_world.hpp" #include "modes/overworld.hpp" +#include "modes/soccer_world.hpp" #include "modes/world_with_rank.hpp" #include "race/highscores.hpp" #include "states_screens/feature_unlocked.hpp" @@ -735,6 +736,12 @@ void RaceResultGUI::determineGPLayout() void RaceResultGUI::displayOneEntry(unsigned int x, unsigned int y, unsigned int n, bool display_points) { + SoccerWorld* soccerWorld = (SoccerWorld*)World::getWorld(); + bool isSoccerMode = race_manager->getMinorMode() == RaceManager::MINOR_MODE_SOCCER; + int m_team_goals[2] = {soccerWorld->getScore(0), soccerWorld->getScore(1)}; + + if (isSoccerMode && n > 0) return; + RowInfo *ri = &(m_all_row_infos[n]); video::SColor color = ri->m_is_player_kart ? video::SColor(255,255,0, 0 ) @@ -755,7 +762,8 @@ void RaceResultGUI::displayOneEntry(unsigned int x, unsigned int y, // First draw the icon // ------------------- - if(ri->m_kart_icon) + + if(ri->m_kart_icon && !isSoccerMode) { core::recti source_rect(core::vector2di(0,0), ri->m_kart_icon->getSize()); @@ -770,12 +778,35 @@ void RaceResultGUI::displayOneEntry(unsigned int x, unsigned int y, // Draw the name // ------------- - core::recti pos_name(current_x, y, - UserConfigParams::m_width, y+m_distance_between_rows); - m_font->draw(ri->m_kart_name, pos_name, color, false, false, NULL, - true /* ignoreRTL */); - current_x += m_width_kart_name + m_width_column_space; + if (!isSoccerMode) + { + core::recti pos_name(current_x, y, + UserConfigParams::m_width, y+m_distance_between_rows); + m_font->draw(ri->m_kart_name, pos_name, color, false, false, NULL, + true /* ignoreRTL */); + current_x += m_width_kart_name + m_width_column_space; + } + // Draw name of team which won in soccer mode + // ------------------------------------------ + if (isSoccerMode) + { + core::stringw text; + core::recti pos_name(current_x, y, + UserConfigParams::m_width, y+m_distance_between_rows); + + if (m_team_goals[0] > m_team_goals[1]) + text = core::stringw(_("Red team won")); + else if (m_team_goals[0] < m_team_goals[1]) + text = core::stringw(_("Blue team won")); + else + text = core::stringw(_("Draw")); + + m_font->draw(text, pos_name, color, false, false, NULL, true /* ignoreRTL */); + core::dimension2du rect = m_font->getDimension(text.c_str()); + current_x += rect.Width + m_width_column_space; + } + // Draw the time except in FTL mode // -------------------------------- if(race_manager->getMinorMode()!=RaceManager::MINOR_MODE_FOLLOW_LEADER) @@ -819,6 +850,15 @@ void RaceResultGUI::displayOneEntry(unsigned int x, unsigned int y, m_font->draw(point_inc_string, dest_rect, color, false, false, NULL, true /* ignoreRTL */); } + + if (isSoccerMode) + { + char score[256]; + sprintf(score, "%d : %d", m_team_goals[0], m_team_goals[1]); + core::recti dest_rect = core::recti(current_x, y, current_x+100, y+10); + m_font->draw(score, dest_rect, color, false, false, NULL, + true /* ignoreRTL */); + } } // displayOneEntry