1 | // SuperTux |
2 | // Copyright (C) 2004 Ingo Ruhnke <grumbel@gmail.com> |
3 | // Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.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_WORLDMAP_SPECIAL_TILE_HPP |
19 | #define |
20 | |
21 | #include <string> |
22 | |
23 | #include "math/vector.hpp" |
24 | #include "sprite/sprite_ptr.hpp" |
25 | #include "supertux/game_object.hpp" |
26 | |
27 | class ReaderMapping; |
28 | |
29 | namespace worldmap { |
30 | |
31 | class SpecialTile final : public GameObject |
32 | { |
33 | public: |
34 | SpecialTile(const ReaderMapping& mapping); |
35 | virtual ~SpecialTile(); |
36 | |
37 | virtual void draw(DrawingContext& context) override; |
38 | virtual void update(float dt_sec) override; |
39 | |
40 | Vector get_pos() const { return m_pos; } |
41 | std::string get_map_message() const { return m_map_message; } |
42 | bool is_passive_message() const { return m_passive_message; } |
43 | std::string get_script() const { return m_script; } |
44 | |
45 | bool get_apply_action_north() const { return m_apply_action_north; } |
46 | bool get_apply_action_east() const { return m_apply_action_east; } |
47 | bool get_apply_action_south() const { return m_apply_action_south; } |
48 | bool get_apply_action_west() const { return m_apply_action_west; } |
49 | |
50 | private: |
51 | Vector m_pos; |
52 | |
53 | /** Sprite to render instead of guessing what image to draw */ |
54 | SpritePtr m_sprite; |
55 | |
56 | /** Message to show in the Map */ |
57 | std::string m_map_message; |
58 | bool m_passive_message; |
59 | |
60 | /** Script to execute when tile is touched */ |
61 | std::string m_script; |
62 | |
63 | /** Hide special tile */ |
64 | bool m_invisible; |
65 | |
66 | /** Only applies actions (ie. passive messages) when going to that direction */ |
67 | bool m_apply_action_north; |
68 | bool m_apply_action_east; |
69 | bool m_apply_action_south; |
70 | bool m_apply_action_west; |
71 | |
72 | private: |
73 | SpecialTile(const SpecialTile&) = delete; |
74 | SpecialTile& operator=(const SpecialTile&) = delete; |
75 | }; |
76 | |
77 | } // namespace worldmap |
78 | |
79 | #endif |
80 | |
81 | /* EOF */ |
82 | |