X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Ftilemap.h;h=92d121dfce8be50d65cfe37eb39ca498c070c69c;hb=546364c9567ef212ea9276201facf73f5ada696a;hp=b629ccd647989df98031b2eaa6770fdfabd8a850;hpb=2074a5e3f8167dec24989c008ddadda14687a3a6;p=supertux.git diff --git a/src/tilemap.h b/src/tilemap.h index b629ccd64..92d121dfc 100644 --- a/src/tilemap.h +++ b/src/tilemap.h @@ -16,19 +16,35 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#ifndef __TILEMAP_H__ -#define __TILEMAP_H__ + +#ifndef SUPERTUX_TILEMAP_H +#define SUPERTUX_TILEMAP_H #include -#include "game_object.h" + +#include "special/game_object.h" #include "serializable.h" -#include "vector.h" +#include "math/vector.h" + +using namespace SuperTux; + +namespace SuperTux { +class LispReader; +} class Level; class TileManager; -class LispReader; class Tile; +struct TileId +{ + TileId() : id(0), hidden(0) {} + explicit TileId(unsigned int i, bool hidden_ = false) : id(i), hidden(hidden_) {} + + unsigned id :31; + unsigned hidden :1; +}; + /** * This class is reponsible for drawing the level tiles */ @@ -37,6 +53,7 @@ class TileMap : public GameObject, public Serializable public: TileMap(); TileMap(LispReader& reader); + TileMap(int layer_, bool solid_, size_t width_, size_t height_); virtual ~TileMap(); virtual void write(LispWriter& writer); @@ -52,16 +69,23 @@ public: */ void resize(int newwidth, int newheight); + /** Flip the all tile map vertically. The purpose of this is to let + player to play the same level in a different way :) */ + void do_vertical_flip(); + size_t get_width() const { return width; } size_t get_height() const { return height; } + + int get_layer() const + { return layer; } bool is_solid() const { return solid; } - unsigned int get_tile_id_at(const Vector& pos) const; + TileId& get_tile_id_at(const Vector& pos); /// returns tile in row y and column y (of the tilemap) Tile* get_tile(int x, int y) const; @@ -72,8 +96,8 @@ public: void change_at(const Vector& pos, unsigned int newtile); -public: - std::vector tiles; +private: + std::vector tiles; private: TileManager* tilemanager; @@ -81,7 +105,9 @@ private: float speed; int width, height; int layer; + + bool vertical_flip; }; -#endif +#endif /*SUPERTUX_TILEMAP_H*/