4 // Copyright (C) 2004 SuperTux Development Team, see AUTHORS for details
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.
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.
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
21 #ifndef SUPERTUX_LEVEL_H
22 #define SUPERTUX_LEVEL_H
27 #include "lispreader.h"
33 /** This type holds meta-information about a level-subset.
34 It could be extended to handle manipulation of subsets. */
41 static void create(const std::string& subset_name);
42 void load(char *subset);
47 std::string description;
52 void parse(lisp_object_t* cursor);
55 #define LEVEL_NAME_MAX 20
75 MusicRef level_song_fast;
79 std::string song_title;
80 std::string bkgd_image;
81 std::string particle_system;
82 std::vector<std::vector<unsigned int> > bg_tiles; /* Tiles in the background */
83 std::vector<std::vector<unsigned int> > ia_tiles; /* Tiles which can interact in the game (solids for example)*/
84 std::vector<std::vector<unsigned int> > fg_tiles; /* Tiles in the foreground */
85 // std::vector<unsigned int> bg_tiles[15]; /* Tiles in the background */
86 // std::vector<unsigned int> ia_tiles[15]; /* Tiles which can interact in the game (solids for example)*/
87 // std::vector<unsigned int> fg_tiles[15]; /* Tiles in the foreground */
98 float hor_autoscroll_speed;
100 std::vector<BadGuyData> badguy_data;
101 std::vector< ObjectData<TrampolineData> > trampoline_data;
103 /** A collection of points to which Tux can be reset after a lost live */
104 std::vector<ResetPoint> reset_points;
107 Level(const std::string& subset, int level);
108 Level(const std::string& filename);
111 /** Will the Level structure with default values */
112 void init_defaults();
114 /** Cleanup the level struct from allocated tile data and such */
117 /** Load data for this level:
118 Returns -1, if the loading of the level failed. */
119 int load(const std::string& subset, int level);
121 /** Load data for this level:
122 Returns -1, if the loading of the level failed. */
123 int load(const std::string& filename);
129 MusicRef get_level_music();
130 MusicRef get_level_music_fast();
132 void save(const std::string& subset, int level);
134 /** Edit a piece of the map! */
135 void change(float x, float y, int tm, unsigned int c);
137 /** Resize the level to a new width/height */
138 void change_width (int new_width);
139 void change_height (int new_height);
141 /* Draw background */
144 /** Return the id of the tile at position x/y */
145 unsigned int gettileid(float x, float y) const;
146 /** returns the id of the tile at position x,y
147 * (these are logical and not pixel coordinates)
149 unsigned int get_tile_at(int x, int y) const;
151 void load_image(Surface** ptexture, std::string theme, const char * file, int use_alpha);
154 #endif /*SUPERTUX_LEVEL_H*/