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 MapDataType { 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, _objectType, _lightSource;
58  int _armor, _flammable, _fuel, _explosive, _explosiveType, _bigWall;
59  int _sprite[8];
60  int _block[6];
61  int _loftID[12];
62  unsigned short _miniMapIndex;
63 public:
64  MapData(MapDataSet *dataset);
65  ~MapData();
67  MapDataSet *getDataset() const;
69  int getSprite(int frameID) const;
71  void setSprite(int frameID, int value);
73  bool isUFODoor() const;
75  bool isNoFloor() const;
77  int getBigWall() const;
79  bool isDoor() const;
81  bool isGravLift() const;
83  void setFlags(bool isUfoDoor, bool stopLOS, bool isNoFloor, int bigWall, bool isGravLift, bool isDoor, bool blockFire, bool blockSmoke, bool baseModule);
85  int getBlock(ItemDamageType type) const;
87  void setBlockValue(int lightBlock, int visionBlock, int HEBlock, int smokeBlock, int fireBlock, int gasBlock);
89  void setHEBlock(int HEBlock);
91  int getYOffset() const;
93  void setYOffset(int value);
95  void setObjectType(int type);
97  int getObjectType() const;
99  SpecialTileType getSpecialType() const;
101  void setSpecialType(int value, int otype);
103  int getTUCost(MovementType movementType) const;
105  void setTUCosts(int walk, int fly, int slide);
107  int getTerrainLevel() const;
109  void setTerrainLevel(int value);
111  int getFootstepSound() const;
113  void setFootstepSound(int value);
115  int getAltMCD() const;
117  void setAltMCD(int value);
119  int getDieMCD() const;
121  void setDieMCD(int value);
123  int getLightSource() const;
125  void setLightSource(int value);
127  int getArmor() const;
129  void setArmor(int value);
131  int getFlammable() const;
133  void setFlammable(int value);
135  int getFuel() const;
137  void setFuel(int value);
139  int getLoftID(int layer) const;
141  void setLoftID(int loft, int layer);
143  int getExplosive() const;
145  void setExplosive(int value);
147  int getExplosiveType() const;
149  void setExplosiveType(int value);
151  void setMiniMapIndex(unsigned short i);
153  unsigned short getMiniMapIndex() const;
155  void setBigWall(const int bigWall);
157  void setTUWalk(const int TUWalk);
159  void setTUFly(const int TUFly);
161  void setTUSlide(const int TUSlide);
163  bool isBaseModule() const;
165  void setNoFloor(bool isNoFloor);
167  void setStopLOS(bool stopLOS);
168 };
169 
170 }
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
int getObjectType() const
Get the type of tile.
Definition: MapData.cpp:249
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
void setSpecialType(int value, int otype)
Sets a special tile type and object type.
Definition: MapData.cpp:259
int getFlammable() const
Gets the amount of flammable.
Definition: MapData.cpp:415
void setObjectType(int type)
Set the type of tile.
Definition: MapData.cpp:240
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
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
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
~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