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 _doneButtonDest;
279  Common::Array<Common::Rect> _saveButtonDownSrcs;
280  Common::Array<Common::Rect> _loadButtonDownSrcs;
281 
282  Common::Rect _doneButtonDownSrc;
283  Common::Array<Common::Rect> _saveButtonHighlightSrcs;
284  Common::Array<Common::Rect> _loadButtonHighlightSrcs;
285 
286  Common::Rect _doneButtonHighlightSrc;
287  Common::Array<Common::Rect> _saveButtonDisabledSrcs;
288  Common::Array<Common::Rect> _loadButtonDisabledSrcs;
289 
290  Common::Rect _doneButtonDisabledSrc;
291  Common::Rect _blinkingCursorSrc;
292  uint16 _blinkingTimeDelay;
293  Common::Array<Common::Rect> _cancelButtonSrcs;
294  Common::Array<Common::Rect> _cancelButtonDests;
295  Common::Rect _cancelButtonDownSrc;
296  Common::Rect _cancelButtonHighlightSrc;
297  Common::Rect _cancelButtonDisabledSrc;
298 
299  Common::Path _gameSavedPopup;
300  Common::String _emptySaveText;
301  Common::String _defaultSaveNamePrefix;
302  // Common::Rect _gameSavedBounds
303 
304  // v2 members
305  Common::Path _image2Name;
306  Common::Path _imageButtonsName;
307 
308  Common::Array<Common::Rect> _unpressedButtonSrcs;
309  Common::Array<Common::Rect> _pressedButtonSrcs;
310  Common::Array<Common::Rect> _highlightedButtonSrcs;
311  Common::Array<Common::Rect> _disabledButtonSrcs;
312 
313  Common::Array<Common::Rect> _buttonDests;
314 };
315 
316 // Contains data for the prompt that appears when exiting the game
317 // without saving first. Introduced in nancy3.
318 struct SDLG : public EngineData {
319  struct Dialog {
320  Dialog(Common::SeekableReadStream *chunkStream);
321 
322  Common::Path imageName;
323 
324  Common::Rect yesDest;
325  Common::Rect noDest;
326  Common::Rect cancelDest;
327 
328  Common::Rect yesHighlightSrc;
329  Common::Rect noHighlightSrc;
330  Common::Rect cancelHighlightSrc;
331 
332  Common::Rect yesDownSrc;
333  Common::Rect noDownSrc;
334  Common::Rect cancelDownSrc;
335  };
336 
337  SDLG(Common::SeekableReadStream *chunkStream);
338 
339  Common::Array<Dialog> dialogs;
340 };
341 
342 // Contains data for the hint system. Only used in nancy1.
343 struct HINT : public EngineData {
344  HINT(Common::SeekableReadStream *chunkStream);
345 
346  Common::Array<uint16> numHints;
347 };
348 
349 // Contains data for the slider puzzle. First used in nancy1
350 struct SPUZ : public EngineData {
351  SPUZ(Common::SeekableReadStream *chunkStream);
352 
354 };
355 
356 // Contains data for the clock UI that appears at the bottom left of the screen (top left in TVD)
357 // Not used in nancy1 but still present in the data.
358 struct CLOK : public EngineData {
359  CLOK(Common::SeekableReadStream *chunkStream);
360 
362  Common::Array<Common::Rect> animDests;
363 
364  Common::Array<Common::Rect> hoursHandSrcs;
365  Common::Array<Common::Rect> minutesHandSrcs;
366  Common::Rect screenPosition;
367  Common::Array<Common::Rect> hoursHandDests;
368  Common::Array<Common::Rect> minutesHandDests;
369 
370  Common::Rect staticImageSrc;
371  Common::Rect staticImageDest;
372 
373  uint32 timeToKeepOpen = 0;
374  uint16 frameTime = 0;
375 
376  bool clockIsDisabled = false;
377  bool clockIsDay = false; // nancy5 clock
378 
379  uint32 countdownTime = 0;
381  Common::Array<Common::Rect> countdownSrcs;
382  Common::Rect disabledSrc; // possibly useless
383 };
384 
385 // Contains data for special effects (fades between scenes/fades to black).
386 // Introduced in nancy2.
387 struct SPEC : public EngineData {
388  SPEC(Common::SeekableReadStream *chunkStream);
389 
390  byte fadeToBlackNumFrames;
391  uint16 fadeToBlackFrameTime;
392  byte crossDissolveNumFrames;
393 };
394 
395 // Contains data for the raycast puzzle in nancy3. Specifically, this is the
396 // data for the different "themes" that appear in the 3D space.
397 struct RCLB : public EngineData {
398  struct Theme {
399  Common::String themeName;
400 
401  Common::Array<uint32> wallIDs;
402 
403  Common::Array<uint16> exitFloorIDs;
404  Common::Array<uint16> floorIDs;
405  Common::Array<uint16> ceilingIDs;
406 
407  Common::Array<uint32> doorIDs;
408  Common::Array<uint32> transparentwallIDs;
409  Common::Array<uint32> objectwallIDs;
410  Common::Array<uint16> objectWallHeights;
411 
412  uint16 generalLighting;
413  uint16 hasLightSwitch;
414 
415  int16 transparentWallDensity;
416  int16 objectWallDensity;
417  int16 doorDensity;
418  };
419 
420  RCLB(Common::SeekableReadStream *chunkStream);
421 
422  uint16 lightSwitchID;
423  uint16 unk2;
424  Common::Array<Theme> themes;
425 };
426 
427 // Contains data about the raycast puzzle in nancy3. Specifically, this is the
428 // data for the debug map and the names of the textures to be used when rendering.
429 struct RCPR : public EngineData {
430  RCPR(Common::SeekableReadStream *chunkStream);
431 
432  Common::Array<Common::Rect> screenViewportSizes;
433  uint16 viewportSizeUsed;
434 
435  byte wallColor[3];
436  byte playerColor[3];
437  byte doorColor[3];
438  byte lightSwitchColor[3];
439  byte exitColor[3];
440  byte uColor6[3];
441  byte uColor7[3];
442  byte uColor8[3];
443  byte transparentWallColor[3];
444  byte uColor10[3];
445 
446  Common::Array<Common::Path> wallNames;
447  Common::Array<Common::Path> specialWallNames;
448  Common::Array<Common::Path> ceilingNames;
449  Common::Array<Common::Path> floorNames;
450 };
451 
452 // Contains the name and dimensions of an image.
453 struct ImageChunk : public EngineData {
455 
456  Common::Path imageName;
457  uint16 width;
458  uint16 height;
459 };
460 
461 // Contains text data. Every string is tagged with a key via which
462 // it can be accessed. Used to store dialogue and journal (autotext) strings.
463 // NOT found inside BOOT; these are stored in their own cifs, the names of which
464 // can be found inside BSUM. Introduced in nancy6.
465 struct CVTX : public EngineData {
466  CVTX(Common::SeekableReadStream *chunkStream);
467 
469 };
470 
471 struct TABL : public EngineData {
472  TABL(Common::SeekableReadStream *chunkStream);
473 
474  Common::String soundBaseName;
475  Common::Array<uint16> startIDs;
476  Common::Array<uint16> correctIDs;
479 };
480 
481 struct MARK : public EngineData {
482  MARK(Common::SeekableReadStream *chunkStream);
483 
484  Common::Array<Common::Rect> _markSrcs;
485 };
486 
487 } // End of namespace Nancy
488 
489 #endif // NANCY_ENGINEDATA_H
Definition: enginedata.h:350
Definition: enginedata.h:40
Definition: enginedata.h:343
Definition: enginedata.h:319
Definition: str.h:59
Definition: enginedata.h:387
Definition: enginedata.h:471
Definition: enginedata.h:222
Definition: commontypes.h:151
Definition: rect.h:524
Definition: path.h:52
Definition: enginedata.h:481
Definition: enginedata.h:179
Definition: stream.h:745
Definition: enginedata.h:178
Definition: enginedata.h:100
Definition: enginedata.h:245
Definition: enginedata.h:453
Definition: enginedata.h:429
Definition: enginedata.h:234
Definition: enginedata.h:212
Definition: enginedata.h:108
Definition: rect.h:144
Definition: enginedata.h:358
Definition: enginedata.h:90
Definition: enginedata.h:398
Definition: enginedata.h:264
Definition: commontypes.h:254
Definition: enginedata.h:465
Definition: enginedata.h:318
Definition: enginedata.h:150
Definition: enginedata.h:34
Definition: actionmanager.h:32
Definition: enginedata.h:109
Definition: enginedata.h:397