Some work on GPs. @Joerg : when moving to the next race, the models of the first aren't removed

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@4709 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2010-02-14 21:23:38 +00:00
parent fcca86bc9c
commit fa81852562
2 changed files with 76 additions and 50 deletions

View File

@ -188,6 +188,7 @@ void startGPGame(const GrandPrixData* gp)
network_manager->setupPlayerKartInfo();
//race_manager->getKartType(1) = KT_PLAYER;
race_manager->setMajorMode(RaceManager::MAJOR_MODE_GRAND_PRIX);
race_manager->startNew();
}

View File

@ -45,6 +45,12 @@ RaceOverDialog::RaceOverDialog(const float percentWidth,
// Switch to barrier mode: server waits for ack from each client
network_manager->beginRaceResultBarrier();
std::cout << "race_manager->getMajorMode()=" << race_manager->getMajorMode()
<< ", RaceManager::MAJOR_MODE_GRAND_PRIX=" << RaceManager::MAJOR_MODE_GRAND_PRIX
<< ", RaceManager::MAJOR_MODE_SINGLE=" << RaceManager::MAJOR_MODE_SINGLE << "\n";
const bool show_highscores = (race_manager->getMajorMode() != RaceManager::MAJOR_MODE_GRAND_PRIX);
const int text_height = GUIEngine::getFontHeight();
const int button_h = text_height + 6;
@ -52,7 +58,7 @@ RaceOverDialog::RaceOverDialog(const float percentWidth,
const int buttons_y_from = m_area.getHeight() - 3*(button_h + margin_between_buttons);
// ---- Ranking
core::rect< s32 > area(0, 0, m_area.getWidth()*2/3, text_height);
core::rect< s32 > area(0, 0, (show_highscores ? m_area.getWidth()*2/3 : m_area.getWidth()), text_height);
IGUIStaticText* caption = GUIEngine::getGUIEnv()->addStaticText( _("Race Results"),
area, false, false, // border, word warp
m_irrlicht_window);
@ -120,9 +126,11 @@ RaceOverDialog::RaceOverDialog(const float percentWidth,
icon_path += "/karts/" + prop->getIdent() + "/" + prop->getIconFile();
ITexture* kart_icon_texture = irr_driver->getTexture( icon_path );
const int entry_width = (show_highscores? m_area.getWidth()*2/3 : m_area.getWidth());
const int icon_size = text_height;
core::rect< s32 > entry_area(10 + icon_size, lines_from_y+line_h*i,
m_area.getWidth()*2/3, lines_from_y+line_h*(i+1));
entry_width, lines_from_y+line_h*(i+1));
core::rect< s32 > icon_area(5, lines_from_y + line_h*i,
5+icon_size, lines_from_y+ line_h*i + icon_size);
@ -141,6 +149,8 @@ RaceOverDialog::RaceOverDialog(const float percentWidth,
delete[] order;
// ---- Highscores
if (show_highscores)
{
const HighscoreEntry *hs = World::getWorld()->getHighscores();
if (hs != NULL)
{
@ -180,6 +190,7 @@ RaceOverDialog::RaceOverDialog(const float percentWidth,
m_irrlicht_window);
} // next score
} // end if hs != NULL
} // end if not GP
// ---- Buttons at the bottom
if (race_manager->getMajorMode() == RaceManager::MAJOR_MODE_SINGLE)
@ -194,7 +205,6 @@ RaceOverDialog::RaceOverDialog(const float percentWidth,
new_race_btn->setParent(m_irrlicht_window);
m_children.push_back(new_race_btn);
new_race_btn->add();
}
ButtonWidget* race_again_btn = new ButtonWidget();
race_again_btn->m_properties[PROP_ID] = "raceagainbtn";
@ -206,6 +216,21 @@ RaceOverDialog::RaceOverDialog(const float percentWidth,
race_again_btn->setParent(m_irrlicht_window);
m_children.push_back(race_again_btn);
race_again_btn->add();
}
else
{
// grand prix
ButtonWidget* abort_gp = new ButtonWidget();
abort_gp->m_properties[PROP_ID] = "backtomenu";
abort_gp->x = 15;
abort_gp->y = m_area.getHeight() - (button_h + margin_between_buttons)*2;
abort_gp->w = m_area.getWidth() - 30;
abort_gp->h = button_h;
abort_gp->m_text = _("Abort Grand Prix");
abort_gp->setParent(m_irrlicht_window);
m_children.push_back(abort_gp);
abort_gp->add();
}
ButtonWidget* whats_next_btn = new ButtonWidget();
whats_next_btn->x = 15;