forked from OpenXcom/OpenXcom
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMapData.cpp
More file actions
331 lines (298 loc) · 5.78 KB
/
Copy pathMapData.cpp
File metadata and controls
331 lines (298 loc) · 5.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
/*
* Copyright 2010 OpenXcom Developers.
*
* This file is part of OpenXcom.
*
* OpenXcom is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* OpenXcom is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
*/
#include "MapData.h"
namespace OpenXcom
{
/**
* Creates a new Map Data Object.
* @param dataset The dataset this object belongs to.
*/
MapData::MapData(MapDataSet *dataset) : _dataset(dataset)
{
}
/**
* Destroy the object.
*/
MapData::~MapData()
{
}
/**
* Get the dataset this object belongs to.
* @return Pointer to MapDataSet.
*/
MapDataSet *MapData::getDataset()
{
return _dataset;
}
/**
* Get the sprite index.
* @param frameID Animation frame 0-7
* @return the original sprite index
*/
int MapData::getSprite(int frameID)
{
return _sprite[frameID];
}
/**
* Set the sprite index for a certain frame.
* @param frameID Animation frame
* @param value The sprite index in the surfaceset of the mapdataset.
*/
void MapData::setSprite(int frameID, int value)
{
_sprite[frameID] = value;
}
/**
* Get whether this is an animated ufo door.
* @return bool
*/
bool MapData::isUFODoor()
{
return _isUfoDoor;
}
/**
* Get whether this is a floor.
* @return bool
*/
bool MapData::isNoFloor()
{
return _isNoFloor;
}
/**
* Get whether this is a big wall, which blocks all surrounding paths.
* @return bool
*/
bool MapData::isBigWall()
{
if (_terrainLevel < 0) return false; // this is a hack for eg. Skyranger Ramps
return _isBigWall;
}
/**
* Get whether this is a normal door.
* @return bool
*/
bool MapData::isDoor()
{
return _isDoor;
}
/**
* Set all kinds of flags.
* @param isUfoDoor
* @param stopLOS
* @param isNoFloor
* @param isBigWall
* @param isGravLift
* @param isDoor
* @param blockFire
* @param blockSmoke
*/
void MapData::setFlags(bool isUfoDoor, bool stopLOS, bool isNoFloor, bool isBigWall, bool isGravLift, bool isDoor, bool blockFire, bool blockSmoke)
{
_isUfoDoor = isUfoDoor;
_stopLOS = stopLOS;
_isNoFloor = isNoFloor;
_isBigWall = isBigWall;
_isGravLift = isGravLift;
_isDoor = isDoor;
_blockFire = blockFire;
_blockSmoke = blockSmoke;
}
/**
* Get the amount of blockage of a certain type.
* @param type
* @return blockage (0-255)
*/
int MapData::getBlock(Affector type)
{
return _block[(int)type];
}
/**
* Sets the amount of blockage for all types.
* @param lightBlock
* @param visionBlock
* @param HEBlock
* @param smokeBlock
* @param fireBlock
* @param gasBlock
*/
void MapData::setBlockValue(int lightBlock, int visionBlock, int HEBlock, int smokeBlock, int fireBlock, int gasBlock)
{
_block[0] = lightBlock; // not used...
_block[1] = visionBlock==1?255:0;
_block[2] = HEBlock;
_block[3] = smokeBlock==1?255:0;
_block[4] = fireBlock==1?255:0;
_block[5] = gasBlock==1?255:0;
}
/**
* Get the Y offset for drawing.
* @return int height in pixels
*/
int MapData::getYOffset()
{
return _yOffset;
}
/**
* Sets the offset on the Y axis for drawing this object.
* @param value
*/
void MapData::setYOffset(int value)
{
_yOffset = value;
}
/**
* Gets the Y offset for drawing.
* @return int height in pixels
*/
SpecialTileType MapData::getSpecialType()
{
return _specialType;
}
/**
* Get the type of object.
* @return 0-3
*/
int MapData::getObjectType()
{
return _objectType;
}
/**
* Sets a special tile type and object type.
* @param value Special tile type.
* @param otype Object type.
*/
void MapData::setSpecialType(int value, int otype)
{
_specialType = (SpecialTileType)value;
_objectType = otype;
}
/*
* Gets the TU cost to walk over the object.
* @param movementType
* @return TU cost
*/
int MapData::getTUCost(MovementType movementType)
{
switch (movementType)
{
case WALK:
return _TUWalk;
break;
case FLY:
return _TUFly;
break;
case SLIDE:
return _TUSlide;
break;
}
return 0;
}
/**
* Set TU cost to move over the object.
* @param walk
* @param fly
* @param slide
*/
void MapData::setTUCosts(int walk, int fly, int slide)
{
_TUWalk = walk;
_TUFly = fly;
_TUSlide = slide;
}
/**
* Add this to the graphical Y offset of units or objects on this tile.
* @return Y offset
*/
int MapData::getTerrainLevel()
{
return _terrainLevel;
}
/**
* Sets Y offset for units/objects on this tile.
* @param value
*/
void MapData::setTerrainLevel(int value)
{
_terrainLevel = value;
}
/**
* Get index to the footstep sound.
* @return sound ID
*/
int MapData::getFootstepSound()
{
return _footstepSound;
}
/**
* Set the index to the footstep sound.
* @param value
*/
void MapData::setFootstepSound(int value)
{
_footstepSound = value;
}
/**
* Get the alternative object ID.
* @return object ID
*/
int MapData::getAltMCD()
{
return _altMCD;
}
/**
* Set the alternative object ID.
* @param value
*/
void MapData::setAltMCD(int value)
{
_altMCD = value;
}
/**
* Get the dead object ID.
* @return object ID
*/
int MapData::getDieMCD()
{
return _dieMCD;
}
/**
* Set the dead object ID.
* @param value
*/
void MapData::setDieMCD(int value)
{
_dieMCD = value;
}
/**
* Get the amount of light the object is emitting.
* @return lightsource
*/
int MapData::getLightSource()
{
return _lightSource;
}
/**
* Set the amount of light the object is emitting.
* @param value
*/
void MapData::setLightSource(int value)
{
_lightSource = value;
}
}