OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
MapData.h
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 
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();
72  MapDataSet *getDataset() const;
74  int getSprite(int frameID) const;
76  void setSprite(int frameID, int value);
78  bool isUFODoor() const;
80  bool isNoFloor() const;
82  int getBigWall() const;
84  bool isDoor() const;
86  bool isGravLift() const;
88  void setFlags(bool isUfoDoor, bool stopLOS, bool isNoFloor, int bigWall, bool isGravLift, bool isDoor, bool blockFire, bool blockSmoke, bool baseModule);
90  int getBlock(ItemDamageType type) const;
92  void setBlockValue(int lightBlock, int visionBlock, int HEBlock, int smokeBlock, int fireBlock, int gasBlock);
94  void setHEBlock(int HEBlock);
96  int getYOffset() const;
98  void setYOffset(int value);
100  SpecialTileType getSpecialType() const;
102  int getObjectType() const;
104  void setSpecialType(int value, int otype);
106  int getTUCost(MovementType movementType) const;
108  void setTUCosts(int walk, int fly, int slide);
110  int getTerrainLevel() const;
112  void setTerrainLevel(int value);
114  int getFootstepSound() const;
116  void setFootstepSound(int value);
118  int getAltMCD() const;
120  void setAltMCD(int value);
122  int getDieMCD() const;
124  void setDieMCD(int value);
126  int getLightSource() const;
128  void setLightSource(int value);
130  int getArmor() const;
132  void setArmor(int value);
134  int getFlammable() const;
136  void setFlammable(int value);
138  int getFuel() const;
140  void setFuel(int value);
142  int getLoftID(int layer) const;
144  void setLoftID(int loft, int layer);
146  int getExplosive() const;
148  void setExplosive(int value);
150  void setMiniMapIndex(unsigned short i);
152  unsigned short getMiniMapIndex() const;
154  void setBigWall(const int bigWall);
156  void setTUWalk(const int TUWalk);
158  void setTUFly(const int TUFly);
160  void setTUSlide(const int TUSlide);
162  bool isBaseModule();
164  void setNoFloor(bool isNoFloor);
165 };
166 
167 }
168 
169 #endif
void setExplosive(int value)
Sets the amount of explosive.
Definition: MapData.cpp:478
SpecialTileType getSpecialType() const
Gets info about special tile types.
Definition: MapData.cpp:237
int getTUCost(MovementType movementType) const
Gets the TU cost to move over the object.
Definition: MapData.cpp:267
bool isNoFloor() const
Gets whether this is a floor.
Definition: MapData.cpp:94
void setDieMCD(int value)
Sets the dead object ID.
Definition: MapData.cpp:364
void setAltMCD(int value)
Sets the alternative object ID.
Definition: MapData.cpp:346
void setArmor(int value)
Sets the amount of armor.
Definition: MapData.cpp:404
void setHEBlock(int HEBlock)
Sets the amount of HE blockage.
Definition: MapData.cpp:210
int getAltMCD() const
Gets sthe alternative object ID.
Definition: MapData.cpp:337
int getFootstepSound() const
Gets the index to the footstep sound.
Definition: MapData.cpp:319
void setBigWall(const int bigWall)
Sets the bigwall value.
Definition: MapData.cpp:505
void setFuel(int value)
Sets the amount of fuel.
Definition: MapData.cpp:440
void setMiniMapIndex(unsigned short i)
Sets the MiniMap index.
Definition: MapData.cpp:487
bool isUFODoor() const
Gets whether this is an animated ufo door.
Definition: MapData.cpp:85
void setTUSlide(const int TUSlide)
Sets the TUSlide value.
Definition: MapData.cpp:532
void setSpecialType(int value, int otype)
Sets a special tile type and object type.
Definition: MapData.cpp:256
void setFlags(bool isUfoDoor, bool stopLOS, bool isNoFloor, int bigWall, bool isGravLift, bool isDoor, bool blockFire, bool blockSmoke, bool baseModule)
Sets all kinds of flags.
Definition: MapData.cpp:150
void setSprite(int frameID, int value)
Sets the sprite index for a certain frame.
Definition: MapData.cpp:76
MapData is the smallest piece of a Battlescape terrain, holding info about a certain object...
Definition: MapData.h:52
bool isDoor() const
Gets whether this is a normal door.
Definition: MapData.cpp:124
int getTerrainLevel() const
Adds this to the graphical Y offset of units or objects on this tile.
Definition: MapData.cpp:301
int getObjectType() const
Get the type of tile.
Definition: MapData.cpp:246
int getBigWall() const
Gets whether this is a big wall, which blocks all surrounding paths.
Definition: MapData.cpp:114
int getArmor() const
Gets the amount of armor.
Definition: MapData.cpp:395
void setYOffset(int value)
Sets the offset on the Y axis for drawing this object.
Definition: MapData.cpp:228
int getDieMCD() const
Gets the dead object ID.
Definition: MapData.cpp:355
void setFootstepSound(int value)
Sets the index to the footstep sound.
Definition: MapData.cpp:328
void setLoftID(int loft, int layer)
Sets the loft index for a certain layer.
Definition: MapData.cpp:460
int getSprite(int frameID) const
Gets the sprite index for a certain frame.
Definition: MapData.cpp:66
unsigned short getMiniMapIndex() const
Gets the MiniMap index.
Definition: MapData.cpp:496
MapDataSet * getDataset() const
Gets the dataset this object belongs to.
Definition: MapData.cpp:56
void setBlockValue(int lightBlock, int visionBlock, int HEBlock, int smokeBlock, int fireBlock, int gasBlock)
Sets the amount of blockage for all types.
Definition: MapData.cpp:196
void setTUFly(const int TUFly)
Sets the TUFly value.
Definition: MapData.cpp:523
void setTUWalk(const int TUWalk)
Sets the TUWalk value.
Definition: MapData.cpp:514
void setTUCosts(int walk, int fly, int slide)
Sets the TU cost to move over the object.
Definition: MapData.cpp:290
void setTerrainLevel(int value)
Sets Y offset for units/objects on this tile.
Definition: MapData.cpp:310
int getLightSource() const
Gets the amount of light the object is emitting.
Definition: MapData.cpp:373
int getExplosive() const
Gets the amount of explosive.
Definition: MapData.cpp:469
int getLoftID(int layer) const
Gets the loft index for a certain layer.
Definition: MapData.cpp:450
void setLightSource(int value)
Sets the amount of light the object is emitting.
Definition: MapData.cpp:386
bool isBaseModule()
Check if this is an xcom base object.
Definition: MapData.cpp:541
void setNoFloor(bool isNoFloor)
Sets this tile as not a floor (water, etc.)
Definition: MapData.cpp:550
MapData(MapDataSet *dataset)
Creates a new Map Data Object.
Definition: MapData.cpp:28
int getFlammable() const
Gets the amount of flammable.
Definition: MapData.cpp:413
void setFlammable(int value)
Sets the amount of flammable.
Definition: MapData.cpp:422
int getFuel() const
Gets the amount of fuel.
Definition: MapData.cpp:431
bool isGravLift() const
Gets whether this is a grav lift.
Definition: MapData.cpp:133
Represents a Terrain Map Datafile.
Definition: MapDataSet.h:40
int getYOffset() const
Gets the offset on the Y axis when drawing this object.
Definition: MapData.cpp:219
~MapData()
Destroys the object.
Definition: MapData.cpp:41
int getBlock(ItemDamageType type) const
Gets the amount of blockage of a certain type.
Definition: MapData.cpp:168