First version of race result gui in soccer mode
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@13682 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
d0be1fc0a2
commit
ecc27f9d03
@ -35,6 +35,7 @@
|
|||||||
#include "modes/cutscene_world.hpp"
|
#include "modes/cutscene_world.hpp"
|
||||||
#include "modes/demo_world.hpp"
|
#include "modes/demo_world.hpp"
|
||||||
#include "modes/overworld.hpp"
|
#include "modes/overworld.hpp"
|
||||||
|
#include "modes/soccer_world.hpp"
|
||||||
#include "modes/world_with_rank.hpp"
|
#include "modes/world_with_rank.hpp"
|
||||||
#include "race/highscores.hpp"
|
#include "race/highscores.hpp"
|
||||||
#include "states_screens/feature_unlocked.hpp"
|
#include "states_screens/feature_unlocked.hpp"
|
||||||
@ -735,6 +736,12 @@ void RaceResultGUI::determineGPLayout()
|
|||||||
void RaceResultGUI::displayOneEntry(unsigned int x, unsigned int y,
|
void RaceResultGUI::displayOneEntry(unsigned int x, unsigned int y,
|
||||||
unsigned int n, bool display_points)
|
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]);
|
RowInfo *ri = &(m_all_row_infos[n]);
|
||||||
video::SColor color = ri->m_is_player_kart
|
video::SColor color = ri->m_is_player_kart
|
||||||
? video::SColor(255,255,0, 0 )
|
? video::SColor(255,255,0, 0 )
|
||||||
@ -755,7 +762,8 @@ void RaceResultGUI::displayOneEntry(unsigned int x, unsigned int y,
|
|||||||
|
|
||||||
// First draw the icon
|
// First draw the icon
|
||||||
// -------------------
|
// -------------------
|
||||||
if(ri->m_kart_icon)
|
|
||||||
|
if(ri->m_kart_icon && !isSoccerMode)
|
||||||
{
|
{
|
||||||
core::recti source_rect(core::vector2di(0,0),
|
core::recti source_rect(core::vector2di(0,0),
|
||||||
ri->m_kart_icon->getSize());
|
ri->m_kart_icon->getSize());
|
||||||
@ -770,11 +778,34 @@ void RaceResultGUI::displayOneEntry(unsigned int x, unsigned int y,
|
|||||||
|
|
||||||
// Draw the name
|
// Draw the name
|
||||||
// -------------
|
// -------------
|
||||||
core::recti pos_name(current_x, y,
|
if (!isSoccerMode)
|
||||||
UserConfigParams::m_width, y+m_distance_between_rows);
|
{
|
||||||
m_font->draw(ri->m_kart_name, pos_name, color, false, false, NULL,
|
core::recti pos_name(current_x, y,
|
||||||
true /* ignoreRTL */);
|
UserConfigParams::m_width, y+m_distance_between_rows);
|
||||||
current_x += m_width_kart_name + m_width_column_space;
|
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
|
// Draw the time except in FTL mode
|
||||||
// --------------------------------
|
// --------------------------------
|
||||||
@ -820,6 +851,15 @@ void RaceResultGUI::displayOneEntry(unsigned int x, unsigned int y,
|
|||||||
true /* ignoreRTL */);
|
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
|
} // displayOneEntry
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user