Fix INT_MAX definition on some newer systems.
[Tsunagari.git] / src / area-tmx.h
blob3aecf2c704572e88f6f4e40b2036641482b6e53e
1 /***************************************
2 ** Tsunagari Tile Engine **
3 ** area-tmx.h **
4 ** Copyright 2011-2013 PariahSoft LLC **
5 ***************************************/
7 // **********
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to
10 // deal in the Software without restriction, including without limitation the
11 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12 // sell copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
15 // The above copyright notice and this permission notice shall be included in
16 // all copies or substantial portions of the Software.
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 // IN THE SOFTWARE.
25 // **********
27 #ifndef AREA_TMX_H
28 #define AREA_TMX_H
30 #include <string>
32 #include "area.h"
33 #include "tile.h"
34 #include "xml.h"
36 class Viewport;
37 class Player;
39 class AreaTMX : public Area
41 public:
42 AreaTMX(Viewport* view, Player* player, const std::string& filename);
43 virtual ~AreaTMX();
45 //! Parse the file specified in the constructor, generating a full Area
46 //! object. Must be called before use.
47 virtual bool init();
49 private:
50 //! Allocate Tile objects for one layer of map.
51 void allocateMapLayer();
53 //! Parse an Area file.
54 bool processDescriptor();
55 bool processMapProperties(XMLNode node);
56 bool processTileSet(XMLNode node);
57 bool processTileType(XMLNode node, TileType& type,
58 TiledImageRef& img, int id);
59 bool processLayer(XMLNode node);
60 bool processLayerProperties(XMLNode node, double* depth);
61 bool processLayerData(XMLNode node, int z);
62 bool processObjectGroup(XMLNode node);
63 bool processObjectGroupProperties(XMLNode node, double* depth);
64 bool processObject(XMLNode node, int z);
65 bool splitTileFlags(const std::string& strOfFlags, unsigned* flags);
66 bool parseExit(const std::string& dest, Exit* exit,
67 bool* wwide, bool* hwide);
68 bool parseRGBA(const std::string& str,
69 Gosu::Color::Channel* r,
70 Gosu::Color::Channel* g,
71 Gosu::Color::Channel* b,
72 Gosu::Color::Channel* a);
74 std::vector<TileType*> gids;
77 #endif