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