fix menu width, didn't committ the tileset fix, miscelaneous small fixes
[supertux.git] / src / player_status.hpp
index 4ad7a68..0660d68 100644 (file)
 #ifndef SUPERTUX_PLAYERSTATUS_H
 #define SUPERTUX_PLAYERSTATUS_H
 
+#include <assert.h>
+#include <memory>
 #include "lisp/lisp.hpp"
 #include "timer.hpp"
 #include "serializable.hpp"
+#include "sprite/sprite.hpp"
+#include "console.hpp"
+
+static const float BORDER_X = 10;
+static const float BORDER_Y = 10;
 
 enum BonusType {
   NO_BONUS, GROWUP_BONUS, FIRE_BONUS, ICE_BONUS
@@ -32,28 +39,53 @@ class DrawingContext;
  * This class memorizes player status between different game sessions (for
  * example when switching maps in the worldmap)
  */
-class PlayerStatus : public Serializable
+class PlayerStatus : public Serializable, public ConsoleCommandReceiver
 {
 public:
   PlayerStatus();
+  ~PlayerStatus();
   void reset();     
-  void incLives();
-  void incCoins();
+  void add_coins(int count);
+  void set_keys(int new_key);
 
   void write(lisp::Writer& writer);
   void read(const lisp::Lisp& lisp);
 
   void draw(DrawingContext& context);
+  void draw_keys(DrawingContext& context);
 
+  bool consoleCommand(std::string command, std::vector<std::string> arguments); /**< callback from Console; return false if command was unknown, true otherwise */
+  
   int  coins;
-  int  lives;
   BonusType bonus;
 
   int score_multiplier;
   int max_score_multiplier;
+
+  void operator= (const PlayerStatus& other);
+  
+  enum {
+    KEY_BRASS  = 0x001,
+    KEY_IRON   = 0x002,
+    KEY_BRONZE = 0x004,
+    KEY_SILVER = 0x008,
+    KEY_GOLD   = 0x010,
+  };
+
+private:
+  // don't use this
+  PlayerStatus(const PlayerStatus& other);
+  
+  int  keys;
+  std::auto_ptr<Sprite> tux_life;
+  std::auto_ptr<Sprite> key_iron;
+  std::auto_ptr<Sprite> key_brass;
+  std::auto_ptr<Sprite> key_bronze;
+  std::auto_ptr<Sprite> key_silver;
+  std::auto_ptr<Sprite> key_gold;
 };
 
 // global player state
-extern PlayerStatus player_status;
+extern PlayerStatus* player_status;
 
 #endif