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"
34 /** This type holds meta-information about a level-subset.
35 It could be extended to handle manipulation of subsets. */
42 static void create(const std::string& subset_name);
43 void load(char *subset);
48 std::string description;
53 void parse(lisp_object_t* cursor);
56 #define LEVEL_NAME_MAX 20
76 MusicRef level_song_fast;
80 std::string song_title;
81 std::string bkgd_image;
82 std::string particle_system;
83 std::vector<unsigned int> bg_tiles; /* Tiles in the background */
84 std::vector<unsigned int> ia_tiles; /* Tiles which can interact in the game (solids for example)*/
85 std::vector<unsigned int> fg_tiles; /* Tiles in the foreground */
86 // std::vector<unsigned int> bg_tiles[15]; /* Tiles in the background */
87 // std::vector<unsigned int> ia_tiles[15]; /* Tiles which can interact in the game (solids for example)*/
88 // std::vector<unsigned int> fg_tiles[15]; /* Tiles in the foreground */
99 float hor_autoscroll_speed;
101 /** A collection of points to which Tux can be reset after a lost live */
102 std::vector<ResetPoint> reset_points;
105 Level(const std::string& subset, int level, World* world);
106 Level(const std::string& filename, World* world);
109 /** Will the Level structure with default values */
110 void init_defaults();
112 /** Cleanup the level struct from allocated tile data and such */
115 /** Load data for this level:
116 Returns -1, if the loading of the level failed.
117 XXX the world parameter is a temporary hack
119 int load(const std::string& subset, int level, World* world);
121 /** Load data for this level:
122 Returns -1, if the loading of the level failed.
123 XXX the world parameter is a temporary hack
125 int load(const std::string& filename, World* world);
131 MusicRef get_level_music();
132 MusicRef get_level_music_fast();
134 // XXX the world parameter is a temporary hack
135 void save(const std::string& subset, int level, World* world);
137 /** Edit a piece of the map! */
138 void change(float x, float y, int tm, unsigned int c);
140 /** Resize the level to a new width/height */
141 void resize(int new_width, int new_height);
143 /* Draw background */
146 /** Return the id of the tile at position x/y */
147 unsigned int gettileid(float x, float y) const;
148 /** returns the id of the tile at position x,y
149 * (these are logical and not pixel coordinates)
151 unsigned int get_tile_at(int x, int y) const;
153 void load_image(Surface** ptexture, std::string theme, const char * file, int use_alpha);
156 #endif /*SUPERTUX_LEVEL_H*/