X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fplayer_status.cpp;h=72111e6d4eace46516b893ef4fb416837d6f381b;hb=5e0bb78e0d7679399eb0f687ecaf93a91cfcb577;hp=41f5d75ae0f7d0c3dd7b9cf0990ec66b0e4e9de8;hpb=7c579d3ef0a6667c18b53dad84c63c05d2760a84;p=supertux.git diff --git a/src/player_status.cpp b/src/player_status.cpp index 41f5d75ae..72111e6d4 100644 --- a/src/player_status.cpp +++ b/src/player_status.cpp @@ -19,7 +19,7 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include -#include +#include #include "lisp/writer.hpp" #include "lisp/lisp.hpp" #include "player_status.hpp" @@ -31,6 +31,7 @@ #include "math/vector.hpp" #include "main.hpp" #include "log.hpp" +#include "timer.hpp" static const int START_COINS = 100; static const int MAX_COINS = 99999; @@ -65,12 +66,15 @@ void PlayerStatus::reset() void PlayerStatus::add_coins(int count, bool play_sound) { + static float sound_played_time = 0; coins = std::min(coins + count, MAX_COINS); if(play_sound) { if(count >= 100) sound_manager->play("sounds/lifeup.wav"); - else + else if (real_time > sound_played_time + 0.010) { sound_manager->play("sounds/coin.wav"); + sound_played_time = real_time; + } } }