extralives should work

main
Martin Felis 2011-04-19 10:58:13 +02:00
parent 8954cf0db0
commit f3ffdc3e31
2 changed files with 30 additions and 14 deletions

View File

@ -772,6 +772,11 @@ void Model::OnLevelComplete() {
mLevelTimeBonusPoints = 0;
}
int extra_lives = floor ((mPoints + mLevelPoints) / 200000.f) - floor (mPoints / 200000.f);
if (extra_lives > 0) {
mPlayerLives += extra_lives;
}
mLevelPoints += mLevelTimeBonusPoints;
mPoints += mLevelPoints;
}

View File

@ -593,27 +593,38 @@ void View::DrawUiGameOver() {
const static int value_width = 10;
text_ypos += 64;
text_ypos += 48;
// ----- New Score -----
unsigned int player_points = GetModel()->GetPoints();
Engine::GUI::Label (1, "At least you made a score of:",
text_xpos, text_ypos + 3
);
if (player_points != 0) {
Engine::GUI::LabelCentered (1, "At least you made a score of:",
text_xpos, text_ypos + 3
);
text_ypos += 32;
text_ypos += 32;
stringstream temp_stream;
temp_stream.str("");
stringstream temp_stream;
temp_stream.str("");
temp_stream << setw(value_width) << player_points;
Engine::GUI::Label (1, temp_stream.str().c_str(),
text_xpos, text_ypos + 3
);
temp_stream << player_points << " points.";
Engine::GUI::LabelCentered (1, temp_stream.str().c_str(),
text_xpos, text_ypos + 3
);
} else {
Engine::GUI::LabelCentered (1, "In fact, it's embarrassing, as you",
text_xpos, text_ypos + 3
);
text_ypos += 64;
Engine::GUI::Label (1, "Play harder!",
text_ypos += 32;
Engine::GUI::LabelCentered (1, "did not even finish a single level.",
text_xpos, text_ypos + 3
);
}
text_ypos += 48;
Engine::GUI::LabelCentered (1, "Play harder!",
text_xpos, text_ypos + 3
);
@ -634,7 +645,7 @@ void View::DrawUiGameOver() {
if (Engine::GUI::Button (2, "Continue...",
(screen_right - button_width) * 0.5,
screen_bottom * 0.5 + 80, button_width, button_height)) {
screen_bottom * 0.5 + 100, button_width, button_height)) {
// We do not want the background to show the remaining bits of the game
GetModel()->SetGameState(GameStatePaused);
GetModel()->SubmitHighscoreEntry(GetModel()->GetPlayerName(), GetModel()->GetPoints());