ScummVM API documentation
enginedata.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 NANCY_ENGINEDATA_H
23 #define NANCY_ENGINEDATA_H
24 
25 #include "engines/nancy/commontypes.h"
26 
27 namespace Nancy {
28 
29 // Data types corresponding to chunks found inside BOOT
30 
31 struct EngineData {
33  virtual ~EngineData() {}
34 };
35 
36 // Boot summary. Contains data for the UI, game clock, starting a new game.
37 struct BSUM : public EngineData {
38  BSUM(Common::SeekableReadStream *chunkStream);
39 
40  byte header[90];
41 
42  Common::Path conversationTextsFilename;
43  Common::Path autotextFilename;
44 
45  // Game start section
46  SceneChangeDescription firstScene;
47  uint16 startTimeHours;
48  uint16 startTimeMinutes;
49 
50  // More Nancy Drew! scene
51  SceneChangeDescription adScene;
52 
53  // UI
54  Common::Rect extraButtonHotspot; // Extra button is map in tvd, clock in nancy2 and up
55  Common::Rect extraButtonHighlightDest;
56  Common::Rect textboxScreenPosition;
57  Common::Rect inventoryBoxScreenPosition;
58  Common::Rect menuButtonSrc;
59  Common::Rect helpButtonSrc;
60  Common::Rect menuButtonDest;
61  Common::Rect helpButtonDest;
62  Common::Rect menuButtonHighlightSrc;
63  Common::Rect helpButtonHighlightSrc;
64  Common::Rect clockHighlightSrc;
65 
66  // Transparent color
67  byte paletteTrans = 0;
68  byte rTrans = 0;
69  byte gTrans = 0;
70  byte bTrans = 0;
71 
72  uint16 horizontalEdgesSize;
73  uint16 verticalEdgesSize;
74 
75  uint16 numFonts;
76 
77  uint16 playerTimeMinuteLength;
78  uint16 buttonPressTimeDelay;
79  uint16 dayStartMinutes = 0;
80  uint16 dayEndMinutes = 0;
81  byte overrideMovementTimeDeltas;
82  uint16 slowMovementTimeDelta;
83  uint16 fastMovementTimeDelta;
84 };
85 
86 // Contains rects defining the in-game viewport
87 struct VIEW : public EngineData {
88  VIEW(Common::SeekableReadStream *chunkStream);
89 
90  Common::Rect screenPosition;
91  Common::Rect bounds;
92 };
93 
94 // Contains a list of .cal filenames, which are to be loaded at startup.
95 // .cal files themselves are just collections of image files used in dialogue.
96 // First introduced in nancy2.
97 struct PCAL : public EngineData {
98  PCAL(Common::SeekableReadStream *chunkStream);
99 
101 };
102 
103 // Contains definitions for all in-game items, as well as data for the
104 // inventory box at the bottom right of the game screen.
105 struct INV : public EngineData {
107  Common::String name;
108  byte keepItem = kInvItemKeepAlways;
109  uint16 sceneID = kNoScene;
110  uint16 sceneSoundFlag = kContinueSceneSound;
111  Common::Rect sourceRect;
112  Common::Rect highlightedSourceRect;
113 
114  Common::String cantText;
115  Common::String cantTextNotHolding; // nancy2 only
116  SoundDescription cantSound;
117  SoundDescription cantSoundNotHolding; // nancy2 only
118  };
119 
120  INV(Common::SeekableReadStream *chunkStream);
121 
122  Common::Rect scrollbarSrcBounds;
123  Common::Point scrollbarDefaultPos;
124  uint16 scrollbarMaxScroll;
125 
126  Common::Array<Common::Rect> ornamentSrcs;
127  Common::Array<Common::Rect> ornamentDests;
128 
129  Common::Array<Common::Rect> curtainAnimationSrcs;
130  Common::Rect curtainsScreenPosition;
131  uint16 curtainsFrameTime;
132 
133  uint16 captionAutoClearTime = 3000;
134 
135  Common::Path inventoryBoxIconsImageName;
136  Common::Path inventoryCursorsImageName;
137 
138  SoundDescription cantSound;
139  Common::String cantText;
140 
141  Common::Array<ItemDescription> itemDescriptions;
142 };
143 
144 // Contains data about the textbox at the bottom left of the game screen
145 struct TBOX : public EngineData {
146  TBOX(Common::SeekableReadStream *chunkStream);
147 
148  Common::Rect scrollbarSrcBounds;
149  Common::Rect innerBoundingBox;
150  Common::Point scrollbarDefaultPos;
151  uint16 scrollbarMaxScroll;
152 
153  uint16 upOffset;
154  uint16 downOffset;
155  uint16 leftOffset;
156  uint16 rightOffset;
157 
158  Common::Array<Common::Rect> ornamentSrcs;
159  Common::Array<Common::Rect> ornamentDests;
160 
161  uint16 defaultFontID;
162  uint16 defaultTextColor;
163  uint16 conversationFontID;
164  uint16 highlightConversationFontID;
165  uint16 tabWidth;
166  uint16 pageScrollPercent;
167 
168  uint32 textBackground;
169  uint32 highlightTextBackground;
170 };
171 
172 // Contains data about the map state. Only used in TVD and nancy1
173 struct MAP : public EngineData {
174  struct Location {
175  Common::String description;
176  Common::Rect hotspot;
177  SceneChangeDescription scenes[2];
178 
179  Common::Rect labelSrc;
180  };
181 
182  MAP(Common::SeekableReadStream *chunkStream);
183 
185  Common::Array<Common::Path> mapPaletteNames;
187 
188  // Globe section, TVD only
189  uint16 globeFrameTime;
190  Common::Array<Common::Rect> globeSrcs;
191  Common::Rect globeDest;
192  Common::Rect globeGargoyleSrc;
193  Common::Rect globeGargoyleDest;
194 
195  // Button section, nancy1 only
196  Common::Rect buttonSrc;
197  Common::Rect buttonDest;
198 
199  Common::Rect closedLabelSrc;
200 
201  Common::Array<Location> locations;
202 
203  Common::Point cursorPosition;
204 };
205 
206 // Contains data for the help screen.
207 struct HELP : public EngineData {
208  HELP(Common::SeekableReadStream *chunkStream);
209 
210  Common::Path imageName;
211  Common::Rect buttonDest;
212  Common::Rect buttonSrc;
213  Common::Rect buttonHoverSrc;
214 };
215 
216 // Contains data for the credits screen.
217 struct CRED : public EngineData {
218  CRED(Common::SeekableReadStream *chunkStream);
219 
220  Common::Path imageName;
221  Common::Array<Common::Path> textNames;
222  Common::Rect textScreenPosition;
223  uint16 updateTime;
224  uint16 pixelsToScroll;
225  SoundDescription sound;
226 };
227 
228 // Contains data for the main menu.
229 struct MENU : public EngineData {
230  MENU(Common::SeekableReadStream *chunkStream);
231 
232  Common::Path _imageName;
233  Common::Array<Common::Rect> _buttonDests;
234  Common::Array<Common::Rect> _buttonDownSrcs;
235  Common::Array<Common::Rect> _buttonHighlightSrcs;
236  Common::Array<Common::Rect> _buttonDisabledSrcs;
237 };
238 
239 // Contains data for the Setup screen (a.k.a settings menu)
240 struct SET : public EngineData {
241  SET(Common::SeekableReadStream *chunkStream);
242 
243  Common::Path _imageName;
244  // Common::Rect _scrollbarsBounds
245  Common::Array<Common::Rect> _scrollbarBounds;
246  Common::Array<Common::Rect> _buttonDests;
247  Common::Array<Common::Rect> _buttonDownSrcs;
248  Common::Rect _doneButtonHighlightSrc;
249  Common::Array<Common::Rect> _scrollbarSrcs;
250 
251  Common::Array<uint16> _scrollbarsCenterYPos;
252  Common::Array<uint16> _scrollbarsCenterXPosL;
253  Common::Array<uint16> _scrollbarsCenterXPosR;
254 
256 };
257 
258 // Contains data for the Save/Load screen. Used up to nancy7
259 struct LOAD : public EngineData {
260  LOAD(Common::SeekableReadStream *chunkStream);
261 
262  Common::Path _image1Name;
263 
264  int16 _mainFontID;
265  int16 _highlightFontID;
266  int16 _disabledFontID;
267  int16 _fontXOffset;
268  int16 _fontYOffset;
269 
270  Common::Array<Common::Rect> _saveButtonDests;
271  Common::Array<Common::Rect> _loadButtonDests;
272  Common::Array<Common::Rect> _textboxBounds;
273  Common::Rect _doneButtonDest;
274  Common::Array<Common::Rect> _saveButtonDownSrcs;
275  Common::Array<Common::Rect> _loadButtonDownSrcs;
276 
277  Common::Rect _doneButtonDownSrc;
278  Common::Array<Common::Rect> _saveButtonHighlightSrcs;
279  Common::Array<Common::Rect> _loadButtonHighlightSrcs;
280 
281  Common::Rect _doneButtonHighlightSrc;
282  Common::Array<Common::Rect> _saveButtonDisabledSrcs;
283  Common::Array<Common::Rect> _loadButtonDisabledSrcs;
284 
285  Common::Rect _doneButtonDisabledSrc;
286  Common::Rect _blinkingCursorSrc;
287  uint16 _blinkingTimeDelay;
288  Common::Array<Common::Rect> _cancelButtonSrcs;
289  Common::Array<Common::Rect> _cancelButtonDests;
290  Common::Rect _cancelButtonDownSrc;
291  Common::Rect _cancelButtonHighlightSrc;
292  Common::Rect _cancelButtonDisabledSrc;
293 
294  Common::Path _gameSavedPopup;
295  Common::String _emptySaveText;
296  Common::String _defaultSaveNamePrefix;
297  // Common::Rect _gameSavedBounds
298 
299  // v2 members
300  Common::Path _image2Name;
301  Common::Path _imageButtonsName;
302 
303  Common::Array<Common::Rect> _unpressedButtonSrcs;
304  Common::Array<Common::Rect> _pressedButtonSrcs;
305  Common::Array<Common::Rect> _highlightedButtonSrcs;
306  Common::Array<Common::Rect> _disabledButtonSrcs;
307 
308  Common::Array<Common::Rect> _buttonDests;
309 };
310 
311 // Contains data for the prompt that appears when exiting the game
312 // without saving first. Introduced in nancy3.
313 struct SDLG : public EngineData {
314  struct Dialog {
315  Dialog(Common::SeekableReadStream *chunkStream);
316 
317  Common::Path imageName;
318 
319  Common::Rect yesDest;
320  Common::Rect noDest;
321  Common::Rect cancelDest;
322 
323  Common::Rect yesHighlightSrc;
324  Common::Rect noHighlightSrc;
325  Common::Rect cancelHighlightSrc;
326 
327  Common::Rect yesDownSrc;
328  Common::Rect noDownSrc;
329  Common::Rect cancelDownSrc;
330  };
331 
332  SDLG(Common::SeekableReadStream *chunkStream);
333 
334  Common::Array<Dialog> dialogs;
335 };
336 
337 // Contains data for the hint system. Only used in nancy1.
338 struct HINT : public EngineData {
339  HINT(Common::SeekableReadStream *chunkStream);
340 
341  Common::Array<uint16> numHints;
342 };
343 
344 // Contains data for the slider puzzle. First used in nancy1
345 struct SPUZ : public EngineData {
346  SPUZ(Common::SeekableReadStream *chunkStream);
347 
349 };
350 
351 // Contains data for the clock UI that appears at the bottom left of the screen (top left in TVD)
352 // Not used in nancy1 but still present in the data.
353 struct CLOK : public EngineData {
354  CLOK(Common::SeekableReadStream *chunkStream);
355 
357  Common::Array<Common::Rect> animDests;
358 
359  Common::Array<Common::Rect> hoursHandSrcs;
360  Common::Array<Common::Rect> minutesHandSrcs;
361  Common::Rect screenPosition;
362  Common::Array<Common::Rect> hoursHandDests;
363  Common::Array<Common::Rect> minutesHandDests;
364 
365  Common::Rect staticImageSrc;
366  Common::Rect staticImageDest;
367 
368  uint32 timeToKeepOpen = 0;
369  uint16 frameTime = 0;
370 
371  bool clockIsDisabled = false;
372  bool clockIsDay = false; // nancy5 clock
373 
374  uint32 countdownTime = 0;
376  Common::Array<Common::Rect> countdownSrcs;
377  Common::Rect disabledSrc; // possibly useless
378 };
379 
380 // Contains data for special effects (fades between scenes/fades to black).
381 // Introduced in nancy2.
382 struct SPEC : public EngineData {
383  SPEC(Common::SeekableReadStream *chunkStream);
384 
385  byte fadeToBlackNumFrames;
386  uint16 fadeToBlackFrameTime;
387  byte crossDissolveNumFrames;
388 };
389 
390 // Contains data for the raycast puzzle in nancy3. Specifically, this is the
391 // data for the different "themes" that appear in the 3D space.
392 struct RCLB : public EngineData {
393  struct Theme {
394  Common::String themeName;
395 
396  Common::Array<uint32> wallIDs;
397 
398  Common::Array<uint16> exitFloorIDs;
399  Common::Array<uint16> floorIDs;
400  Common::Array<uint16> ceilingIDs;
401 
402  Common::Array<uint32> doorIDs;
403  Common::Array<uint32> transparentwallIDs;
404  Common::Array<uint32> objectwallIDs;
405  Common::Array<uint16> objectWallHeights;
406 
407  uint16 generalLighting;
408  uint16 hasLightSwitch;
409 
410  int16 transparentWallDensity;
411  int16 objectWallDensity;
412  int16 doorDensity;
413  };
414 
415  RCLB(Common::SeekableReadStream *chunkStream);
416 
417  uint16 lightSwitchID;
418  uint16 unk2;
419  Common::Array<Theme> themes;
420 };
421 
422 // Contains data about the raycast puzzle in nancy3. Specifically, this is the
423 // data for the debug map and the names of the textures to be used when rendering.
424 struct RCPR : public EngineData {
425  RCPR(Common::SeekableReadStream *chunkStream);
426 
427  Common::Array<Common::Rect> screenViewportSizes;
428  uint16 viewportSizeUsed;
429 
430  byte wallColor[3];
431  byte playerColor[3];
432  byte doorColor[3];
433  byte lightSwitchColor[3];
434  byte exitColor[3];
435  byte uColor6[3];
436  byte uColor7[3];
437  byte uColor8[3];
438  byte transparentWallColor[3];
439  byte uColor10[3];
440 
441  Common::Array<Common::Path> wallNames;
442  Common::Array<Common::Path> specialWallNames;
443  Common::Array<Common::Path> ceilingNames;
444  Common::Array<Common::Path> floorNames;
445 };
446 
447 // Contains the name and dimensions of an image.
448 struct ImageChunk : public EngineData {
450 
451  Common::Path imageName;
452  uint16 width;
453  uint16 height;
454 };
455 
456 // Contains text data. Every string is tagged with a key via which
457 // it can be accessed. Used to store dialogue and journal (autotext) strings.
458 // NOT found inside BOOT; these are stored in their own cifs, the names of which
459 // can be found inside BSUM. Introduced in nancy6.
460 struct CVTX : public EngineData {
461  CVTX(Common::SeekableReadStream *chunkStream);
462 
464 };
465 
466 struct TABL : public EngineData {
467  TABL(Common::SeekableReadStream *chunkStream);
468 
469  Common::String soundBaseName;
470  Common::Array<uint16> startIDs;
471  Common::Array<uint16> correctIDs;
474 };
475 
476 struct MARK : public EngineData {
477  MARK(Common::SeekableReadStream *chunkStream);
478 
479  Common::Array<Common::Rect> _markSrcs;
480 };
481 
482 } // End of namespace Nancy
483 
484 #endif // NANCY_ENGINEDATA_H
Definition: enginedata.h:345
Definition: enginedata.h:37
Definition: enginedata.h:338
Definition: enginedata.h:314
Definition: str.h:59
Definition: enginedata.h:382
Definition: enginedata.h:466
Definition: enginedata.h:217
Definition: commontypes.h:150
Definition: rect.h:144
Definition: path.h:52
Definition: enginedata.h:476
Definition: enginedata.h:174
Definition: stream.h:745
Definition: enginedata.h:173
Definition: enginedata.h:97
Definition: enginedata.h:240
Definition: enginedata.h:448
Definition: enginedata.h:424
Definition: enginedata.h:229
Definition: enginedata.h:207
Definition: enginedata.h:105
Definition: rect.h:45
Definition: enginedata.h:353
Definition: enginedata.h:87
Definition: enginedata.h:393
Definition: enginedata.h:259
Definition: commontypes.h:253
Definition: enginedata.h:460
Definition: enginedata.h:313
Definition: enginedata.h:145
Definition: enginedata.h:31
Definition: actionmanager.h:32
Definition: enginedata.h:106
Definition: enginedata.h:392