Merged changes from branches/supertux-milestone2-grumbel/ to trunk/supertux/
[supertux.git] / src / supertux / player_status.hpp
1 //  SuperTux
2 //  Copyright (C) 2003 Tobias Glaesser <tobi.web@gmx.de>
3 //  Copyright (C) 2006 Matthias Braun <matze@braunis.de>
4 //
5 //  This program is free software: you can redistribute it and/or modify
6 //  it under the terms of the GNU General Public License as published by
7 //  the Free Software Foundation, either version 3 of the License, or
8 //  (at your option) any later version.
9 //
10 //  This program is distributed in the hope that it will be useful,
11 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 //  GNU General Public License for more details.
14 //
15 //  You should have received a copy of the GNU General Public License
16 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18 #ifndef HEADER_SUPERTUX_SUPERTUX_PLAYER_STATUS_HPP
19 #define HEADER_SUPERTUX_SUPERTUX_PLAYER_STATUS_HPP
20
21 #include <memory>
22
23 #include "util/reader_fwd.hpp"
24 #include "util/writer_fwd.hpp"
25 #include "video/color.hpp"
26
27 class Surface;
28
29 static const float BORDER_X = 10;
30 static const float BORDER_Y = 10;
31
32 enum BonusType {
33   NO_BONUS, GROWUP_BONUS, FIRE_BONUS, ICE_BONUS
34 };
35 class DrawingContext;
36
37 /**
38  * This class memorizes player status between different game sessions (for
39  * example when switching maps in the worldmap)
40  */
41 class PlayerStatus
42 {
43   static Color text_color;
44 public:
45   PlayerStatus();
46   ~PlayerStatus();
47   void reset();
48   void add_coins(int count, bool play_sound = true);
49
50   void write(lisp::Writer& writer);
51   void read(const Reader& lisp);
52
53   void draw(DrawingContext& context);
54
55   int  coins;
56   BonusType bonus;
57   int max_fire_bullets; /**< maximum number of fire bullets in play */
58   int max_ice_bullets; /**< maximum number of ice bullets in play */
59
60   void operator= (const PlayerStatus& other);
61
62 private:
63   // don't use this
64   PlayerStatus(const PlayerStatus& other);
65
66   std::auto_ptr<Surface> coin_surface;
67 };
68
69 // global player state
70 extern PlayerStatus* player_status;
71
72 #endif
73
74 /* EOF */