Completed airflower powerup abilities.
[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 #include "video/surface_ptr.hpp"
27
28 static const float BORDER_X = 10;
29 static const float BORDER_Y = 10;
30
31 enum BonusType {
32   NO_BONUS, GROWUP_BONUS, FIRE_BONUS, ICE_BONUS, AIR_BONUS, EARTH_BONUS
33 };
34 class DrawingContext;
35
36 /**
37  * This class keeps player status between different game sessions (for
38  * example when switching maps in the worldmap)
39  */
40 class PlayerStatus
41 {
42   static Color text_color;
43 public:
44   PlayerStatus();
45   ~PlayerStatus();
46   void reset();
47   void add_coins(int count, bool play_sound = true);
48
49   void write(Writer& writer);
50   void read(const Reader& lisp);
51
52   void draw(DrawingContext& context);
53
54 public:
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   int max_air_time; /**<determines maximum number of seconds player can float in air */
60   int max_earth_time; /**< determines maximum number of seconds player can turn to stone */
61
62 private:
63   int displayed_coins;
64   int displayed_coins_frame;
65   SurfacePtr coin_surface;
66
67 private:
68   PlayerStatus(const PlayerStatus&);
69   PlayerStatus& operator=(const PlayerStatus&);
70 };
71
72 #endif
73
74 /* EOF */