22#ifndef HOLLYWOOD_MONSTERS_SCENES_INTRO_SCENE9100_H
23#define HOLLYWOOD_MONSTERS_SCENES_INTRO_SCENE9100_H
25#include "common/array.h"
26#include "common/random.h"
27#include "common/str.h"
29#include "hollywood/monsters/gameplay/actor_renderer.h"
30#include "hollywood/monsters/music.h"
31#include "hollywood/monsters/scenes/presentation_scene.h"
32#include "hollywood/scene_text_store.h"
43 bool playDialogueBranch();
56 enum TalkingOverlayBase {
57 kTalkingOverlayNone = -1,
58 kTalkingOverlayBase0 = 0,
59 kTalkingOverlayBase320000 = 320000,
60 kTalkingOverlayBase640000 = 640000
63 struct CinematicStep {
67 TalkingOverlayBase talkingOverlayBase;
68 byte talkingOverlayVariant;
69 bool copyFrameToSavedBefore;
70 bool animateForegroundActor;
71 SpeechTextStyle speechTextStyle;
74 bool load(
bool dialogueBranch);
75 bool loadActorResources();
76 bool loadI10ActorBank(uint runStreamChunkIndex, uint descriptorChunkIndex, ActorSpriteBank &bank);
78 void applyActorHighlightColor(
byte highlightRed,
byte highlightGreen,
byte highlightBlue);
79 void runRonEntryConversation();
80 void drawRonEntryPathFrame(uint32 pathElapsedMillis, uint32 pathDurationMillis,
81 bool playFootstep =
false);
82 void runSueEntrySequence();
83 void runSueEntryPath();
84 void drawSueEntryPathFrame(uint32 pathElapsedMillis, uint32 pathDurationMillis,
85 bool playFootstep =
false);
86 void drawActorFrame(
const ActorSpriteBank &bank,
byte facing,
byte cel,
int worldX,
int worldY);
87 void playActorFootstepIfDue(
int worldX,
int worldY,
byte cel);
88 void runForegroundIdleBeat();
89 void runOpeningPrelude();
90 void runCinematicSequence();
91 void initializeDialogueBranchOfficeState();
92 void runDialogueBranchSequence();
93 void prepareDialogueBranchOfficePatch();
94 void runForegroundPoseToDialogueState();
95 void runForegroundPoseBackToDeskIdle();
96 void prepareSceneFadeFrameWithScratchActor(
byte talkingOverlayVariant);
97 void prepareChunkDFrameWithOptionalActorOverlay(
bool actorOverlayEnabled);
99 void runConversationStep(uint16 textBankIndex,
byte descriptorIndex, TalkingOverlayBase talkingOverlayBase,
byte talkingOverlayVariant,
bool animateForegroundActor,
bool animateClock,
const SpeechTextStyle &speechTextStyle,
bool animateInsetActor =
false,
byte insetTalkBaseFrame = 0);
100 void waitForSpeechOrDelay(uint32 fallbackMillis, TalkingOverlayBase talkingOverlayBase,
byte talkingOverlayVariant,
bool animateForegroundActor,
bool animateClock,
bool animateInsetActor =
false,
byte insetTalkBaseFrame = 0);
101 void beginSubtitle(
const SceneSpeechCue &popup, uint segmentIndex,
const SpeechTextStyle &speechTextStyle);
103 void drawInitialForegroundFrame();
104 void drawForegroundActorFrame(
byte frameIndex);
105 void restoreForegroundActorLayer();
106 void drawForegroundActorLayer();
107 void drawDeskActorLayer(uint32 baseOffset, uint16 descriptorCount,
byte frameIndex,
bool restoreBackground);
108 void drawDeskPrimaryStaticFrame(
byte frameIndex,
bool restoreBackground =
true);
109 void drawDeskSecondaryStaticFrame(
byte frameIndex,
bool restoreBackground =
true);
110 void drawDeskPrimaryStaticLayer(
bool restoreBackground);
111 void drawDeskSecondaryStaticLayer(
bool restoreBackground);
112 void drawPersistentDeskActors();
113 void drawOfficeCompositeLayers();
114 void syncOfficeRestoreBaseFromSaved();
115 void animateForegroundFrames(
byte firstFrame,
byte lastFrame);
116 void animateDeskPrimaryStaticFrames(
byte firstFrame,
byte lastFrame);
117 void animateDeskSecondaryStaticFrames(
byte firstFrame,
byte lastFrame);
118 void advanceClockFrame();
119 void restoreClockAreaBackground();
120 void drawClockLayers();
121 void drawTalkingOverlay(TalkingOverlayBase talkingOverlayBase,
byte frameIndex,
byte talkingOverlayVariant);
122 void drawStripSpriteFrame(
const Common::Array<byte> &resource, uint32 baseOffset, uint32 descriptorTableOffset, uint16 descriptorCount, uint16 descriptorIndex);
123 void restoreSpriteBackground(
const Common::Array<byte> &resource, uint32 baseOffset, uint32 descriptorTableOffset, uint16 descriptorCount, uint16 descriptorIndex);
124 void applyResourceSpanPatchToFrameDecodeBuffer(uint32 baseOffset);
125 void drawResourceBlockListToSceneFramebuffer(uint32 baseOffset);
126 void restoreResourceBlockListFromCleanOfficeBase(uint32 baseOffset, IndexedSurfaceBuffer &destination);
127 void removeInitialOfficeTitlePatch(IndexedSurfaceBuffer &destination);
128 void expandFillRunsToSavedFramebuffer();
129 void restoreOfficeFrameAndPresent();
130 void applyBackgroundMode(
const CinematicStep &step);
131 void copyPaletteSegment(
byte segmentIndex);
132 void copyDefaultPalette();
133 bool advanceClockTimer(uint32 millis);
134 bool advanceTalkingTimer(uint32 millis);
135 bool delayFrame(uint32 millis, TalkingOverlayBase talkingOverlayBase,
byte talkingOverlayVariant,
bool animateForegroundActor,
bool animateClock,
bool animateInsetActor =
false,
byte insetTalkBaseFrame = 0);
136 void stopAudio()
override;
138 byte nextTalkingFrameVariant();
139 uint32 getSegmentOffset(
byte segmentIndex)
const;
145 kI10ForegroundDescriptorCount = 0x24,
146 kI10DeskPrimaryStaticDescriptorCount = 3,
147 kI10DeskSecondaryStaticDescriptorCount = 6,
148 kI10ClockDescriptorCount = 0x3c,
149 kI10TalkingOverlayDescriptorCount = 10,
150 kSecondaryScratchBufferSize = 96000,
151 kDeskPrimaryStaticBase = 0,
152 kDeskSecondaryStaticBase = 48000,
153 kScratchChunk21Base = 0x4e200,
154 kScratchPrimaryPayloadBase = 640000
158 SpeechPlayer _speech;
159 SceneTextStore _text;
160 SoundBank0Player _effectSound;
161 SoundBank0Player _clockSound;
162 SoundBank0Player _ambientSound;
163 ResidentSoundEffectPlayer _residentSoundEffects;
171 IndexedSurfaceBuffer _frameDecodeBuffer;
172 IndexedSurfaceBuffer _cleanOfficeBaseFramebuffer;
173 ActorSpriteBank _actorBankI10Ron;
174 ActorSpriteBank _actorBankI10Sue;
175 uint32 _clockFrameAccumulator;
176 uint32 _talkingFrameAccumulator;
177 byte _foregroundActorFrame;
178 byte _foregroundTalkBaseFrame;
179 byte _clockChunk7Frame;
180 byte _clockChunk8Frame;
181 byte _clockChunk9Frame;
182 byte _clockChunk7CarryGate;
184 byte _lastTalkingFrameVariant;
185 byte _deskPrimaryActorFrame;
186 byte _deskSecondaryActorFrame;
188 bool _deskPrimaryActorVisible;
189 bool _deskSecondaryActorVisible;
190 bool _dialogueBranch;
Definition: hollywood.h:47
Definition: presentation_scene.h:38
Definition: scene9100.h:38
Definition: scene9100.h:45