From: Ricardo Cruz Date: Sun, 31 Oct 2004 15:23:11 +0000 (+0000) Subject: Show combos when a new record is reached. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=4c53a552c13dbe9d587e34e3cf48e82877d09288;p=supertux.git Show combos when a new record is reached. SVN-Revision: 2080 --- diff --git a/src/player.cpp b/src/player.cpp index 9bfde51e4..83fd5d120 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -352,12 +352,15 @@ Player::action(float elapsed_time) /* Reset score multiplier (for multi-hits): */ if (!invincible_timer.started()) { - /*if(player_status.score_multiplier > 2) - { // show a message + if(player_status.score_multiplier > player_status.max_score_multiplier) + { + player_status.max_score_multiplier = player_status.score_multiplier; + + // show a message char str[124]; - sprintf(str, _("%d bad guys in a row!"), player_status.score_multiplier-1); + sprintf(str, _("New max combo: %d"), player_status.max_score_multiplier-1); Sector::current()->add_floating_text(base, str); - }*/ + } player_status.score_multiplier = 1; } } @@ -1266,25 +1269,6 @@ Player::bounce(BadGuy* badguy) flapping = false; falling_from_flap = false; - if(player_status.score_multiplier >= 5) - { // show a message - char str[124]; -// if (player_status.score_multiplier <= 4) {sprintf(str, _("Combo x%d"), player_status.score_multiplier);} - if (player_status.score_multiplier == 5) - sprintf(str, _("Good! x%d"), player_status.score_multiplier); - else if (player_status.score_multiplier == 6) - sprintf(str, _("Great! x%d"), player_status.score_multiplier); - else if (player_status.score_multiplier == 7) - sprintf(str, _("Awesome! x%d"), player_status.score_multiplier); - else if (player_status.score_multiplier == 8) - sprintf(str, _("Incredible! x%d"), player_status.score_multiplier); - else if (player_status.score_multiplier == 9) - sprintf(str, _("Godlike! ;-) x%d"), player_status.score_multiplier); - else - sprintf(str, _("Unbelievable!! x%d"), player_status.score_multiplier); - Sector::current()->add_floating_text(base, str); - } - if (input.jump) physic.set_velocity_y(5.2); else diff --git a/src/scene.cpp b/src/scene.cpp index b2fdf45f3..a2350355f 100644 --- a/src/scene.cpp +++ b/src/scene.cpp @@ -28,7 +28,8 @@ PlayerStatus::PlayerStatus() : distros(0), lives(START_LIVES), bonus(NO_BONUS), - score_multiplier(1) + score_multiplier(1), + max_score_multiplier(1) { } @@ -38,6 +39,7 @@ void PlayerStatus::reset() lives = START_LIVES; bonus = NO_BONUS; score_multiplier = 1; + max_score_multiplier = 1; } std::string bonus_to_string(PlayerStatus::BonusType b) diff --git a/src/scene.h b/src/scene.h index bb7e1d376..23bbb28d8 100644 --- a/src/scene.h +++ b/src/scene.h @@ -34,6 +34,7 @@ struct PlayerStatus BonusType bonus; int score_multiplier; + int max_score_multiplier; PlayerStatus(); diff --git a/src/worldmap.cpp b/src/worldmap.cpp index d746f8f70..360cc3cc0 100644 --- a/src/worldmap.cpp +++ b/src/worldmap.cpp @@ -1257,6 +1257,7 @@ WorldMap::savegame(const std::string& filename) writer->write_string("map", map_filename); writer->write_int("lives", player_status.lives); writer->write_int("distros", player_status.lives); + writer->write_int("max-score-multiplier", player_status.max_score_multiplier); writer->start_list("tux"); @@ -1330,6 +1331,7 @@ WorldMap::loadgame(const std::string& filename) reader.read_int("lives", player_status.lives); reader.read_int("distros", player_status.distros); + reader.read_int("max-score-multiplier", player_status.max_score_multiplier); if (player_status.lives < 0) player_status.lives = START_LIVES;