OpenXcom  1.0
Open-source clone of the original X-Com
MapData.h
1 #pragma once
2 /*
3  * Copyright 2010-2016 OpenXcom Developers.
4  *
5  * This file is part of OpenXcom.
6  *
7  * OpenXcom is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * OpenXcom is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
19  */
20 #include "RuleItem.h"
21 
22 namespace OpenXcom
23 {
24 
25 class MapDataSet;
26 
27 enum SpecialTileType{TILE=0,
28  START_POINT,
29  UFO_POWER_SOURCE,
30  UFO_NAVIGATION,
31  UFO_CONSTRUCTION,
32  ALIEN_FOOD,
33  ALIEN_REPRODUCTION,
34  ALIEN_ENTERTAINMENT,
35  ALIEN_SURGERY,
36  EXAM_ROOM,
37  ALIEN_ALLOYS,
38  ALIEN_HABITAT,
39  DEAD_TILE,
40  END_POINT,
41  MUST_DESTROY};
42 
43 enum MovementType{ MT_WALK, MT_FLY, MT_SLIDE, MT_FLOAT, MT_SINK};
44 enum VoxelType{ V_EMPTY = -1, V_FLOOR, V_WESTWALL, V_NORTHWALL, V_OBJECT, V_UNIT, V_OUTOFBOUNDS };
45 enum TilePart { O_FLOOR, O_WESTWALL, O_NORTHWALL, O_OBJECT };
46 
51 class MapData
52 {
53 private:
54  MapDataSet *_dataset;
55  SpecialTileType _specialType;
56  bool _isUfoDoor, _stopLOS, _isNoFloor, _isGravLift, _isDoor, _blockFire, _blockSmoke, _baseModule;
57  int _yOffset, _TUWalk, _TUFly, _TUSlide, _terrainLevel, _footstepSound, _dieMCD, _altMCD;
58  TilePart _objectType;
59  int _lightSource;
60  int _armor, _flammable, _fuel, _explosive, _explosiveType, _bigWall;
61  int _sprite[8];
62  int _block[6];
63  int _loftID[12];
64  unsigned short _miniMapIndex;
65 public:
66  static const int O_DUMMY = 999;
67  MapData(MapDataSet *dataset);
68  ~MapData();
70  MapDataSet *getDataset() const;
72  int getSprite(int frameID) const;
74  void setSprite(int frameID, int value);
76  bool isUFODoor() const;
78  bool isNoFloor() const;
80  int getBigWall() const;
82  bool isDoor() const;
84  bool isGravLift() const;
86  void setFlags(bool isUfoDoor, bool stopLOS, bool isNoFloor, int bigWall, bool isGravLift, bool isDoor, bool blockFire, bool blockSmoke, bool baseModule);
88  int getBlock(ItemDamageType type) const;
90  void setBlockValue(int lightBlock, int visionBlock, int HEBlock, int smokeBlock, int fireBlock, int gasBlock);
92  void setHEBlock(int HEBlock);
94  int getYOffset() const;
96  void setYOffset(int value);
98  void setObjectType(TilePart type);
100  TilePart getObjectType() const;
102  SpecialTileType getSpecialType() const;
104  void setSpecialType(int value, TilePart 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  int getExplosiveType() const;
152  void setExplosiveType(int value);
154  void setMiniMapIndex(unsigned short i);
156  unsigned short getMiniMapIndex() const;
158  void setBigWall(const int bigWall);
160  void setTUWalk(const int TUWalk);
162  void setTUFly(const int TUFly);
164  void setTUSlide(const int TUSlide);
166  bool isBaseModule() const;
168  void setNoFloor(bool isNoFloor);
170  void setStopLOS(bool stopLOS);
171 };
172 
173 }
bool isBaseModule() const
Check if this is an xcom base object.
Definition: MapData.cpp:561
bool isUFODoor() const
Gets whether this is an animated ufo door.
Definition: MapData.cpp:79
bool isNoFloor() const
Gets whether this is a floor.
Definition: MapData.cpp:88
void setExplosive(int value)
Sets the amount of explosive.
Definition: MapData.cpp:480
int getExplosive() const
Gets the amount of explosive.
Definition: MapData.cpp:471
void setDieMCD(int value)
Sets the dead object ID.
Definition: MapData.cpp:366
void setStopLOS(bool stopLOS)
Sets this tile as not stopping LOS.
Definition: MapData.cpp:579
void setAltMCD(int value)
Sets the alternative object ID.
Definition: MapData.cpp:348
void setArmor(int value)
Sets the amount of armor.
Definition: MapData.cpp:406
void setExplosiveType(int value)
Sets the type of explosive.
Definition: MapData.cpp:498
int getTUCost(MovementType movementType) const
Gets the TU cost to move over the object.
Definition: MapData.cpp:270
void setHEBlock(int HEBlock)
Sets the amount of HE blockage.
Definition: MapData.cpp:204
int getBigWall() const
Gets whether this is a big wall, which blocks all surrounding paths.
Definition: MapData.cpp:109
SpecialTileType getSpecialType() const
Gets info about special tile types.
Definition: MapData.cpp:231
void setBigWall(const int bigWall)
Sets the bigwall value.
Definition: MapData.cpp:525
bool isDoor() const
Gets whether this is a normal door.
Definition: MapData.cpp:118
void setFuel(int value)
Sets the amount of fuel.
Definition: MapData.cpp:442
int getLoftID(int layer) const
Gets the loft index for a certain layer.
Definition: MapData.cpp:452
MapDataSet * getDataset() const
Gets the dataset this object belongs to.
Definition: MapData.cpp:50
void setMiniMapIndex(unsigned short i)
Sets the MiniMap index.
Definition: MapData.cpp:507
int getAltMCD() const
Gets sthe alternative object ID.
Definition: MapData.cpp:339
int getSprite(int frameID) const
Gets the sprite index for a certain frame.
Definition: MapData.cpp:60
int getDieMCD() const
Gets the dead object ID.
Definition: MapData.cpp:357
void setTUSlide(const int TUSlide)
Sets the TUSlide value.
Definition: MapData.cpp:552
int getFlammable() const
Gets the amount of flammable.
Definition: MapData.cpp:415
unsigned short getMiniMapIndex() const
Gets the MiniMap index.
Definition: MapData.cpp:516
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:144
void setSprite(int frameID, int value)
Sets the sprite index for a certain frame.
Definition: MapData.cpp:70
MapData is the smallest piece of a Battlescape terrain, holding info about a certain object...
Definition: MapData.h:51
int getExplosiveType() const
Gets the type of explosive.
Definition: MapData.cpp:489
void setSpecialType(int value, TilePart otype)
Sets a special tile type and object type.
Definition: MapData.cpp:259
int getFootstepSound() const
Gets the index to the footstep sound.
Definition: MapData.cpp:321
bool isGravLift() const
Gets whether this is a grav lift.
Definition: MapData.cpp:127
int getBlock(ItemDamageType type) const
Gets the amount of blockage of a certain type.
Definition: MapData.cpp:162
void setYOffset(int value)
Sets the offset on the Y axis for drawing this object.
Definition: MapData.cpp:222
void setFootstepSound(int value)
Sets the index to the footstep sound.
Definition: MapData.cpp:330
void setLoftID(int loft, int layer)
Sets the loft index for a certain layer.
Definition: MapData.cpp:462
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:190
void setTUFly(const int TUFly)
Sets the TUFly value.
Definition: MapData.cpp:543
void setTUWalk(const int TUWalk)
Sets the TUWalk value.
Definition: MapData.cpp:534
void setTUCosts(int walk, int fly, int slide)
Sets the TU cost to move over the object.
Definition: MapData.cpp:292
void setTerrainLevel(int value)
Sets Y offset for units/objects on this tile.
Definition: MapData.cpp:312
void setObjectType(TilePart type)
Set the type of tile.
Definition: MapData.cpp:240
int getLightSource() const
Gets the amount of light the object is emitting.
Definition: MapData.cpp:375
void setLightSource(int value)
Sets the amount of light the object is emitting.
Definition: MapData.cpp:388
void setNoFloor(bool isNoFloor)
Sets this tile as not a floor (water, etc.)
Definition: MapData.cpp:570
MapData(MapDataSet *dataset)
Creates a new Map Data Object.
Definition: MapData.cpp:28
void setFlammable(int value)
Sets the amount of flammable.
Definition: MapData.cpp:424
int getArmor() const
Gets the amount of armor.
Definition: MapData.cpp:397
int getTerrainLevel() const
Adds this to the graphical Y offset of units or objects on this tile.
Definition: MapData.cpp:303
Represents a Terrain Map Datafile.
Definition: MapDataSet.h:37
int getFuel() const
Gets the amount of fuel.
Definition: MapData.cpp:433
TilePart getObjectType() const
Get the type of tile.
Definition: MapData.cpp:249
~MapData()
Destroys the object.
Definition: MapData.cpp:41
Definition: BaseInfoState.cpp:40
int getYOffset() const
Gets the offset on the Y axis when drawing this object.
Definition: MapData.cpp:213