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 #include "engines/nancy/util.h"
27 
28 #include "common/hash-str.h"
29 #include "common/path.h"
30 
31 namespace Nancy {
32 
33 // Data types corresponding to chunks found inside BOOT
34 
35 struct EngineData {
37  virtual ~EngineData() {}
38 };
39 
40 // Boot summary. Contains data for the UI, game clock, starting a new game.
41 struct BSUM : public EngineData {
42  BSUM(Common::SeekableReadStream *chunkStream);
43 
44  byte header[90];
45 
46  Common::Path conversationTextsFilename;
47  Common::Path autotextFilename;
48 
49  // Nancy12+
50  Common::Path fontFilename;
51  Common::Path flagsFilename;
52 
53  // Game start section
54  SceneChangeDescription firstScene;
55  uint16 startTimeHours;
56  uint16 startTimeMinutes;
57 
58  // More Nancy Drew! scene
59  SceneChangeDescription adScene;
60 
61  // UI
62  Common::Rect extraButtonHotspot; // Extra button is map in tvd, clock in nancy2 and up
63  Common::Rect extraButtonHighlightDest;
64  Common::Rect textboxScreenPosition;
65  Common::Rect inventoryBoxScreenPosition;
66  Common::Rect menuButtonSrc;
67  Common::Rect helpButtonSrc;
68  Common::Rect menuButtonDest;
69  Common::Rect helpButtonDest;
70  Common::Rect menuButtonHighlightSrc;
71  Common::Rect helpButtonHighlightSrc;
72  Common::Rect clockHighlightSrc;
73 
74  // Transparent color
75  byte paletteTrans = 0;
76  byte rTrans = 0;
77  byte gTrans = 0;
78  byte bTrans = 0;
79 
80  uint16 horizontalEdgesSize;
81  uint16 verticalEdgesSize;
82 
83  // Nancy16 switched to system fonts, and no longer stores a count here
84  uint16 numFonts = 0;
85 
86  uint16 playerTimeMinuteLength;
87  uint16 buttonPressTimeDelay;
88  uint16 dayStartMinutes = 0;
89  uint16 dayEndMinutes = 0;
90  byte overrideMovementTimeDeltas;
91  uint16 slowMovementTimeDelta;
92  uint16 fastMovementTimeDelta;
93 };
94 
95 // Contains rects defining the in-game viewport
96 struct VIEW : public EngineData {
97  VIEW(Common::SeekableReadStream *chunkStream);
98 
99  Common::Rect screenPosition;
100  Common::Rect bounds;
101 };
102 
103 // Contains a list of .cal filenames, which are to be loaded at startup.
104 // .cal files themselves are just collections of image files used in dialogue.
105 // First introduced in nancy2.
106 struct PCAL : public EngineData {
107  PCAL(Common::SeekableReadStream *chunkStream);
108 
110 };
111 
112 // Contains definitions for all in-game items, as well as data for the
113 // inventory box at the bottom right of the game screen.
114 struct INV : public EngineData {
116  Common::String name;
117  byte keepItem = kInvItemKeepAlways;
118  uint16 sceneID = kNoScene;
119  uint16 sceneSoundFlag = kContinueSceneSound;
120  Common::Rect sourceRect;
121  Common::Rect highlightedSourceRect;
122 
123  Common::String cantText;
124  Common::String cantTextNotHolding; // nancy2 only
125  Common::String cantTexts[3]; // Nancy9 and newer
126  SoundDescription cantSound;
127  SoundDescription cantSoundNotHolding; // nancy2 only
128  SoundDescription cantSounds[3]; // Nancy9 and newer
129  };
130 
131  INV(Common::SeekableReadStream *chunkStream);
132 
133  Common::Rect scrollbarSrcBounds;
134  Common::Point scrollbarDefaultPos;
135  uint16 scrollbarMaxScroll;
136 
137  Common::Array<Common::Rect> ornamentSrcs;
138  Common::Array<Common::Rect> ornamentDests;
139 
140  Common::Array<Common::Rect> curtainAnimationSrcs;
141  Common::Rect curtainsScreenPosition;
142  uint16 curtainsFrameTime;
143 
144  uint16 captionAutoClearTime = 3000;
145 
146  Common::Path inventoryBoxIconsImageName;
147  Common::Path inventoryCursorsImageName;
148 
149  SoundDescription cantSound;
150  Common::String cantText;
151 
152  Common::Array<ItemDescription> itemDescriptions;
153 };
154 
155 // Contains data about the textbox at the bottom left of the game screen
156 struct TBOX : public EngineData {
157  TBOX(Common::SeekableReadStream *chunkStream);
158 
159  Common::Rect scrollbarSrcBounds;
160  Common::Rect innerBoundingBox;
161  Common::Point scrollbarDefaultPos;
162  uint16 scrollbarMaxScroll;
163 
164  uint16 upOffset;
165  uint16 downOffset;
166  uint16 leftOffset;
167  uint16 rightOffset;
168 
169  Common::Array<Common::Rect> ornamentSrcs;
170  Common::Array<Common::Rect> ornamentDests;
171 
172  uint16 defaultFontID;
173  uint16 defaultTextColor;
174  uint16 conversationFontID;
175  uint16 highlightConversationFontID;
176  uint16 tabWidth;
177  uint16 pageScrollPercent;
178 
179  uint32 textBackground;
180  uint32 highlightTextBackground;
181 
182  // Nancy 10+ extra layout variables.
183  int32 maxScrollWidth = 0;
184  int32 firstLineY = 0; // added to the y-cursor when starting a new line
185  uint16 lineStartXCursor = 0; // left inset of the text within the text area
186  uint16 stripRightMargin = 0; // subtracted from contentWidth for the strip's text width
187  int32 unknown1 = 0;
188  int32 unknown2 = 0;
189  int32 contentWidth = 0;
190  int32 contentHeight = 0;
191 };
192 
193 // Contains data about the map state. Only used in TVD and nancy1
194 struct MAP : public EngineData {
195  struct Location {
196  Common::String description;
197  Common::Rect hotspot;
198  SceneChangeDescription scenes[2];
199 
200  Common::Rect labelSrc;
201  };
202 
203  MAP(Common::SeekableReadStream *chunkStream);
204 
206  Common::Array<Common::Path> mapPaletteNames;
208 
209  // Globe section, TVD only
210  uint16 globeFrameTime;
211  Common::Array<Common::Rect> globeSrcs;
212  Common::Rect globeDest;
213  Common::Rect globeGargoyleSrc;
214  Common::Rect globeGargoyleDest;
215 
216  // Button section, nancy1 only
217  Common::Rect buttonSrc;
218  Common::Rect buttonDest;
219 
220  Common::Rect closedLabelSrc;
221 
222  Common::Array<Location> locations;
223 
224  Common::Point cursorPosition;
225 };
226 
227 // Contains data for the help screen.
228 struct HELP : public EngineData {
229  HELP(Common::SeekableReadStream *chunkStream);
230 
231  Common::Path imageName;
232  Common::Rect buttonDest;
233  Common::Rect buttonSrc;
234  Common::Rect buttonHoverSrc;
235 };
236 
237 // Contains data for the credits screen.
238 struct CRED : public EngineData {
239  CRED(Common::SeekableReadStream *chunkStream);
240 
241  Common::Path imageName;
242  Common::Array<Common::Path> textNames;
243  Common::Rect textScreenPosition;
244  uint16 updateTime;
245  uint16 pixelsToScroll;
246  SoundDescription sound;
247 };
248 
249 // Contains data for the main menu.
250 struct MENU : public EngineData {
251  MENU(Common::SeekableReadStream *chunkStream);
252 
253  Common::Path _imageName;
254  Common::Array<Common::Rect> _buttonDests;
255  Common::Array<Common::Rect> _buttonDownSrcs;
256  Common::Array<Common::Rect> _buttonHighlightSrcs;
257  Common::Array<Common::Rect> _buttonDisabledSrcs;
258 };
259 
260 // Contains data for the Setup screen (a.k.a settings menu)
261 struct SET : public EngineData {
262  SET(Common::SeekableReadStream *chunkStream);
263 
264  Common::Path _imageName;
265  // Common::Rect _scrollbarsBounds
266  Common::Array<Common::Rect> _scrollbarBounds;
267  Common::Array<Common::Rect> _buttonDests;
268  Common::Array<Common::Rect> _buttonDownSrcs;
269  Common::Rect _doneButtonHighlightSrc;
270  // Nancy15's extra (Design Select) button has a highlight of its own
271  Common::Rect _extraButtonHighlightSrc;
272  Common::Array<Common::Rect> _scrollbarSrcs;
273 
274  Common::Array<uint16> _scrollbarsCenterYPos;
275  Common::Array<uint16> _scrollbarsCenterXPosL;
276  Common::Array<uint16> _scrollbarsCenterXPosR;
277 
279 };
280 
281 // Contains data for the Save/Load screen. Used up to nancy7
282 struct LOAD : public EngineData {
283  LOAD(Common::SeekableReadStream *chunkStream);
284 
285  Common::Path _image1Name;
286 
287  int16 _mainFontID;
288  int16 _highlightFontID;
289  int16 _disabledFontID;
290  int16 _fontXOffset;
291  int16 _fontYOffset;
292 
293  Common::Array<Common::Rect> _saveButtonDests;
294  Common::Array<Common::Rect> _loadButtonDests;
295  Common::Array<Common::Rect> _textboxBounds;
296  Common::Rect _inputTextboxBounds;
297  Common::Rect _doneButtonDest;
298  Common::Array<Common::Rect> _saveButtonDownSrcs;
299  Common::Array<Common::Rect> _loadButtonDownSrcs;
300 
301  Common::Rect _doneButtonDownSrc;
302  Common::Array<Common::Rect> _saveButtonHighlightSrcs;
303  Common::Array<Common::Rect> _loadButtonHighlightSrcs;
304 
305  Common::Rect _doneButtonHighlightSrc;
306  Common::Array<Common::Rect> _saveButtonDisabledSrcs;
307  Common::Array<Common::Rect> _loadButtonDisabledSrcs;
308 
309  Common::Rect _doneButtonDisabledSrc;
310  Common::Rect _blinkingCursorSrc;
311  uint16 _blinkingTimeDelay;
312  Common::Array<Common::Rect> _cancelButtonSrcs;
313  Common::Array<Common::Rect> _cancelButtonDests;
314  Common::Rect _cancelButtonDownSrc;
315  Common::Rect _cancelButtonHighlightSrc;
316  Common::Rect _cancelButtonDisabledSrc;
317 
318  Common::Path _gameSavedPopup;
319  Common::String _emptySaveText;
320  Common::String _defaultSaveNamePrefix;
321  // Common::Rect _gameSavedBounds
322 
323  // v2 members
324  Common::Path _image2Name;
325  Common::Path _imageButtonsName;
326 
327  Common::Array<Common::Rect> _unpressedButtonSrcs;
328  Common::Array<Common::Rect> _pressedButtonSrcs;
329  Common::Array<Common::Rect> _highlightedButtonSrcs;
330  Common::Array<Common::Rect> _disabledButtonSrcs;
331 
332  Common::Array<Common::Rect> _buttonDests;
333 };
334 
335 // Contains data for the prompt that appears when exiting the game
336 // without saving first. Introduced in nancy3.
337 struct SDLG : public EngineData {
338  struct Dialog {
339  Dialog(Common::SeekableReadStream *chunkStream);
340 
341  Common::Path imageName;
342 
343  Common::Rect yesDest;
344  Common::Rect noDest;
345  Common::Rect cancelDest;
346 
347  Common::Rect yesHighlightSrc;
348  Common::Rect noHighlightSrc;
349  Common::Rect cancelHighlightSrc;
350 
351  Common::Rect yesDownSrc;
352  Common::Rect noDownSrc;
353  Common::Rect cancelDownSrc;
354  };
355 
356  SDLG(Common::SeekableReadStream *chunkStream);
357 
358  Common::Array<Dialog> dialogs;
359 };
360 
361 // Contains data for the hint system. Only used in nancy1.
362 struct HINT : public EngineData {
363  HINT(Common::SeekableReadStream *chunkStream);
364 
365  Common::Array<uint16> numHints;
366 };
367 
368 // Contains data for the slider puzzle. First used in nancy1
369 struct SPUZ : public EngineData {
370  SPUZ(Common::SeekableReadStream *chunkStream);
371 
373 };
374 
375 // Contains data for the clock UI that appears at the bottom left of the screen (top left in TVD)
376 // Not used in nancy1 but still present in the data.
377 struct CLOK : public EngineData {
378  CLOK(Common::SeekableReadStream *chunkStream);
379 
381  Common::Array<Common::Rect> animDests;
382 
383  Common::Array<Common::Rect> hoursHandSrcs;
384  Common::Array<Common::Rect> minutesHandSrcs;
385  Common::Rect screenPosition;
386  Common::Array<Common::Rect> hoursHandDests;
387  Common::Array<Common::Rect> minutesHandDests;
388 
389  Common::Rect staticImageSrc;
390  Common::Rect staticImageDest;
391 
392  uint32 timeToKeepOpen = 0;
393  uint16 frameTime = 0;
394 
395  bool clockIsDisabled = false;
396  bool clockIsDay = false; // nancy5 clock
397 
398  uint32 countdownTime = 0;
400  Common::Array<Common::Rect> countdownSrcs;
401  Common::Rect disabledSrc; // possibly useless
402 };
403 
404 // Contains data for special effects (fades between scenes/fades to black).
405 // Introduced in nancy2.
406 struct SPEC : public EngineData {
407  SPEC(Common::SeekableReadStream *chunkStream);
408 
409  byte fadeToBlackNumFrames;
410  uint16 fadeToBlackFrameTime;
411  byte crossDissolveNumFrames;
412 };
413 
414 // Contains data for the raycast puzzle in nancy3. Specifically, this is the
415 // data for the different "themes" that appear in the 3D space.
416 struct RCLB : public EngineData {
417  struct Theme {
418  Common::String themeName;
419 
420  Common::Array<uint32> wallIDs;
421 
422  Common::Array<uint16> exitFloorIDs;
423  Common::Array<uint16> floorIDs;
424  Common::Array<uint16> ceilingIDs;
425 
426  Common::Array<uint32> doorIDs;
427  Common::Array<uint32> transparentwallIDs;
428  Common::Array<uint32> objectwallIDs;
429  Common::Array<uint16> objectWallHeights;
430 
431  uint16 generalLighting;
432  uint16 hasLightSwitch;
433 
434  int16 transparentWallDensity;
435  int16 objectWallDensity;
436  int16 doorDensity;
437  };
438 
439  RCLB(Common::SeekableReadStream *chunkStream);
440 
441  uint16 lightSwitchID;
442  uint16 unk2;
443  Common::Array<Theme> themes;
444 };
445 
446 // Contains data about the raycast puzzle in nancy3. Specifically, this is the
447 // data for the debug map and the names of the textures to be used when rendering.
448 struct RCPR : public EngineData {
449  RCPR(Common::SeekableReadStream *chunkStream);
450 
451  Common::Array<Common::Rect> screenViewportSizes;
452  uint16 viewportSizeUsed;
453 
454  byte wallColor[3];
455  byte playerColor[3];
456  byte doorColor[3];
457  byte lightSwitchColor[3];
458  byte exitColor[3];
459  byte uColor6[3];
460  byte uColor7[3];
461  byte uColor8[3];
462  byte transparentWallColor[3];
463  byte uColor10[3];
464 
465  Common::Array<Common::Path> wallNames;
466  Common::Array<Common::Path> specialWallNames;
467  Common::Array<Common::Path> ceilingNames;
468  Common::Array<Common::Path> floorNames;
469 };
470 
471 // Contains the name and dimensions of an image.
472 struct ImageChunk : public EngineData {
474 
475  Common::Path imageName;
476  uint16 width;
477  uint16 height;
478 };
479 
480 // Contains text data. Every string is tagged with a key via which
481 // it can be accessed. Used to store dialogue and journal (autotext) strings.
482 // NOT found inside BOOT; these are stored in their own cifs, the names of which
483 // can be found inside BSUM. Introduced in nancy6.
484 struct CVTX : public EngineData {
485  CVTX(Common::SeekableReadStream *chunkStream);
486 
488 };
489 
490 struct TABL : public EngineData {
491  TABL(Common::SeekableReadStream *chunkStream);
492 
493  Common::String soundBaseName;
494  Common::Array<uint16> startIDs;
495  Common::Array<uint16> correctIDs;
498 };
499 
500 struct MARK : public EngineData {
501  MARK(Common::SeekableReadStream *chunkStream);
502 
503  Common::Array<Common::Rect> _markSrcs;
504 };
505 
506 // Shared UI elements. Introduced in Nancy 10
507 struct SHUI : public EngineData {
508  SHUI(Common::SeekableReadStream *chunkStream);
509 
510  Common::Array<Common::Rect> _closeRects; // Close/"X" button rects
511  Common::Array<Common::Rect> _sliderRects; // Slider rects
512 };
513 
514 // ScrollTextBox - introduced in Nancy 11. Standard UI popup header,
515 // followed by the rect to restore when the text box is closed.
516 struct SCTB : public EngineData {
517  SCTB(Common::SeekableReadStream *chunkStream);
518 
519  UIPopupHeader header;
520  Common::Rect restoreSrcRect;
521 };
522 
523 enum TaskButton {
524  kTaskButtonMenu = 0,
525  kTaskButtonInventory = 1,
526  kTaskButtonNotebook = 2,
527  kTaskButtonCellphone = 3,
528  // Nancy12 only: a non-clickable coin purse that shows Nancy's money on
529  // hover, inserted before HELP. HELP is therefore always the last taskbar
530  // button (index 4 in games without the coin purse, index 5 in Nancy12) and
531  // has no fixed constant.
532  kTaskButtonCoinPurse = 4
533 };
534 
535 // Taskbar (the always-on strip at the bottom of the screen with MENU /
536 // inventory / notebook / cellphone / HELP buttons). Introduced in Nancy 10.
537 struct TASK : public EngineData {
538  struct ButtonRecord {
539  UIButtonRecord button;
540  // Source rect for the notification sprite (the badge shown on
541  // the middle three buttons when the popup has new content).
542  // Empty for buttons that don't carry a notification.
543  Common::Rect notificationSrcRect;
544  Common::String clickSoundName[3];
545  };
546 
547  TASK(Common::SeekableReadStream *chunkStream);
548 
549  // Maximum taskbar button slots: menu / inventory / notebook / cell phone /
550  // help, plus Nancy12's extra coin purse. Earlier games fill only the first 5.
551  static const uint kNumButtons = 6;
552  static const uint kButtonRecordSize = 354;
553  static const uint kNumAltSounds = 3;
554 
555  Common::Path imageName;
556 
557  Common::Rect srcRect;
558  Common::Rect dstRect;
559  Common::Rect unkRect1;
560  // Screen rect of the closed-caption text strip the taskbar draws (the
561  // ScrollTextBox's mini strip is positioned to it).
562  Common::Rect ccTextboxScreenRect;
563 
564  ButtonRecord buttons[kNumButtons];
565 };
566 
567 // Web browser popup UI (used from the cell phone to view in-game "web
568 // pages"). Introduced in Nancy 10
569 struct UIBW : public EngineData {
570  struct Hotspot {
571  uint16 id = 0;
572  Common::Rect rect;
573  };
574 
575  struct UrlPage {
576  Common::Path imageName;
577  Common::Array<Hotspot> hotspots;
578  };
579 
580  UIBW(Common::SeekableReadStream *chunkStream);
581 
582  static const uint kUrlRecordSize = 215;
583  static const uint kMaxHotspotsPerPage = 10;
584 
585  Common::Path imageName;
587 };
588 
589 // Cell-phone popup UI. Introduced in Nancy 10.
590 struct UICL : public EngineData {
591  struct DialPadSlot {
592  Common::Rect srcRect;
593  Common::Rect destRect;
594  Common::String soundName;
595  };
596 
598  Common::Rect srcRectIdle;
599  Common::Rect srcRectPressed;
600  Common::Rect destRect;
601  };
602 
603  // One phonebook entry, 41 bytes. A person can own several, one per number
604  // they are reachable on; `visibility` picks which is listed.
605  struct Contact {
606  static const uint kDialPatternLength = 11;
607 
608  enum {
609  kAlwaysListed = 10,
610  kNeverListed = 11
611  };
612 
613  // kAlwaysListed, kNeverListed, or the event flag that reveals the entry.
614  uint16 visibility = kNeverListed;
615  // Dial-pad slot indices (0..9), newline-terminated unless all 11 are used.
616  byte dialPattern[kDialPatternLength] = {};
617  Common::String name; // 20-byte field
618  // Calling the contact changes to this scene and fires the flag.
619  uint16 sceneID = kNoScene;
620  uint16 frameID = 0;
621  FlagDescription flag;
622  };
623 
625  Common::Rect srcRect;
626  Common::Rect destRect;
627  };
628 
629  static const uint kNumDialPadSlots = 15;
630 
631  // The last three are soft keys. Nancy 13 relabels them per screen (Cam or
632  // Dial, Del or Yes, Send or No); the ribbon label says which.
633  enum DialPadKey {
634  kDialKeyStar = 10,
635  kDialKeyHash = 11,
636  kDialKeyTalk = 12,
637  kDialKeyMenu = 13,
638  kDialKeyDirectory = 14
639  };
640 
641  // Nancy 10-12 have 10 online sub-buttons; Nancy 13 added an 11th (the Back
642  // button, Ghidra widget 0x10) at the front of the array.
643  static const uint kNumSubButtons = 10;
644  static const uint kNumSubButtonsNancy13 = 11;
645  static const uint kNumStatusLabels = 3; // No Signal / No Access / Old Email Only
646 
647  UICL(Common::SeekableReadStream *chunkStream);
648 
649  UIPopupHeader header;
650  Common::Path overlayImageName;
651 
652  // Template the call-flow sounds (ring / pickup / invalid) are played
653  // through. Only the name is swapped per call; channel / volume /
654  // loops come from here.
655  SoundDescription callSoundTemplate;
656 
657  DialPadSlot dialPadSlots[kNumDialPadSlots];
658 
659  // Screen-frame and label rects
660  SrcDestRectPair dialHilite;
661  Common::Rect screenOutSrcRect;
662  int32 statusTextX = 0; // text X-baseline
663  int32 statusTextY = 0; // text Y-baseline
664  SrcDestRectPair welcomeScreen;
665  Common::String statusLabels[kNumStatusLabels]; // "No Signal", "No Access", "Old Email Only"
666  // Ribbon labels above the top-row buttons. In Nancy 13 the top row is
667  // Cam/Menu/Dir, and the review / delete screens reuse the same three columns
668  // with the Del/Send and Yes/No variants (all read from the 8-label block).
669  SrcDestRectPair dialLabel; // Nancy 13: "CAM"
670  SrcDestRectPair webLabel; // Nancy 13: "MENU"
671  SrcDestRectPair dirLabel; // Nancy 13: "DIR"
672  SrcDestRectPair dialingLabel; // Nancy 13: "DIAL"
673  SrcDestRectPair delLabel; // Nancy 13: "DEL"
674  SrcDestRectPair sendLabel; // Nancy 13: "SEND"
675  SrcDestRectPair yesLabel; // Nancy 13: "YES"
676  SrcDestRectPair noLabel; // Nancy 13: "NO"
677 
678  // Help "?" button (original button index 15). The visible Talk/Call key
679  // is dial-pad slot 12, not a separate widget.
680  ThreeRectWidget helpButton;
681 
682  // Screen-content sprite block
683  Common::String helpTextKey; // CVTX key for the help page text
684  Common::Rect signalSpriteSrc;
685  Common::Rect signalSpriteSrcAlt;
686  Common::Rect signalSpriteDest;
687  Common::Rect batterySpriteSrc;
688  Common::Rect batterySpriteSrcAlt;
689  Common::Rect batterySpriteDest;
690  SrcDestRectPair typeMessage;
691  SrcDestRectPair connectedLabel;
692  Common::Rect connectingSpriteSrc;
693  Common::Rect connectingSpriteSrcAlt; // state-8 variant
694  Common::Rect connectingSpriteDest;
695  SrcDestRectPair onlineHeading;
696  Common::Rect fullEmptyScreenSrc;
697  Common::Rect emailListContainer; // scrollbar/list container
698  Common::Rect dirArrowSrc;
699  Common::Rect dirCursorSrc;
700  SrcDestRectPair dirHeading;
701 
702  ThreeRectWidget subButtons[kNumSubButtonsNancy13];
703 
704  // Heading/icon SRC+DEST pairs
705  SrcDestRectPair searchHeading;
706  Common::Rect emailIconUnread;
707  Common::Rect emailIconSelected;
708  SrcDestRectPair emailHeading;
709  SrcDestRectPair helpHeading;
710  SrcDestRectPair browserHeading;
711 
712  // One initial email entry and one initial web-search entry can be baked
713  // into the UICL chunk itself; the original seeds them at new-game init
714  // (its cellphone reset). An empty key means the game ships that list empty.
715  SearchLink initialEmail;
716  SearchLink initialSearch;
717 
718  uint16 fontId1 = 0;
719  uint16 fontId2 = 0;
720 
721  Common::Path outgoingRingSound; // post-dial ring
722  Common::Path pickupSound; // call connect
723  Common::Path invalidNumberSound; // try again
724 
725  uint16 contactCount = 0;
726  Common::Array<Contact> contacts;
727 
728  // Nancy 13 added a camera / pictures sub-UI to the cell phone, which
729  // reorganized the chunk body. The fields below are only populated for
730  // Nancy 13 and later.
731 
732  // A photographable subject. Framing coords in sceneID sets captureFlag;
733  // sending that snapshot to contact recipientIndex sets sendFlag.
734  struct CameraSubject {
735  int16 sceneID = -1;
736  Common::Rect coords;
737  int16 captureFlag = -1;
738  int16 sendFlag = -1;
739  int16 recipientIndex = -1;
740  };
741 
742  // The LCD screen area: cleared through, and bounds the directory list.
743  // Earlier games keep it in screenOutSrcRect.
744  Common::Rect cameraViewSrcRect;
745  int32 cameraTextX = 0;
746  int32 cameraTextY = 0;
747  Common::Path cameraViewImageName; // "UI_CellCamView_OVL"
748  Common::Path cameraClickSound;
749  Common::Rect pictureDisplayRect; // where a captured picture is shown
750  Common::Rect noPictureScreenRect; // "no pictures" placeholder
751  Common::Path helpTextKey2; // second CVTX key (phone-use help)
752  byte screenColors[9] = {}; // 3 RGB colors for the phone screen
753  Common::Array<CameraSubject> cameraSubjects; // up to 50
754 };
755 
756 // Shared by the UICL chunk and ChangeCellPhoneInfo (AR 130).
757 void readContact(Common::SeekableReadStream &stream, UICL::Contact &c);
758 
759 // Standalone camera UI, added in Nancy14. While it is active a viewfinder sits at
760 // the centre of the viewport and the scene's own hotspots are suppressed.
761 struct UICM : public EngineData {
762  UICM(Common::SeekableReadStream *chunkStream);
763 
764  // A photographable region. Taking a picture captures every subject in the
765  // current scene lying wholly inside the viewfinder.
766  struct CameraSubject {
767  HotspotDescription hotspot; // sceneID + region that can be photographed
768  int16 subjectID = -1; // event flag raised while photographed
769  FlagDescription flag; // second event flag (unset in every record)
770  };
771 
772  Common::Path overlayImageName; // "PHO_CameraView"
773  Common::Rect viewRect; // captured-picture bounds
774  uint16 maxPictures = 0; // most pictures the camera can hold
775  byte pictureCount = 0; // current picture count (0xff = none)
776  RandomSoundBlock shutterSound; // picture-capture cue
777 
779 };
780 
781 // New conversation popup UI (the text strip that appears above the taskbar
782 // when a character is speaking). Introduced in Nancy 10.
783 // Note: response hotspots are NOT in this chunk — they live in a separate
784 // TextBoxSummaryChunk, each carrying a response-sound filename referenced
785 // by ProcessConversation when STOP_VIDEO transitions to PLAYER_RESPONSE_SOUND.
786 struct UICO : public EngineData {
787  UICO(Common::SeekableReadStream *chunkStream);
788 
789  UIPopupHeader header;
790  Common::Rect textRect; // Text-drawing rect inside the popup overlay
791 };
792 
793 // New inventory popup UI (4x4 item grid with paging slider and category
794 // filter tabs along the right edge). Introduced in Nancy 10.
795 struct UIIV : public EngineData {
796  UIIV(Common::SeekableReadStream *chunkStream);
797 
798  static const uint kNumFilters = 6;
799 
800  UIPopupHeader header;
801  Common::Array<Common::Rect> slotSrcRects; // 16 entries (image coords)
802  Common::Array<Common::Rect> slotDestRects; // 16 entries (screen coords)
803  Common::Rect slotsHotspot; // Nancy13+: clickable region of the item slots
804  // When nonzero, items added while the popup is open are appended to the end
805  // of the inventory order instead of being inserted at the front (so the most
806  // recently dropped item ends up last). See Scene::addItemToInventory.
807  byte appendItemsWhileOpen = 0;
808  UIButtonSlot filters[kNumFilters]; // 6 entries
809  Common::Array<Common::Rect> tabCaptionSrcRects; // 6 entries
810  Common::Rect tabCaptionDestRect; // on-screen target
811 };
812 
813 // New notebook UI. Introduced in Nancy 10.
814 struct UINB : public EngineData {
815  UINB(Common::SeekableReadStream *chunkStream);
816 
817  static const uint kNumTabs = 2;
818  static const uint kNumPageSoundsPerSet = 3;
819 
820  UIPopupHeader header;
821  UIButtonSlot tabs[kNumTabs];
822  Common::Rect textRect;
823  byte primaryTextColor[3] = {}; // RGB, Nancy 13+
824  byte secondaryTextColor[3] = {}; // RGB, Nancy 13+
825  uint16 primaryFontID = 0;
826  uint16 secondaryFontAttr = 0;
827  uint16 useFilenameTextFlag = 0;
828  Common::Path conditionalTextFilename;
829  Common::Path actionableClickSounds[kNumPageSoundsPerSet];
830  Common::Path noActionClickSounds[kNumPageSoundsPerSet];
831  Common::Array<Common::Rect> tabCaptionSrcRects; // 2 entries
832  Common::Rect tabCaptionDestRect; // on-screen target
833 };
834 
835 // Event flags table. Introduced in Nancy 12, and replaces the event flag names
836 // that were hardcoded in the executable. Each record is a name followed by an id.
837 struct EVNT : public EngineData {
838  EVNT(Common::SeekableReadStream *chunkStream);
839 
840  static const uint kEventRecordSize = 35;
841 
842  Common::Array<Common::String> eventFlagNames;
843 };
844 
845 // UI overlay element table. Introduced in Nancy 12. Each record describes one UI
846 // element: its starting value, the shared overlay image it belongs to, its
847 // on-screen rect and up to six associated sound cues. Unused slots use the name
848 // "NO_UI_ITEM", and slots without a given sound use "NO SOUND".
849 struct UIRC : public EngineData {
850  struct ItemRecord {
851  uint16 startingValue = 0;
852  // Nancy 14 added an upper bound: a value that goes above it is reset to 0
853  uint16 maxValue = 0;
854  Common::Path overlayName;
855  Common::Rect rect;
856  int16 fontID = 0;
857  int16 numDecimals = 0;
858  int16 soundChannel = 0;
859  int16 soundVolume = 0;
860  Common::String soundNames[6];
861  };
862 
863  UIRC(Common::SeekableReadStream *chunkStream);
864 
865  static const uint kNumSounds = 6;
866 
868 };
869 
870 // Renders a UI resource's value the way the games' UI does: a currency symbol
871 // followed by the value, split into whole units and decimals as the record asks.
872 Common::String formatUIResourceValue(const UIRC::ItemRecord &item, int32 value);
873 
874 // Music mix table. Introduced in Nancy 13. Each record maps a short location
875 // code (e.g. "BRI", "CAM", "TUT") to the set of music / ambience tracks that
876 // may play there ("TacitA"/"TacitB" are the silence variants).
877 struct MMIX : public EngineData {
878  struct Record {
879  Common::String name;
881  };
882 
883  MMIX(Common::SeekableReadStream *chunkStream);
884 
885  Common::Array<Record> records;
886 };
887 
888 // Level name table. Introduced in Nancy 15. Maps a short scene-prefix
889 // code (e.g. "KAP") to its human-readable level name (e.g. "Kapu Cave").
890 struct LVLN : public EngineData {
891  LVLN(Common::SeekableReadStream *chunkStream);
892 
893  Common::Array<Common::String> levelCodes; // e.g. "KAP"
894  Common::Array<Common::String> levelNames; // e.g. "Kapu Cave"
895 };
896 
897 // Player-character selector UI. Introduced in Nancy 15, where the player
898 // alternates between Nancy and the Hardy Boys.
899 // Each entry supplies the image names for one selectable character.
900 struct PCUI : public EngineData {
901  struct Character {
902  Common::String imageName; // e.g. "PUI_CRE_Nancy"
903  Common::String defaultImageName; // e.g. "PUI_CRE_Nancy_Default"
904  uint16 id = 0;
905  };
906 
907  PCUI(Common::SeekableReadStream *chunkStream);
908 
909  byte flag = 0;
910  Common::Path uiName; // Nancy 16+, e.g. "UI_Main"
911  Common::Array<Character> characters; // indexed by the on-disk slot byte
912 };
913 
914 // Fixed 314-byte layout block for the Nancy 15 "Design Select" screen, which
915 // picks the look (outfit) the player character's UI and cutscenes use. Reached
916 // from the in-game setup menu. Companion to PCUI.
917 struct LDSN : public EngineData {
918  static const uint kNumButtons = 2;
919  // The screen lists the available designs in a fixed column of rows
920  static const uint kNumDesignRows = 9;
921 
922  LDSN(Common::SeekableReadStream *chunkStream);
923 
924  Common::Path backgroundImageName; // "UI_DesignSelectBG", fills the screen
925  Common::Path overlayImageName; // "UI_DesignSelect_OVL", the buttons' sprite sheet
926 
927  // The two buttons' artwork, cut from the overlay image. [0] applies the
928  // highlighted design, [1] leaves without applying.
929  Common::Array<Common::Rect> buttonDownSrcs;
930  Common::Array<Common::Rect> buttonHighlightSrcs;
931  Common::Array<Common::Rect> buttonDests;
932 
933  Common::Array<Common::Rect> designRowDests; // where each design's name is drawn
934  int16 fontID = 0; // design names
935  int16 highlightFontID = 0; // ...and the selected one
936 };
937 
938 // Player-UI header. Introduced in Nancy 15, first chunk of each character's
939 // PUI_CRE_<char>_DEFAULT_BOOT file. Names the UI theme and its swatch image.
940 struct PUIH : public EngineData {
941  PUIH(Common::SeekableReadStream *chunkStream);
942 
943  byte flag = 0;
944  Common::String themeName; // e.g. "Nancy Classic Look (Default)"
945  Common::String swatchImageName; // e.g. "UI_Swatch_ND"
946 
947  // Nancy 16+. Names of the IFFs describing the journal and task list popups
948  Common::Path journalPrepName; // e.g. "Journal_Prep"
949  Common::Path tasklistPrepName; // e.g. "Tasklist_Prep"
950 };
951 
952 // Task list sounds. Introduced in Nancy 16 (per-character boot). Holds two
953 // banks of interchangeable sound names, sharing a channel, loop count and volume.
954 struct TSKL : public EngineData {
955  struct SoundBank {
956  Common::Array<Common::Path> soundNames;
957  uint16 channelID = 0;
958  uint32 numLoops = 0;
959  uint16 volume = 0;
960  };
961 
962  TSKL(Common::SeekableReadStream *chunkStream);
963 
964  SoundBank soundBanks[2];
965 };
966 
967 // Player-UI random-sound bank. Introduced in Nancy 15 (per-character boot).
968 // Holds a base name plus a channel/volume and a list of sound groups, each
969 // group being a set of interchangeable (randomly-picked) sound variants -
970 // e.g. the character's "can't do that" response cues.
971 struct PUIV : public EngineData {
972  struct SoundGroup {
973  byte tag = 0;
975  };
976 
977  PUIV(Common::SeekableReadStream *chunkStream);
978 
979  Common::String name; // e.g. "DEF_ND_CANT"
980  uint16 channelID = 0; // shared playback channel (inferred)
981  uint32 unknown = 0;
982  uint16 volume = 0; // shared volume (inferred)
983  Common::Array<SoundGroup> soundGroups;
984 };
985 } // End of namespace Nancy
986 
987 #endif // NANCY_ENGINEDATA_H
Definition: enginedata.h:369
Definition: enginedata.h:41
Definition: enginedata.h:362
Definition: enginedata.h:338
Definition: str.h:59
Definition: enginedata.h:901
Definition: enginedata.h:406
Definition: enginedata.h:849
Definition: enginedata.h:490
Definition: enginedata.h:238
Definition: commontypes.h:178
Definition: enginedata.h:590
Definition: enginedata.h:605
Definition: enginedata.h:955
Definition: enginedata.h:570
Definition: enginedata.h:786
Definition: rect.h:536
Definition: path.h:52
Definition: enginedata.h:597
Definition: enginedata.h:500
Definition: enginedata.h:195
Definition: stream.h:745
Definition: enginedata.h:194
Definition: enginedata.h:106
Definition: enginedata.h:917
Definition: enginedata.h:575
Definition: commontypes.h:413
Definition: enginedata.h:877
Definition: enginedata.h:569
Definition: enginedata.h:261
Definition: enginedata.h:472
Definition: enginedata.h:448
Definition: enginedata.h:250
Definition: commontypes.h:313
Definition: enginedata.h:228
Definition: enginedata.h:850
Definition: enginedata.h:114
Definition: enginedata.h:507
Definition: rect.h:144
Definition: enginedata.h:837
Definition: enginedata.h:377
Definition: commontypes.h:460
Definition: enginedata.h:96
Definition: enginedata.h:417
Definition: enginedata.h:591
Definition: enginedata.h:971
Definition: enginedata.h:954
Definition: enginedata.h:516
Definition: enginedata.h:624
Definition: enginedata.h:282
Definition: enginedata.h:972
Definition: commontypes.h:295
Definition: enginedata.h:484
Definition: enginedata.h:890
Definition: enginedata.h:337
Definition: enginedata.h:156
Definition: enginedata.h:795
Definition: enginedata.h:35
Definition: enginedata.h:761
Definition: commontypes.h:432
Definition: enginedata.h:900
Definition: enginedata.h:766
Definition: commontypes.h:193
Definition: enginedata.h:537
Definition: enginedata.h:878
Definition: commontypes.h:207
Definition: enginedata.h:940
Definition: actionmanager.h:32
Definition: enginedata.h:115
Definition: enginedata.h:814
Definition: enginedata.h:538
Definition: enginedata.h:734
Definition: enginedata.h:416