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