X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fscene.cpp;h=429abd07d934c9fa12e8e43ba3549faa56b74ad5;hb=763454f90866bd4e7db95e5884c48a25d6b9bda1;hp=b2fdf45f3030273cbecd77e2df1063a57396051b;hpb=a2857397f9afd626046a2005d2614a14d9e11804;p=supertux.git diff --git a/src/scene.cpp b/src/scene.cpp index b2fdf45f3..429abd07d 100644 --- a/src/scene.cpp +++ b/src/scene.cpp @@ -17,10 +17,13 @@ // 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 "scene.h" #include "defines.h" +#include "resources.h" PlayerStatus player_status; @@ -28,7 +31,8 @@ PlayerStatus::PlayerStatus() : distros(0), lives(START_LIVES), bonus(NO_BONUS), - score_multiplier(1) + score_multiplier(1), + max_score_multiplier(1) { } @@ -38,6 +42,26 @@ void PlayerStatus::reset() 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)