Now the growings animation looks pretty cool :)
[supertux.git] / src / level.h
1 //  $Id$
2 // 
3 //  SuperTux
4 //  Copyright (C) 2004 SuperTux Development Team, see AUTHORS for details
5 //
6 //  This program is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU General Public License
8 //  as published by the Free Software Foundation; either version 2
9 //  of the License, or (at your option) any later version.
10 //
11 //  This program is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 //  GNU General Public License for more details.
15 // 
16 //  You should have received a copy of the GNU General Public License
17 //  along with this program; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 //  02111-1307, USA.
20
21 #ifndef SUPERTUX_LEVEL_H
22 #define SUPERTUX_LEVEL_H
23
24 #include <map>
25 #include <string>
26 #include "screen/texture.h"
27 #include "lispreader.h"
28 #include "musicref.h"
29
30 class Tile;
31
32 /** This type holds meta-information about a level-subset. 
33     It could be extended to handle manipulation of subsets. */
34 class LevelSubset
35 {
36 public:
37   LevelSubset();
38   ~LevelSubset();
39
40   static void create(const std::string& subset_name);
41   void load(const char* subset);
42   void save();
43
44   std::string get_level_filename(unsigned int i);
45
46   std::string name;
47   std::string title;
48   std::string description;
49   Surface* image;
50   int levels;
51  
52 private:
53   void parse(lisp_object_t* cursor);
54 };
55
56 class Sector;
57
58 class Level
59 {
60 public:
61   std::string name;
62   std::string author;
63   int time_left;
64   typedef std::map<std::string, Sector*> Sectors;
65   Sectors sectors;
66
67 public:
68   Level();
69   ~Level();
70
71   void load(const std::string& filename);
72   void save(const std::string& filename);
73
74   const std::string& get_name() const
75   { return name; }
76
77   const std::string& get_author() const
78   { return author; }
79
80   void add_sector(Sector* sector);
81
82   Sector* get_sector(const std::string& name);
83
84 private:
85   void load_old_format(LispReader& reader);
86 };
87
88 #endif /*SUPERTUX_LEVEL_H*/