Platform that hurts Tux and Badguys when touched
[supertux.git] / src / object / tilemap.hpp
index dcd7478..1722719 100644 (file)
@@ -1,7 +1,7 @@
 //  $Id$
 //
-//  SuperTux -  A Jump'n Run
-//  Copyright (C) 2004 Matthias Braun <matze@braunis.de
+//  SuperTux
+//  Copyright (C) 2006 Matthias Braun <matze@braunis.de>
 //
 //  This program is free software; you can redistribute it and/or
 //  modify it under the terms of the GNU General Public License
@@ -16,6 +16,7 @@
 //  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 SUPERTUX_TILEMAP_H
 #define SUPERTUX_TILEMAP_H
 
@@ -25,6 +26,7 @@
 #include "game_object.hpp"
 #include "serializable.hpp"
 #include "math/vector.hpp"
+#include "video/drawing_context.hpp"
 
 namespace lisp {
 class Lisp;
@@ -42,7 +44,7 @@ class TileMap : public GameObject, public Serializable
 public:
   TileMap();
   TileMap(const lisp::Lisp& reader, TileManager* tile_manager = 0);
-  TileMap(int layer_, bool solid_, size_t width_, size_t height_);
+  TileMap(int z_pos, bool solid_, size_t width_, size_t height_);
   virtual ~TileMap();
 
   virtual void write(lisp::Writer& writer);
@@ -51,7 +53,7 @@ public:
   virtual void draw(DrawingContext& context);
 
   void set(int width, int height, const std::vector<unsigned int>& vec,
-      int layer, bool solid);
+      int z_pos, bool solid);
 
   /** resizes the tilemap to a new width and height (tries to not destroy the
    * existing map)
@@ -65,7 +67,7 @@ public:
   { return height; }
 
   int get_layer() const
-  { return layer; }
+  { return z_pos; }
   
   bool is_solid() const
   { return solid; }
@@ -79,17 +81,20 @@ public:
 
   void change_at(const Vector& pos, uint32_t newtile);
 
+  /// changes all tiles with the given ID
+  void change_all(uint32_t oldtile, uint32_t newtile);
+
   TileManager* get_tilemanager() const
   {
     return tilemanager;
   }
 
-  void set_drawing_effect(int effect)
+  void set_drawing_effect(DrawingEffect effect)
   {
     drawing_effect = effect;
   }
 
-  int get_drawing_effect()
+  DrawingEffect get_drawing_effect()
   {
     return drawing_effect;
   }
@@ -103,9 +108,9 @@ private:
   bool solid;
   float speed;
   int width, height;
-  int layer;
+  int z_pos;
 
-  int drawing_effect;
+  DrawingEffect drawing_effect;
 };
 
 #endif /*SUPERTUX_TILEMAP_H*/