ScummVM API documentation
structs.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program 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 * This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef DREAMWEB_STRUCTS_H
23#define DREAMWEB_STRUCTS_H
24
25#include "common/endian.h"
26#include "common/rect.h"
27
28namespace DreamWeb {
29
30struct GraphicsFile;
31struct SetObject;
32
33struct Sprite {
34 bool _mainManCallback;
35 const GraphicsFile *_frameData;
36 uint8 x;
37 uint8 y;
38 uint8 frameNumber;
39 uint8 delay;
40 uint8 animFrame; // index into SetObject::frames
41 SetObject *_objData;
42 uint8 speed;
43 uint8 priority;
44 uint8 walkFrame;
45 uint8 type;
46 uint8 hidden;
47};
48
50 uint16 _xMin, _xMax;
51 uint16 _yMin, _yMax;
52 void (DreamWebEngine::*_callback)();
53
54 bool contains(uint16 x, uint16 y) const {
55 return (x >= _xMin) && (x < _xMax) && (y >= _yMin) && (y < _yMax);
56 }
57};
58
59
60
61#include "common/pack-start.h" // START STRUCT PACKING
62
63struct SetObject {
64 uint8 b0;
65 uint8 b1;
66 uint8 b2;
67 uint8 slotSize;
68 uint8 slotCount;
69 uint8 priority;
70 uint8 b6;
71 uint8 delay;
72 uint8 type;
73 uint8 b9;
74 uint8 b10;
75 uint8 b11;
76 uint8 objId[4];
77 uint8 b16;
78 uint8 index;
79 uint8 frames[40]; // Table mapping animFrame to sprite frame number
80 uint8 mapad[5];
81 uint8 b63;
82} PACKED_STRUCT;
83
84struct DynObject {
85 uint8 currentLocation;
86 uint8 index;
87 uint8 mapad[5];
88 uint8 slotSize; // the size of an object's slots
89 uint8 slotCount; // the number of slots of an object
90 uint8 objectSize; // the size of an object
91 uint8 turnedOn;
92 uint8 initialLocation;
93 uint8 objId[4];
94} PACKED_STRUCT;
95
96struct ObjPos {
97 uint8 xMin;
98 uint8 yMin;
99 uint8 xMax;
100 uint8 yMax;
101 uint8 index;
102 bool contains(uint8 x, uint8 y) const {
103 return (x >= xMin) && (x < xMax) && (y >= yMin) && (y < yMax);
104 }
105} PACKED_STRUCT;
106
107struct Frame {
108 uint8 width;
109 uint8 height;
110 uint16 _ptr;
111 uint16 ptr() const { return READ_LE_UINT16(&_ptr); }
112 void setPtr(uint16 v) { WRITE_LE_UINT16(&_ptr, v); }
113 uint8 x;
114 uint8 y;
115} PACKED_STRUCT;
116
117struct Reel {
118 uint8 frame_lo;
119 uint8 frame_hi;
120 uint16 frame() const { return READ_LE_UINT16(&frame_lo); }
121 void setFrame(uint16 v) { WRITE_LE_UINT16(&frame_lo, v); }
122 uint8 x;
123 uint8 y;
124 uint8 b4;
125} PACKED_STRUCT;
126
127#include "common/pack-end.h" // END STRUCT PACKING
128
129
130
132 uint8 reallocation;
133 uint8 mapX;
134 uint8 mapY;
135 uint16 _reelPointer;
136 uint16 reelPointer() const { return _reelPointer; }
137 void setReelPointer(uint16 v) { _reelPointer = v; }
138 void incReelPointer() { _reelPointer++; }
139 uint8 period;
140 uint8 counter;
141 uint8 b7;
142};
143
144struct People {
145 uint16 _reelPointer;
146 ReelRoutine *_routinePointer;
147 uint8 b4;
148};
149
150
151
152#include "common/pack-start.h" // START STRUCT PACKING
153
154struct Room {
155 char name[13];
156 uint8 roomsSample;
157 uint8 b14;
158 uint8 mapX;
159 uint8 mapY;
160 uint8 b17;
161 uint8 b18;
162 uint8 b19;
163 uint8 liftFlag;
164 uint8 b21;
165 uint8 facing;
166 uint8 countToOpen;
167 uint8 liftPath;
168 uint8 doorPath;
169 uint8 b26;
170 uint8 b27;
171 uint8 b28;
172 uint8 b29;
173 uint8 b30;
174 uint8 realLocation;
175} PACKED_STRUCT;
176
177extern const Room g_roomData[];
178
179struct Rain {
180 uint8 x;
181 uint8 y;
182 uint8 size;
183 uint16 w3;
184 uint8 b5;
185} PACKED_STRUCT;
186
187struct Change {
188 uint8 index;
189 uint8 location;
190 uint8 value;
191 uint8 type;
192} PACKED_STRUCT;
193
194struct PathNode {
195 uint8 x;
196 uint8 y;
197 uint8 x1;
198 uint8 y1;
199 uint8 x2;
200 uint8 y2;
201 uint8 on;
202 uint8 dir;
203} PACKED_STRUCT;
204
206 uint8 b0;
207 uint8 b1;
208} PACKED_STRUCT;
209
210struct RoomPaths {
211 PathNode nodes[12];
212 PathSegment segments[24];
213} PACKED_STRUCT;
214
216 char _desc[50];
217 uint16 _len[20];
218 uint8 _padding[6];
219
220 uint16 len(unsigned int i) const {
221 assert(i < 20);
222 return READ_LE_UINT16(&_len[i]);
223 }
224 void setLen(unsigned int i, uint16 length) {
225 assert(i < 20);
226 WRITE_LE_UINT16(&_len[i], length);
227 }
228} PACKED_STRUCT;
229
231 uint8 _location;
232 uint8 _mapX;
233 uint8 _mapY;
234 uint8 _sound;
235 uint8 _repeat;
236} PACKED_STRUCT;
237
238#include "common/pack-end.h" // END STRUCT PACKING
239
240
241
242enum ObjectTypes {
243 kSetObjectType1 = 1,
244 kFreeObjectType = 2,
245 kSetObjectType3 = 3,
246 kExObjectType = 4
247};
248
249struct ObjectRef {
250 uint8 _index;
251 uint8 _type; // enum ObjectTypes
252
253 bool operator==(const ObjectRef &r) const {
254 return _index == r._index && _type == r._type;
255 }
256 bool operator!=(const ObjectRef &r) const {
257 return _index != r._index || _type != r._type;
258 }
259};
260
261
262
263#include "common/pack-start.h" // START STRUCT PACKING
264
266 uint8 _flag;
267 uint8 _flagEx;
268} PACKED_STRUCT;
269
270struct MapFlag {
271 uint8 _flag;
272 uint8 _flagEx;
273 uint8 _type;
274} PACKED_STRUCT;
275
276#include "common/pack-end.h" // END STRUCT PACKING
277
278
279
280
281
282struct TextFile {
283 TextFile(unsigned int size = 66) : _size(size), _text(0) { _offsetsLE = new uint16[_size]; }
284
285 ~TextFile() {
286 delete[] _offsetsLE;
287 _offsetsLE = 0;
288 _size = 0;
289 clear();
290 }
291
292 uint16 *_offsetsLE;
293 unsigned int _size;
294 char *_text;
295
296 const char *getString(unsigned int i) const {
297 assert(i < _size);
298 return _text + getOffset(i);
299 }
300 void setOffset(unsigned int i, uint16 offset) {
301 WRITE_LE_UINT16(&_offsetsLE[i], offset);
302 }
303 uint16 getOffset(unsigned int i) const {
304 return READ_LE_UINT16(&_offsetsLE[i]);
305 }
306 void clear() {
307 delete[] _text;
308 _text = 0;
309 }
310};
311
313 GraphicsFile() : _data(0), _frames(0) { }
314
315 Frame *_frames;
316 uint8 *_data;
317
318 const uint8 *getFrameData(unsigned int i) const {
319 // There is 2080 bytes of Frame data, but that is between 346 and 347
320 // frames
321 assert(i < 346);
322 return _data + _frames[i].ptr();
323 }
324 void clear() {
325 delete[] _frames;
326 _frames = 0;
327 delete[] _data;
328 _data = 0;
329 }
330};
331
332struct GameVars {
333 uint8 _startVars;
334 uint8 _progressPoints;
335 uint8 _watchOn;
336 uint8 _shadesOn;
337 uint8 _secondCount;
338 uint8 _minuteCount;
339 uint8 _hourCount;
340 uint8 _zoomOn;
341 uint8 _location;
342 uint8 _exPos;
343 uint16 _exFramePos;
344 uint16 _exTextPos;
345 uint16 _card1Money;
346 uint16 _listPos;
347 uint8 _ryanPage;
348 uint16 _watchingTime;
349 uint16 _reelToWatch; // reel plays from here in mode 0
350 uint16 _endWatchReel; // and stops here. Mode set to 1
351 uint8 _speedCount;
352 uint8 _watchSpeed;
353 uint16 _reelToHold; // if mode is 1 hold on this reel
354 uint16 _endOfHoldReel; // if mode is 2 then play to endOfHoldReel and reset mode to -1
355 uint8 _watchMode;
356 uint8 _destAfterHold; // set walking destination
357 uint8 _newsItem;
358 uint8 _liftFlag;
359 uint8 _liftPath;
360 uint8 _lockStatus;
361 uint8 _doorPath;
362 uint8 _countToOpen;
363 uint8 _countToClose;
364 uint8 _rockstarDead;
365 uint8 _generalDead;
366 uint8 _sartainDead;
367 uint8 _aideDead;
368 uint8 _beenMugged;
369 uint8 _gunPassFlag;
370 uint8 _canMoveAltar;
371 uint8 _talkedToAttendant;
372 uint8 _talkedToSparky;
373 uint8 _talkedToBoss;
374 uint8 _talkedToRecep;
375 uint8 _cardPassFlag;
376 uint8 _madmanFlag;
377 uint8 _keeperFlag;
378 uint8 _lastTrigger;
379 uint8 _manDead;
380 uint8 _seed1;
381 uint8 _seed2;
382 uint8 _seed3;
383 uint8 _needToTravel;
384 uint8 _throughDoor;
385 uint8 _newObs;
386 uint8 _ryanOn;
387 uint8 _combatCount;
388 uint8 _lastWeapon;
389 uint8 _dreamNumber;
390 uint8 _roomAfterDream;
391 uint8 _shakeCounter;
392};
393
394struct TimedTemp {
395 TimedTemp() : _timeCount(0), _string(0) { }
396
397 uint8 _x;
398 uint8 _y;
399
400 uint16 _timeCount;
401 uint16 _countToTimed;
402
403 const char *_string;
404};
405
406} // End of namespace DreamWeb
407
408#endif
409
Definition: dreamweb.h:102
Definition: structs.h:230
Definition: structs.h:265
Definition: structs.h:187
Definition: structs.h:84
Definition: structs.h:215
Definition: structs.h:107
Definition: structs.h:332
Definition: structs.h:312
Definition: structs.h:270
Definition: structs.h:96
Definition: structs.h:249
Definition: structs.h:194
Definition: structs.h:205
Definition: structs.h:144
Definition: structs.h:179
Definition: structs.h:49
Definition: structs.h:117
Definition: structs.h:131
Definition: structs.h:154
Definition: structs.h:210
Definition: structs.h:63
Definition: structs.h:33
Definition: structs.h:282
Definition: structs.h:394