yeti cleanup and death animation rework, hitbox fix ups
[supertux.git] / src / worldmap.hpp
index 782c212..741863c 100644 (file)
@@ -1,5 +1,5 @@
 //  $Id$
-// 
+//
 //  SuperTux
 //  Copyright (C) 2004 Ingo Ruhnke <grumbel@gmx.de>
 //  Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.de>
@@ -13,7 +13,7 @@
 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 //  GNU General Public License for more details.
-// 
+//
 //  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.
 #include "control/controller.hpp"
 #include "statistics.hpp"
 #include "timer.hpp"
+#include "screen.hpp"
 #include "tile_manager.hpp"
 #include "game_object.hpp"
+#include "console.hpp"
 
 class Sprite;
 class Menu;
@@ -103,17 +105,18 @@ public:
 };
 
 /** */
-class WorldMap
+class WorldMap : public Screen
 {
 private:
   Tux* tux;
 
-  bool quit;
-
   Surface* leveldot_green;
   Surface* leveldot_red;
   Surface* messagedot;
   Sprite* teleporterdot;
+  static WorldMap* current_;
+
+  Vector camera_offset;
 
   std::string name;
   std::string music;
@@ -123,6 +126,8 @@ private:
   TileMap* solids;
   
   TileManager* tile_manager;
+  
+  Console* console;
 
 public:
   struct SpecialTile
@@ -222,16 +227,16 @@ public:
   WorldMap();
   ~WorldMap();
 
-  /** Busy loop */
-  void display();
-
   void load_map();
   
-  void get_input();
-
   void add_object(GameObject* object);
   void clear_objects();
 
+  static WorldMap* current()
+  { return current_; }
+
+  void setup();
+
   /** Update Tux position */
   void update(float delta);
 
@@ -241,6 +246,15 @@ public:
   Vector get_next_tile(Vector pos, Direction direction);
   const Tile* at(Vector pos);
 
+  size_t level_count();
+  size_t solved_level_count();
+
+  /**
+   * gets called from the GameSession when a level has been successfully
+   * finished
+   */
+  void finished_level(const std::string& filename);
+
   WorldMap::Level* at_level();
   WorldMap::SpecialTile* at_special_tile();
 
@@ -248,15 +262,20 @@ public:
       if possible, write the new position to \a new_pos */
   bool path_ok(Direction direction, Vector pos, Vector* new_pos);
 
-  /* Save map to slot */
-  void savegame(const std::string& filename);
-  /* Load map from slot
-     You should call set_map_filename() before this */
-  void loadgame(const std::string& filename);
-  /* Load map directly from file */
+  /**
+   * Save worldmap state to squirrel state table
+   */
+  void save_state();
+  /**
+   * Load worldmap state from squirrel state table
+   */
+  void load_state();
+  /**
+   * Load a worldmap
+   */
   void loadmap(const std::string& filename);
 
-  const std::string& get_world_title() const
+  const std::string& get_title() const
   { return name; }
     
   void set_map_filename(std::string filename)