X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fscene.cpp;h=429abd07d934c9fa12e8e43ba3549faa56b74ad5;hb=5a542dea3c6043703683b68fcaa774f6cb0d9127;hp=c75f02d6331f4781228918e390e139c721a32a21;hpb=ba3017de20ed067884228a4690ece90e342091f4;p=supertux.git diff --git a/src/scene.cpp b/src/scene.cpp index c75f02d63..429abd07d 100644 --- a/src/scene.cpp +++ b/src/scene.cpp @@ -17,19 +17,51 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#include +#include + +#include + #include "scene.h" #include "defines.h" +#include "resources.h" PlayerStatus player_status; PlayerStatus::PlayerStatus() - : score(0), - distros(0), + : distros(0), lives(START_LIVES), bonus(NO_BONUS), - score_multiplier(1) + score_multiplier(1), + max_score_multiplier(1) +{ +} + +void PlayerStatus::reset() +{ + distros = 0; + lives = START_LIVES; + bonus = NO_BONUS; + score_multiplier = 1; + max_score_multiplier = 1; +} + +void +PlayerStatus::incLives() +{ + if(lives < MAX_LIVES) + ++lives; + SoundManager::get()->play_sound(IDToSound(SND_LIFEUP)); +} + +void +PlayerStatus::incCoins() { + distros++; + if(distros >= 100) { + incLives(); + distros = 0; + } + SoundManager::get()->play_sound(IDToSound(SND_DISTRO)); } std::string bonus_to_string(PlayerStatus::BonusType b) @@ -41,7 +73,7 @@ std::string bonus_to_string(PlayerStatus::BonusType b) case PlayerStatus::GROWUP_BONUS: return "growup"; case PlayerStatus::FLOWER_BONUS: - return "icflower"; + return "iceflower"; default: return "none"; } @@ -59,9 +91,6 @@ PlayerStatus::BonusType string_to_bonus(const std::string& str) return PlayerStatus::NO_BONUS; } -// FIXME: Move this into a view class -float scroll_x; - unsigned int global_frame_counter; // EOF //