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