- fixed bricktile
[supertux.git] / src / level.h
1 //
2 // C Interface: level
3 //
4 // Description:
5 //
6 //
7 // Author: Tobias Glaesser <tobi.web@gmx.de>, (C) 2003
8 //
9 // Copyright: See COPYING file that comes with this distribution
10 //
11 //
12
13 #ifndef SUPERTUX_LEVEL_H
14 #define SUPERTUX_LEVEL_H
15
16 #include <string>
17 #include "texture.h"
18 #include "lispreader.h"
19
20 /* This type holds meta-information about a level-subset. */
21 /* It could be extended to handle manipulation of subsets. */
22 class st_subset
23   {
24   public:
25     st_subset();
26     static void create(const std::string& subset_name);
27     void load(char *subset);
28     void save();
29     void free();
30
31     std::string name;
32     std::string title;
33     std::string description;
34     texture_type image;
35     int levels;
36  
37   private:
38     void parse(lisp_object_t* cursor);
39   };
40
41 #define LEVEL_NAME_MAX 20
42
43 struct st_level 
44 {
45   std::string name;
46   std::string theme;
47   std::string song_title;
48   std::string bkgd_image;
49   std::string particle_system;
50   unsigned int* bg_tiles[15]; /* Tiles in the background */
51   unsigned int* ia_tiles[15]; /* Tiles which can interact in the game (solids for example)*/
52   unsigned int* dn_tiles[15]; /* Dynamic tiles (bad guys and moving platforms for example)*/
53   unsigned int* fg_tiles[15]; /* Tiles in the foreground */
54   int time_left;
55   int bkgd_red;
56   int bkgd_green;
57   int bkgd_blue;
58   int width;
59   float gravity;
60 };
61
62 enum {
63  TM_BG,
64  TM_IA,
65  TM_DN,
66  TM_FG
67  };
68
69 extern texture_type img_bkgd, img_bkgd_tile[2][4], img_solid[4], img_brick[2];
70
71 void level_default  (st_level* plevel);
72 int  level_load     (st_level* plevel, const char * subset, int level);
73 void level_parse    (st_level* plevel, lisp_object_t* cursor);
74 int  level_load     (st_level* plevel, const char* filename);
75 void level_save     (st_level* plevel, const char * subset, int level);
76 void level_free     (st_level* plevel);
77 void level_load_gfx (st_level* plevel);
78 void level_change   (st_level* plevel, float x, float y, int tm, unsigned int c);
79 void level_change_size (st_level* plevel, int new_width);
80 void level_load_song(st_level* plevel);
81 void level_free_gfx();
82 void level_load_image(texture_type* ptexture, std::string theme, const char * file, int use_alpha);
83 void level_free_song(void);
84
85 #endif /*SUPERTUX_LEVEL_H*/