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; mLevelTimeBonusPoints = 0;
} }
int extra_lives = floor ((mPoints + mLevelPoints) / 200000.f) - floor (mPoints / 200000.f);
if (extra_lives > 0) {
mPlayerLives += extra_lives;
}
mLevelPoints += mLevelTimeBonusPoints; mLevelPoints += mLevelTimeBonusPoints;
mPoints += mLevelPoints; mPoints += mLevelPoints;
} }

View File

@ -593,12 +593,13 @@ void View::DrawUiGameOver() {
const static int value_width = 10; const static int value_width = 10;
text_ypos += 64; text_ypos += 48;
// ----- New Score ----- // ----- New Score -----
unsigned int player_points = GetModel()->GetPoints(); unsigned int player_points = GetModel()->GetPoints();
Engine::GUI::Label (1, "At least you made a score of:", if (player_points != 0) {
Engine::GUI::LabelCentered (1, "At least you made a score of:",
text_xpos, text_ypos + 3 text_xpos, text_ypos + 3
); );
@ -607,13 +608,23 @@ void View::DrawUiGameOver() {
stringstream temp_stream; stringstream temp_stream;
temp_stream.str(""); temp_stream.str("");
temp_stream << setw(value_width) << player_points; temp_stream << player_points << " points.";
Engine::GUI::Label (1, temp_stream.str().c_str(), 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_xpos, text_ypos + 3
); );
text_ypos += 64; text_ypos += 32;
Engine::GUI::Label (1, "Play harder!", 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 text_xpos, text_ypos + 3
); );
@ -634,7 +645,7 @@ void View::DrawUiGameOver() {
if (Engine::GUI::Button (2, "Continue...", if (Engine::GUI::Button (2, "Continue...",
(screen_right - button_width) * 0.5, (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 // We do not want the background to show the remaining bits of the game
GetModel()->SetGameState(GameStatePaused); GetModel()->SetGameState(GameStatePaused);
GetModel()->SubmitHighscoreEntry(GetModel()->GetPlayerName(), GetModel()->GetPoints()); GetModel()->SubmitHighscoreEntry(GetModel()->GetPlayerName(), GetModel()->GetPoints());