projects
/
supertux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
you can compare colors now
[supertux.git]
/
src
/
player_status.cpp
diff --git
a/src/player_status.cpp
b/src/player_status.cpp
index
41f5d75
..
72111e6
100644
(file)
--- 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 <config.h>
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <config.h>
-#include <
cmat
h>
+#include <
math.
h>
#include "lisp/writer.hpp"
#include "lisp/lisp.hpp"
#include "player_status.hpp"
#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 "math/vector.hpp"
#include "main.hpp"
#include "log.hpp"
+#include "timer.hpp"
static const int START_COINS = 100;
static const int MAX_COINS = 99999;
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)
{
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");
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_manager->play("sounds/coin.wav");
+ sound_played_time = real_time;
+ }
}
}
}
}