fixed broken 1-time animations in sprites, fixed collision code returning no-collisio...
[supertux.git] / src / tilemap.h
index c464355..8aa2b48 100644 (file)
 #define SUPERTUX_TILEMAP_H
 
 #include <vector>
+#include <stdint.h>
 
-#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
  */
@@ -64,6 +61,10 @@ 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; }
 
@@ -76,19 +77,17 @@ public:
   bool is_solid() const
   { return solid; }
 
-  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;
+  const Tile* get_tile(int x, int y) const;
   /// returns tile at position pos (in world coordinates)
-  Tile* get_tile_at(const Vector& pos) const;
+  const Tile* get_tile_at(const Vector& pos) const;
 
-  void change(int x, int y, unsigned int newtile);
+  void change(int x, int y, uint32_t newtile);
 
-  void change_at(const Vector& pos, unsigned int newtile);
+  void change_at(const Vector& pos, uint32_t newtile);
 
 private:
-  std::vector<TileId> tiles;
+  std::vector<uint32_t> tiles;
   
 private:
   TileManager* tilemanager;
@@ -96,6 +95,8 @@ private:
   float speed;
   int width, height;
   int layer;
+
+  bool vertical_flip;
 };
 
 #endif /*SUPERTUX_TILEMAP_H*/