6 #include "../math/Vector.h"
7 #include "../graphics/fwd.h"
13 /// Represents a single map in the game.
14 /// Maps are made up of uniform areas of tiles.
15 /// The looks of a tile is defined by the Tileset() sprite with Tile::Offset()
16 /// as the column and row in the sprite.
17 /// Maps can be propulated with triggers and entities. Those are or use with
18 /// MapState and are not handled by the map itself.
19 /// Positions are expressed either as pixel or tile coordinates depending on
20 /// function purpose with (0|0) being the top left corner and positive values
21 /// extending to the right and down respectively.
25 static const int TYPE_ID = 602;
32 /// The sprite used as the tileset.
33 const graphics::Sprite *Tileset() const { return tileset; }
34 /// Returns the Area at given pixel coordinates or 0 if off the map.
35 Area *AreaAt(const math::Vector<int> &);
36 const Area *AreaAt(const math::Vector<int> &) const;
37 /// Returns the Tile at given pixel coordinates or 0 if off the map.
38 Tile *TileAt(const math::Vector<int> &);
39 const Tile *TileAt(const math::Vector<int> &) const;
40 /// Returns the Trigger at given pixel coordinates or 0 if off the map.
41 /// Multiple triggers are not supported. The first one found is returned.
42 Trigger *TriggerAt(const math::Vector<int> &);
43 /// The battle background image for this map if neither the tile nor the
44 /// area has one specified.
45 SDL_Surface *BattleBackgroundAt(const math::Vector<int> &);
46 /// Convert coordinates pixel to tile.
47 math::Vector<int> TileCoordinates(const math::Vector<int> &) const;
49 Entity *EntitiesBegin() { return entities; }
50 Entity *EntitiesEnd() { return entities + numEntities; }
53 /// Entities are not rendered by this function.
54 void Render(SDL_Surface *dest, const math::Vector<int> &offset) const;
55 /// Render a debugging overlay that includes collision and trigger
57 void RenderDebug(SDL_Surface *dest, const math::Vector<int> &offset) const;
59 static void CreateTypeDescription();
60 static void Construct(void *);
63 const graphics::Sprite *tileset;
64 SDL_Surface *battlebg;
77 #endif /* MAP_MAP_H_ */