X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fscene.cpp;h=429abd07d934c9fa12e8e43ba3549faa56b74ad5;hb=cf585f019ce5aacf92e252a2f2c60c47255bea52;hp=7c3561485a5868148bb0b2b4cd0d7b04e4e2876e;hpb=236df51d91f0845cd4e06b3269e262911d81f5db;p=supertux.git diff --git a/src/scene.cpp b/src/scene.cpp index 7c3561485..429abd07d 100644 --- a/src/scene.cpp +++ b/src/scene.cpp @@ -17,29 +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 "scene.h" -#include "app/defines.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() { - score = 0; 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)