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"
32 /** This type holds meta-information about a level-subset.
33 It could be extended to handle manipulation of subsets. */
40 static void create(const std::string& subset_name);
41 void load(char *subset);
46 std::string description;
51 void parse(lisp_object_t* cursor);
54 #define LEVEL_NAME_MAX 20
74 MusicRef level_song_fast;
79 std::string song_title;
80 std::string bkgd_image;
81 std::string particle_system;
82 std::vector<unsigned int> bg_tiles[15]; /* Tiles in the background */
83 std::vector<unsigned int> ia_tiles[15]; /* Tiles which can interact in the game (solids for example)*/
84 std::vector<unsigned int> fg_tiles[15]; /* Tiles in the foreground */
93 std::vector<BadGuyData> badguy_data;
95 /** A collection of points to which Tux can be reset after a lost live */
96 std::vector<ResetPoint> reset_points;
99 Level(const std::string& subset, int level);
100 Level(const std::string& filename);
103 /** Will the Level structure with default values */
104 void init_defaults();
106 /** Cleanup the level struct from allocated tile data and such */
109 /** Load data for this level:
110 Returns -1, if the loading of the level failed. */
111 int load(const std::string& subset, int level);
113 /** Load data for this level:
114 Returns -1, if the loading of the level failed. */
115 int load(const std::string& filename);
121 MusicRef get_level_music();
122 MusicRef get_level_music_fast();
124 void save(const std::string& subset, int level);
126 /** Edit a piece of the map! */
127 void change(float x, float y, int tm, unsigned int c);
129 /** Resize the level to a new width */
130 void change_size (int new_width);
132 /** Return the id of the tile at position x/y */
133 unsigned int gettileid(float x, float y) const;
134 /** returns the id of the tile at position x,y
135 * (these are logical and not pixel coordinates)
137 unsigned int get_tile_at(int x, int y) const;
139 void load_image(Surface** ptexture, std::string theme, const char * file, int use_alpha);
142 #endif /*SUPERTUX_LEVEL_H*/