From 3da81e3c8dbcbeb8f314218f98ff46f5203b21e0 Mon Sep 17 00:00:00 2001 From: deveee Date: Thu, 17 Oct 2013 20:15:12 +0000 Subject: [PATCH] Minor improvements in race result screen - soccer mode - move displaySoccerResult() from displayOneEntry loop - don't display more results than it fits in table - also set max number of goals to 10. playing game to 30 goals doesn't have sense and it's hard to display 30 entries in a half of 800x600 screen. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14276 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/states_screens/race_result_gui.cpp | 95 ++++++++++++---------- src/states_screens/soccer_setup_screen.cpp | 1 + 2 files changed, 54 insertions(+), 42 deletions(-) diff --git a/src/states_screens/race_result_gui.cpp b/src/states_screens/race_result_gui.cpp index f4415d347..bdf29ec0d 100644 --- a/src/states_screens/race_result_gui.cpp +++ b/src/states_screens/race_result_gui.cpp @@ -620,52 +620,54 @@ void RaceResultGUI::renderGlobal(float dt) // Second phase: update X and Y positions for the various animations // ================================================================= float v = 0.9f*UserConfigParams::m_width/m_time_single_scroll; - for(unsigned int i=0; im_x_pos; - float y = ri->m_y_pos; - switch(m_animation_state) + for(unsigned int i=0; i ri->m_start_at) - { // if active - ri->m_x_pos -= dt*v; - if(ri->m_x_posm_x_pos = (float)m_leftmost_column; - x = ri->m_x_pos; - } - break; - case RR_INCREASE_POINTS: - ri->m_current_displayed_points += - dt*race_manager->getPositionScore(1)/m_time_for_points; - if(ri->m_current_displayed_points>ri->m_new_overall_points) + RowInfo *ri = &(m_all_row_infos[i]); + float x = ri->m_x_pos; + float y = ri->m_y_pos; + switch(m_animation_state) { - ri->m_current_displayed_points = - (float)ri->m_new_overall_points; - } - ri->m_new_points -= - dt*race_manager->getPositionScore(1)/m_time_for_points; - if(ri->m_new_points<0) - ri->m_new_points = 0; - break; - case RR_RESORT_TABLE: - x = ri->m_x_pos - - ri->m_radius*sin(m_timer/m_time_rotation*M_PI); - y = ri->m_centre_point - + ri->m_radius*cos(m_timer/m_time_rotation*M_PI); - break; - case RR_WAIT_TILL_END: - break; - } // switch - if(isSoccerWorld) - displaySoccerResults(); - else + // Both states use the same scrolling: + case RR_INIT: break; // Remove compiler warning + case RR_RACE_RESULT: + case RR_OLD_GP_RESULTS: + if(m_timer > ri->m_start_at) + { // if active + ri->m_x_pos -= dt*v; + if(ri->m_x_posm_x_pos = (float)m_leftmost_column; + x = ri->m_x_pos; + } + break; + case RR_INCREASE_POINTS: + ri->m_current_displayed_points += + dt*race_manager->getPositionScore(1)/m_time_for_points; + if(ri->m_current_displayed_points>ri->m_new_overall_points) + { + ri->m_current_displayed_points = + (float)ri->m_new_overall_points; + } + ri->m_new_points -= + dt*race_manager->getPositionScore(1)/m_time_for_points; + if(ri->m_new_points<0) + ri->m_new_points = 0; + break; + case RR_RESORT_TABLE: + x = ri->m_x_pos + - ri->m_radius*sin(m_timer/m_time_rotation*M_PI); + y = ri->m_centre_point + + ri->m_radius*cos(m_timer/m_time_rotation*M_PI); + break; + case RR_WAIT_TILL_END: + break; + } // switch displayOneEntry((unsigned int)x, (unsigned int)y, i, true); - } // for i + } // for i + } + else + displaySoccerResults(); // Display highscores if (race_manager->getMajorMode() != RaceManager::MAJOR_MODE_GRAND_PRIX || @@ -843,6 +845,9 @@ void RaceResultGUI::displaySoccerResults() int currY = (int)ri->m_y_pos; SoccerWorld* soccerWorld = (SoccerWorld*)World::getWorld(); int teamScore[2] = {soccerWorld->getScore(0), soccerWorld->getScore(1)}; + + GUIEngine::Widget *table_area = getWidget("result-table"); + int height = table_area->m_h + table_area->m_y; if(teamScore[0] > teamScore[1]) { @@ -914,7 +919,10 @@ void RaceResultGUI::displaySoccerResults() resultText.append(" "); resultText.append(StringUtils::timeToString(scoreTimes.at(i)).c_str()); rect = m_font->getDimension(resultText.c_str()); + currY += rect.Height; + if(currY > height) break; + pos = core::rect(currX,currY,currX,currY); font->draw(resultText,pos, color, true, false); scorerIcon = soccerWorld->getKart(scorers.at(i))-> @@ -938,7 +946,10 @@ void RaceResultGUI::displaySoccerResults() resultText.append(" "); resultText.append(StringUtils::timeToString(scoreTimes.at(i)).c_str()); rect = m_font->getDimension(resultText.c_str()); + currY += rect.Height; + if(currY > height) break; + pos = core::rect(currX,currY,currX,currY); font->draw(resultText,pos, color, true, false); scorerIcon = soccerWorld->getKart(scorers.at(i))-> diff --git a/src/states_screens/soccer_setup_screen.cpp b/src/states_screens/soccer_setup_screen.cpp index 9c7beebc3..60974b941 100644 --- a/src/states_screens/soccer_setup_screen.cpp +++ b/src/states_screens/soccer_setup_screen.cpp @@ -143,6 +143,7 @@ void SoccerSetupScreen::init() SpinnerWidget* goalamount = getWidget("goalamount"); goalamount->setValue(UserConfigParams::m_num_goals); + goalamount->setMax(10); // Set focus on "continue" ButtonWidget* bt_continue = getWidget("continue");