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  SoundDescription cantSound;
120  SoundDescription cantSoundNotHolding; // nancy2 only
121  };
122 
123  INV(Common::SeekableReadStream *chunkStream);
124 
125  Common::Rect scrollbarSrcBounds;
126  Common::Point scrollbarDefaultPos;
127  uint16 scrollbarMaxScroll;
128 
129  Common::Array<Common::Rect> ornamentSrcs;
130  Common::Array<Common::Rect> ornamentDests;
131 
132  Common::Array<Common::Rect> curtainAnimationSrcs;
133  Common::Rect curtainsScreenPosition;
134  uint16 curtainsFrameTime;
135 
136  uint16 captionAutoClearTime = 3000;
137 
138  Common::Path inventoryBoxIconsImageName;
139  Common::Path inventoryCursorsImageName;
140 
141  SoundDescription cantSound;
142  Common::String cantText;
143 
144  Common::Array<ItemDescription> itemDescriptions;
145 };
146 
147 // Contains data about the textbox at the bottom left of the game screen
148 struct TBOX : public EngineData {
149  TBOX(Common::SeekableReadStream *chunkStream);
150 
151  Common::Rect scrollbarSrcBounds;
152  Common::Rect innerBoundingBox;
153  Common::Point scrollbarDefaultPos;
154  uint16 scrollbarMaxScroll;
155 
156  uint16 upOffset;
157  uint16 downOffset;
158  uint16 leftOffset;
159  uint16 rightOffset;
160 
161  Common::Array<Common::Rect> ornamentSrcs;
162  Common::Array<Common::Rect> ornamentDests;
163 
164  uint16 defaultFontID;
165  uint16 defaultTextColor;
166  uint16 conversationFontID;
167  uint16 highlightConversationFontID;
168  uint16 tabWidth;
169  uint16 pageScrollPercent;
170 
171  uint32 textBackground;
172  uint32 highlightTextBackground;
173 };
174 
175 // Contains data about the map state. Only used in TVD and nancy1
176 struct MAP : public EngineData {
177  struct Location {
178  Common::String description;
179  Common::Rect hotspot;
180  SceneChangeDescription scenes[2];
181 
182  Common::Rect labelSrc;
183  };
184 
185  MAP(Common::SeekableReadStream *chunkStream);
186 
188  Common::Array<Common::Path> mapPaletteNames;
190 
191  // Globe section, TVD only
192  uint16 globeFrameTime;
193  Common::Array<Common::Rect> globeSrcs;
194  Common::Rect globeDest;
195  Common::Rect globeGargoyleSrc;
196  Common::Rect globeGargoyleDest;
197 
198  // Button section, nancy1 only
199  Common::Rect buttonSrc;
200  Common::Rect buttonDest;
201 
202  Common::Rect closedLabelSrc;
203 
204  Common::Array<Location> locations;
205 
206  Common::Point cursorPosition;
207 };
208 
209 // Contains data for the help screen.
210 struct HELP : public EngineData {
211  HELP(Common::SeekableReadStream *chunkStream);
212 
213  Common::Path imageName;
214  Common::Rect buttonDest;
215  Common::Rect buttonSrc;
216  Common::Rect buttonHoverSrc;
217 };
218 
219 // Contains data for the credits screen.
220 struct CRED : public EngineData {
221  CRED(Common::SeekableReadStream *chunkStream);
222 
223  Common::Path imageName;
224  Common::Array<Common::Path> textNames;
225  Common::Rect textScreenPosition;
226  uint16 updateTime;
227  uint16 pixelsToScroll;
228  SoundDescription sound;
229 };
230 
231 // Contains data for the main menu.
232 struct MENU : public EngineData {
233  MENU(Common::SeekableReadStream *chunkStream);
234 
235  Common::Path _imageName;
236  Common::Array<Common::Rect> _buttonDests;
237  Common::Array<Common::Rect> _buttonDownSrcs;
238  Common::Array<Common::Rect> _buttonHighlightSrcs;
239  Common::Array<Common::Rect> _buttonDisabledSrcs;
240 };
241 
242 // Contains data for the Setup screen (a.k.a settings menu)
243 struct SET : public EngineData {
244  SET(Common::SeekableReadStream *chunkStream);
245 
246  Common::Path _imageName;
247  // Common::Rect _scrollbarsBounds
248  Common::Array<Common::Rect> _scrollbarBounds;
249  Common::Array<Common::Rect> _buttonDests;
250  Common::Array<Common::Rect> _buttonDownSrcs;
251  Common::Rect _doneButtonHighlightSrc;
252  Common::Array<Common::Rect> _scrollbarSrcs;
253 
254  Common::Array<uint16> _scrollbarsCenterYPos;
255  Common::Array<uint16> _scrollbarsCenterXPosL;
256  Common::Array<uint16> _scrollbarsCenterXPosR;
257 
259 };
260 
261 // Contains data for the Save/Load screen. Used up to nancy7
262 struct LOAD : public EngineData {
263  LOAD(Common::SeekableReadStream *chunkStream);
264 
265  Common::Path _image1Name;
266 
267  int16 _mainFontID;
268  int16 _highlightFontID;
269  int16 _disabledFontID;
270  int16 _fontXOffset;
271  int16 _fontYOffset;
272 
273  Common::Array<Common::Rect> _saveButtonDests;
274  Common::Array<Common::Rect> _loadButtonDests;
275  Common::Array<Common::Rect> _textboxBounds;
276  Common::Rect _doneButtonDest;
277  Common::Array<Common::Rect> _saveButtonDownSrcs;
278  Common::Array<Common::Rect> _loadButtonDownSrcs;
279 
280  Common::Rect _doneButtonDownSrc;
281  Common::Array<Common::Rect> _saveButtonHighlightSrcs;
282  Common::Array<Common::Rect> _loadButtonHighlightSrcs;
283 
284  Common::Rect _doneButtonHighlightSrc;
285  Common::Array<Common::Rect> _saveButtonDisabledSrcs;
286  Common::Array<Common::Rect> _loadButtonDisabledSrcs;
287 
288  Common::Rect _doneButtonDisabledSrc;
289  Common::Rect _blinkingCursorSrc;
290  uint16 _blinkingTimeDelay;
291  Common::Array<Common::Rect> _cancelButtonSrcs;
292  Common::Array<Common::Rect> _cancelButtonDests;
293  Common::Rect _cancelButtonDownSrc;
294  Common::Rect _cancelButtonHighlightSrc;
295  Common::Rect _cancelButtonDisabledSrc;
296 
297  Common::Path _gameSavedPopup;
298  Common::String _emptySaveText;
299  Common::String _defaultSaveNamePrefix;
300  // Common::Rect _gameSavedBounds
301 
302  // v2 members
303  Common::Path _image2Name;
304  Common::Path _imageButtonsName;
305 
306  Common::Array<Common::Rect> _unpressedButtonSrcs;
307  Common::Array<Common::Rect> _pressedButtonSrcs;
308  Common::Array<Common::Rect> _highlightedButtonSrcs;
309  Common::Array<Common::Rect> _disabledButtonSrcs;
310 
311  Common::Array<Common::Rect> _buttonDests;
312 };
313 
314 // Contains data for the prompt that appears when exiting the game
315 // without saving first. Introduced in nancy3.
316 struct SDLG : public EngineData {
317  struct Dialog {
318  Dialog(Common::SeekableReadStream *chunkStream);
319 
320  Common::Path imageName;
321 
322  Common::Rect yesDest;
323  Common::Rect noDest;
324  Common::Rect cancelDest;
325 
326  Common::Rect yesHighlightSrc;
327  Common::Rect noHighlightSrc;
328  Common::Rect cancelHighlightSrc;
329 
330  Common::Rect yesDownSrc;
331  Common::Rect noDownSrc;
332  Common::Rect cancelDownSrc;
333  };
334 
335  SDLG(Common::SeekableReadStream *chunkStream);
336 
337  Common::Array<Dialog> dialogs;
338 };
339 
340 // Contains data for the hint system. Only used in nancy1.
341 struct HINT : public EngineData {
342  HINT(Common::SeekableReadStream *chunkStream);
343 
344  Common::Array<uint16> numHints;
345 };
346 
347 // Contains data for the slider puzzle. First used in nancy1
348 struct SPUZ : public EngineData {
349  SPUZ(Common::SeekableReadStream *chunkStream);
350 
352 };
353 
354 // Contains data for the clock UI that appears at the bottom left of the screen (top left in TVD)
355 // Not used in nancy1 but still present in the data.
356 struct CLOK : public EngineData {
357  CLOK(Common::SeekableReadStream *chunkStream);
358 
360  Common::Array<Common::Rect> animDests;
361 
362  Common::Array<Common::Rect> hoursHandSrcs;
363  Common::Array<Common::Rect> minutesHandSrcs;
364  Common::Rect screenPosition;
365  Common::Array<Common::Rect> hoursHandDests;
366  Common::Array<Common::Rect> minutesHandDests;
367 
368  Common::Rect staticImageSrc;
369  Common::Rect staticImageDest;
370 
371  uint32 timeToKeepOpen = 0;
372  uint16 frameTime = 0;
373 
374  bool clockIsDisabled = false;
375  bool clockIsDay = false; // nancy5 clock
376 
377  uint32 countdownTime = 0;
379  Common::Array<Common::Rect> countdownSrcs;
380  Common::Rect disabledSrc; // possibly useless
381 };
382 
383 // Contains data for special effects (fades between scenes/fades to black).
384 // Introduced in nancy2.
385 struct SPEC : public EngineData {
386  SPEC(Common::SeekableReadStream *chunkStream);
387 
388  byte fadeToBlackNumFrames;
389  uint16 fadeToBlackFrameTime;
390  byte crossDissolveNumFrames;
391 };
392 
393 // Contains data for the raycast puzzle in nancy3. Specifically, this is the
394 // data for the different "themes" that appear in the 3D space.
395 struct RCLB : public EngineData {
396  struct Theme {
397  Common::String themeName;
398 
399  Common::Array<uint32> wallIDs;
400 
401  Common::Array<uint16> exitFloorIDs;
402  Common::Array<uint16> floorIDs;
403  Common::Array<uint16> ceilingIDs;
404 
405  Common::Array<uint32> doorIDs;
406  Common::Array<uint32> transparentwallIDs;
407  Common::Array<uint32> objectwallIDs;
408  Common::Array<uint16> objectWallHeights;
409 
410  uint16 generalLighting;
411  uint16 hasLightSwitch;
412 
413  int16 transparentWallDensity;
414  int16 objectWallDensity;
415  int16 doorDensity;
416  };
417 
418  RCLB(Common::SeekableReadStream *chunkStream);
419 
420  uint16 lightSwitchID;
421  uint16 unk2;
422  Common::Array<Theme> themes;
423 };
424 
425 // Contains data about the raycast puzzle in nancy3. Specifically, this is the
426 // data for the debug map and the names of the textures to be used when rendering.
427 struct RCPR : public EngineData {
428  RCPR(Common::SeekableReadStream *chunkStream);
429 
430  Common::Array<Common::Rect> screenViewportSizes;
431  uint16 viewportSizeUsed;
432 
433  byte wallColor[3];
434  byte playerColor[3];
435  byte doorColor[3];
436  byte lightSwitchColor[3];
437  byte exitColor[3];
438  byte uColor6[3];
439  byte uColor7[3];
440  byte uColor8[3];
441  byte transparentWallColor[3];
442  byte uColor10[3];
443 
444  Common::Array<Common::Path> wallNames;
445  Common::Array<Common::Path> specialWallNames;
446  Common::Array<Common::Path> ceilingNames;
447  Common::Array<Common::Path> floorNames;
448 };
449 
450 // Contains the name and dimensions of an image.
451 struct ImageChunk : public EngineData {
453 
454  Common::Path imageName;
455  uint16 width;
456  uint16 height;
457 };
458 
459 // Contains text data. Every string is tagged with a key via which
460 // it can be accessed. Used to store dialogue and journal (autotext) strings.
461 // NOT found inside BOOT; these are stored in their own cifs, the names of which
462 // can be found inside BSUM. Introduced in nancy6.
463 struct CVTX : public EngineData {
464  CVTX(Common::SeekableReadStream *chunkStream);
465 
467 };
468 
469 struct TABL : public EngineData {
470  TABL(Common::SeekableReadStream *chunkStream);
471 
472  Common::String soundBaseName;
473  Common::Array<uint16> startIDs;
474  Common::Array<uint16> correctIDs;
477 };
478 
479 struct MARK : public EngineData {
480  MARK(Common::SeekableReadStream *chunkStream);
481 
482  Common::Array<Common::Rect> _markSrcs;
483 };
484 
485 } // End of namespace Nancy
486 
487 #endif // NANCY_ENGINEDATA_H
Definition: enginedata.h:348
Definition: enginedata.h:40
Definition: enginedata.h:341
Definition: enginedata.h:317
Definition: str.h:59
Definition: enginedata.h:385
Definition: enginedata.h:469
Definition: enginedata.h:220
Definition: commontypes.h:151
Definition: rect.h:144
Definition: path.h:52
Definition: enginedata.h:479
Definition: enginedata.h:177
Definition: stream.h:745
Definition: enginedata.h:176
Definition: enginedata.h:100
Definition: enginedata.h:243
Definition: enginedata.h:451
Definition: enginedata.h:427
Definition: enginedata.h:232
Definition: enginedata.h:210
Definition: enginedata.h:108
Definition: rect.h:45
Definition: enginedata.h:356
Definition: enginedata.h:90
Definition: enginedata.h:396
Definition: enginedata.h:262
Definition: commontypes.h:254
Definition: enginedata.h:463
Definition: enginedata.h:316
Definition: enginedata.h:148
Definition: enginedata.h:34
Definition: actionmanager.h:32
Definition: enginedata.h:109
Definition: enginedata.h:395