Added a Jump 'n Bump like way to show statistics.
[supertux.git] / src / scene.cpp
index d78df47..b2fdf45 100644 (file)
 //  along with this program; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
-#include <stdlib.h>
+#include <cstdlib>
+
 #include "scene.h"
+#include "defines.h"
 
 PlayerStatus player_status;
 
 PlayerStatus::PlayerStatus()
-  : score(0),
-    distros(0),
-    lives(3)
+  : distros(0),
+    lives(START_LIVES),
+    bonus(NO_BONUS),
+    score_multiplier(1)
 {
 }
 
-// FIXME: Move this into a view class
-float scroll_x;
+void PlayerStatus::reset()
+{
+  distros = 0;
+  lives = START_LIVES;
+  bonus = NO_BONUS;
+  score_multiplier = 1;
+}
+
+std::string bonus_to_string(PlayerStatus::BonusType b)
+{
+  switch (b)
+    {
+    case PlayerStatus::NO_BONUS:
+      return "none";
+    case PlayerStatus::GROWUP_BONUS:
+      return "growup";
+    case PlayerStatus::FLOWER_BONUS:
+      return "iceflower";
+    default:
+      return "none";
+    }
+}
+
+PlayerStatus::BonusType string_to_bonus(const std::string& str)
+{
+  if (str == "none")
+    return PlayerStatus::NO_BONUS;
+  else if (str == "growup")
+    return PlayerStatus::GROWUP_BONUS;
+  else if (str == "iceflower")
+    return PlayerStatus::FLOWER_BONUS;
+  else
+    return PlayerStatus::NO_BONUS;
+}
 
 unsigned int global_frame_counter;