1 /******************************
2 ** Tsunagari Tile Engine **
4 ** Copyright 2011 OmegaSDG **
5 ******************************/
13 #include <Gosu/Gosu.hpp>
24 This class is responsible for each map, or area in a Tsunagari World.
39 enum TileEventTriggers
{
48 Stores info for an event attached to a tile.
51 TileEventTriggers trigger
;
52 std::string argv
; // Function name and arguments.
57 Contains the properties shared by all tiles of a certain type.
58 E.g.: all grass tiles have the same graphic, and all wall tiles
62 std::vector
<Gosu::Image
*> graphics
;
63 bool animated
; // Is the tile animated?
64 double ani_speed
; // Speed of animation in hertz
65 std::vector
<TileEvent
> events
;
66 std::vector
<TileFlags
> flags
;
71 Stores a tile, including its animation properties, and things
72 attached to it. This is later given to the Tile class
73 constructor through TileMatrix.
77 std::vector
<TileEvent
> events
;
78 std::vector
<TileFlags
> flags
;
83 Area(Resourcer
* rc
, Entity
* player
, const std::string filename
);
91 void buttonDown(const Gosu::Button btn
);
97 bool needsRedraw() const;
99 coord_t
getDimensions() const;
100 Tile
* getTile(coord_t c
);
105 Stores info for a tileset, and global settings for tiles.
109 coord_t tiledim
; // Dimensions per tile
110 std::vector
<TileType
> defaults
; // Global tile properties
115 Stores info for the intro or main music files.
119 std::string filename
;
122 bool processDescriptor();
123 bool processMapProperties(xmlNode
* node
);
124 TileType
defaultTileType(const Gosu::Bitmap source
, coord_t tiledim
,
126 bool processTileset(xmlNode
* node
);
127 bool processTileType(xmlNode
* node
, Tileset
& ts
);
128 bool processLayer(xmlNode
* node
);
129 bool processLayerProperties(xmlNode
* node
);
130 bool processLayerData(xmlNode
* node
);
131 bool processObjectGroup(xmlNode
* node
);
132 bool processObjectGroupProperties(xmlNode
* node
, unsigned* zpos
);
133 bool processObject(xmlNode
* node
, unsigned zpos
);
138 const std::string descriptor
;
140 typedef std::vector
<Tile
*> row_t
;
141 typedef std::vector
<row_t
> grid_t
;
142 typedef std::vector
<grid_t
> tilematrix_t
;
144 /* All layers in the map must be in the range of [0, n]. There cannot be
152 std::vector
<Tileset
> tilesets
;
156 std::string onLoadEvents
;