4 // Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
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
24 #include "video/surface.hpp"
25 #include "math/rect.hpp"
26 #include "lisp/lisp.hpp"
34 /// bitset for tile attributes
36 /** solid tile that is indestructable by Tux */
38 /** uni-directional solid tile */
40 /** a brick that can be destroyed by jumping under it */
42 /** an ice brick that makes tux sliding more than usual */
44 /** a water tile in which tux starts to swim */
46 /** a tile that hurts the player if he touches it */
48 /** Bonusbox, content is stored in \a data */
52 /** the level should be finished when touching a goaltile.
53 * if data is 0 then the endsequence should be triggered, if data is 1
54 * then we can finish the level instantly.
63 WORLDMAP_NORTH = 0x0001,
64 WORLDMAP_SOUTH = 0x0002,
65 WORLDMAP_EAST = 0x0004,
66 WORLDMAP_WEST = 0x0008,
68 WORLDMAP_STOP = 0x0010
75 ImageSpec(const std::string& newfile, const Rect& newrect)
76 : file(newfile), rect(newrect)
82 std::vector<ImageSpec> imagespecs;
83 std::vector<Surface*> images;
85 std::string editor_imagefile;
86 Surface* editor_image;
88 /** tile attributes */
91 /** General purpose data attached to a tile (content of a box, type of coin)*/
99 /** Draw a tile on the screen */
100 void draw(DrawingContext& context, const Vector& pos, int layer) const;
102 Surface* get_editor_image() const;
104 unsigned int getID() const
107 Uint32 getAttributes() const
108 { return attributes; }
113 /// returns the width of the tile in pixels
121 /// returns the height of the tiles in pixels
122 int getHeight() const
130 friend class TileManager;
133 void load_images(const std::string& tilesetpath);
135 /// parses the tile and returns it's id number
136 void parse(const lisp::Lisp& reader);
137 void parse_images(const lisp::Lisp& cur);