1 /*
2  * Copyright 2010-2014 OpenXcom Developers.
3  *
4  * This file is part of OpenXcom.
5  *
6  * OpenXcom is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * OpenXcom 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.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with OpenXcom.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 #ifndef OPENXCOM_MAPDATA_H
20 #define OPENXCOM_MAPDATA_H
21 
22 #include "RuleItem.h"
23 
24 namespace OpenXcom
25 {
26 
27 class MapDataSet;
28 
29 enum SpecialTileType{TILE=0,
30 					START_POINT,
31 					UFO_POWER_SOURCE,
32 					UFO_NAVIGATION,
33 					UFO_CONSTRUCTION,
34 					ALIEN_FOOD,
35 					ALIEN_REPRODUCTION,
36 					ALIEN_ENTERTAINMENT,
37 					ALIEN_SURGERY,
38 					EXAM_ROOM,
39 					ALIEN_ALLOYS,
40 					ALIEN_HABITAT,
41 					DEAD_TILE,
42 					END_POINT,
43 					MUST_DESTROY};
44 
45 enum MovementType{ MT_WALK, MT_FLY, MT_SLIDE};
46 enum VoxelType{ V_EMPTY = -1, V_FLOOR, V_WESTWALL, V_NORTHWALL, V_OBJECT, V_UNIT, V_OUTOFBOUNDS };
47 
48 /**
49  * MapData is the smallest piece of a Battlescape terrain, holding info about a certain object, wall, floor, ...
50  * @sa MapDataSet.
51  */
52 class MapData
53 {
54 private:
55 	MapDataSet *_dataset;
56 	SpecialTileType _specialType;
57 	bool _isUfoDoor, _stopLOS, _isNoFloor, _isGravLift, _isDoor, _blockFire, _blockSmoke, _baseModule;
58 	int _yOffset, _TUWalk, _TUFly, _TUSlide, _terrainLevel, _footstepSound, _dieMCD, _altMCD, _objectType, _lightSource;
59 	int _armor, _flammable, _fuel, _explosive, _bigWall;
60 	int _sprite[8];
61 	int _block[6];
62 	int _loftID[12];
63 	unsigned short _miniMapIndex;
64 public:
65 	static const int O_FLOOR;
66 	static const int O_WESTWALL;
67 	static const int O_NORTHWALL;
68 	static const int O_OBJECT;
69 	MapData(MapDataSet *dataset);
70 	~MapData();
71 	/// Gets the dataset this object belongs to.
72 	MapDataSet *getDataset() const;
73 	/// Gets the sprite index for a certain frame.
74 	int getSprite(int frameID) const;
75 	/// Sets the sprite index for a certain frame.
76 	void setSprite(int frameID, int value);
77 	/// Gets whether this is an animated ufo door.
78 	bool isUFODoor() const;
79 	/// Gets whether this is a floor.
80 	bool isNoFloor() const;
81 	/// Gets whether this is a big wall, which blocks all surrounding paths.
82 	int getBigWall() const;
83 	/// Gets whether this is a normal door.
84 	bool isDoor() const;
85 	/// Gets whether this is a grav lift.
86 	bool isGravLift() const;
87 	/// Sets all kinds of flags.
88 	void setFlags(bool isUfoDoor, bool stopLOS, bool isNoFloor, int bigWall, bool isGravLift, bool isDoor, bool blockFire, bool blockSmoke, bool baseModule);
89 	/// Gets the amount of blockage of a certain type.
90 	int getBlock(ItemDamageType type) const;
91 	/// Sets the amount of blockage for all types.
92 	void setBlockValue(int lightBlock, int visionBlock, int HEBlock, int smokeBlock, int fireBlock, int gasBlock);
93 	/// Sets the amount of HE blockage.
94 	void setHEBlock(int HEBlock);
95 	/// Gets the offset on the Y axis when drawing this object.
96 	int getYOffset() const;
97 	/// Sets the offset on the Y axis for drawing this object.
98 	void setYOffset(int value);
99 	/// Gets info about special tile types
100 	SpecialTileType getSpecialType() const;
101 	/// Get the type of tile.
102 	int getObjectType() const;
103 	/// Sets a special tile type and object type.
104 	void setSpecialType(int value, int otype);
105 	/// Gets the TU cost to move over the object.
106 	int getTUCost(MovementType movementType) const;
107 	/// Sets the TU cost to move over the object.
108 	void setTUCosts(int walk, int fly, int slide);
109 	/// Adds this to the graphical Y offset of units or objects on this tile.
110 	int getTerrainLevel() const;
111 	/// Sets Y offset for units/objects on this tile.
112 	void setTerrainLevel(int value);
113 	/// Gets the index to the footstep sound.
114 	int getFootstepSound() const;
115 	/// Sets the index to the footstep sound.
116 	void setFootstepSound(int value);
117 	/// Gets sthe alternative object ID.
118 	int getAltMCD() const;
119 	/// Sets the alternative object ID.
120 	void setAltMCD(int value);
121 	/// Gets the dead object ID.
122 	int getDieMCD() const;
123 	/// Sets the dead object ID.
124 	void setDieMCD(int value);
125 	/// Gets the amount of light the object is emitting.
126 	int getLightSource() const;
127 	/// Sets the amount of light the object is emitting.
128 	void setLightSource(int value);
129 	/// Gets the amount of armor.
130 	int getArmor() const;
131 	/// Sets the amount of armor.
132 	void setArmor(int value);
133 	/// Gets the amount of flammable.
134 	int getFlammable() const;
135 	/// Sets the amount of flammable.
136 	void setFlammable(int value);
137 	/// Gets the amount of fuel.
138 	int getFuel() const;
139 	/// Sets the amount of fuel.
140 	void setFuel(int value);
141 	/// Gets the loft index for a certain layer.
142 	int getLoftID(int layer) const;
143 	/// Sets the loft index for a certain layer.
144 	void setLoftID(int loft, int layer);
145 	/// Gets the amount of explosive.
146 	int getExplosive() const;
147 	/// Sets the amount of explosive.
148 	void setExplosive(int value);
149 	/// Sets the MiniMap index
150 	void setMiniMapIndex(unsigned short i);
151 	/// Gets the MiniMap index
152 	unsigned short getMiniMapIndex() const;
153 	/// Sets the bigwall value.
154 	void setBigWall(const int bigWall);
155 	/// Sets the TUWalk value.
156 	void setTUWalk(const int TUWalk);
157 	/// Sets the TUFly value.
158 	void setTUFly(const int TUFly);
159 	/// Sets the TUSlide value.
160 	void setTUSlide(const int TUSlide);
161 	/// Check if this is an xcom base object.
162 	bool isBaseModule();
163 	/// Sets this tile as not a floor (water, etc.)
164 	void setNoFloor(bool isNoFloor);
165 };
166 
167 }
168 
169 #endif
170