ScummVM API documentation
scene9050.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 HOLLYWOOD_MONSTERS_SCENES_INTRO_SCENE9050_H
23#define HOLLYWOOD_MONSTERS_SCENES_INTRO_SCENE9050_H
24
25#include "common/array.h"
26#include "common/random.h"
27
28#include "hollywood/monsters/music.h"
29#include "hollywood/monsters/scenes/presentation_scene.h"
30
31namespace Hollywood {
32
33class HollywoodEngine;
34
36public:
38
39 bool play();
40
41private:
42 enum BlockingAnimationMode {
43 kNoBlockingAnimation,
44 kResourceI05ClipAnimation,
45 kInterClipRevealAnimation,
46 kInterClipReverseAnimation,
47 kResourceI08BlinkAnimation,
48 kResourceI07FinalAnimation
49 };
50
51 bool loadResourceI06Assets();
52 bool loadResourceI05ClipSegment(byte segmentId);
53 bool loadResourceI08BlinkAssets();
54 bool loadResourceI07FinalAssets();
55
56 void runResourceI06AnimatedPresentation();
57 void initializeResourceI06AnimatedPresentation();
58 bool runResourceI06ScrollInterlude();
59 bool runResourceI06SpriteInterlude();
60 bool runResourceI06Interlude(bool runScriptedSpriteSequence);
61 void initializeResourceI06Interlude();
62 void copyResourceI06ScrolledBaseFrame();
63 void presentResourceI06AnimatedFrame();
64 void drawResourceI06AnimatedFrame(byte chunkIndex, byte frameIndex);
65 void advanceResourceI06Timers(uint32 millis);
66 void advanceResourceI06InterludeTimers(uint32 millis, bool runScriptedSpriteSequence);
67 void advanceResourceI06Scroll();
68 void advanceResourceI06InterludeScroll(bool runScriptedSpriteSequence);
69 void advanceResourceI06SecondarySprite();
70 void advanceResourceI06PrimarySprite();
71 void advanceResourceI06InterludePrimarySprite(bool runScriptedSpriteSequence);
72 void advanceResourceI06VerticalBob();
73 void advanceResourceI06PalettePulse();
74 void markResourceI06CompositeDirty();
75 bool runResourceI06AnimationLoop(bool interlude, bool runScriptedSpriteSequence);
76 void finishResourceI06AnimationLoop(bool interlude);
77 void ensureContinuousSound(byte cueId, byte volumePercent);
78 void stopContinuousSound();
79
80 void runResourceI05Clip(byte segmentId, byte lastFrameIndex, bool fadeInBeforePlayback);
81 void drawResourceI05ClipFrameDelta(byte lastFrameIndex, byte frameIndex);
82 bool waitResourceI05ClipHold();
83 bool playResourceI05ClipSegment(byte segmentId, byte lastFrameIndex, bool fadeInBeforePlayback);
84 void runStage9050InterClipSpriteReveal();
85 void advanceStage9050Cutscene();
86 void runResourceI05InterClipRevealPhase(byte localChunkIndex);
87 void runResourceI05InterClipReversePhase();
88 void restoreAndDrawResourceDescriptorFrame(byte localChunkIndex, byte descriptorCount, byte descriptorIndex, bool drawFrame);
89 bool runResourceI08BlinkSequence();
90 bool waitResourceI08BlinkLoop(uint32 millis);
91 bool runResourceI07FinalAnimation();
92 bool waitSceneCounterPast(uint threshold);
93 bool playBlockingAnimation(BlockingAnimationMode mode, byte firstFrame,
94 byte lastFrame, uint32 frameMillis, byte chunkIndex = 0,
95 bool waitAfterFinalFrame = false);
96 void presentAnimationFrame() override;
97 bool waitForAnimationFrame(uint32 millis, bool allowSkip) override;
98
99 void stopAudio() override;
100
101 enum {
102 kI06RequiredChunkCount = 6,
103 kI08RequiredChunkCount = 3,
104 kI07RequiredChunkCount = 3,
105 kI06AnimatedFrameDescriptorCount = 0x1f,
106 kI05InterClipFrameDescriptorCount = 10,
107 kI08BlinkFrameDescriptorCount = 2,
108 kI07FinalFrameDescriptorCount = 0x15,
109 kI06InitialBaseScrollOffset = 0xc0
110 };
111
112 MusicPlayer _music;
113 SoundBank0Player _continuousSound;
114 SoundBank0Player _effectSound;
115 Common::RandomSource _random;
116 Common::Array<byte> _paletteResource;
117 IndexedSurfaceBuffer _clipBaseFramebuffer;
118 uint32 _i05ClipChunkSize;
119 byte _i05ClipFrameCount;
120 uint32 _i06ScrollAccumulator;
121 uint32 _i06PrimarySpriteAccumulator;
122 uint32 _i06SecondarySpriteAccumulator;
123 uint32 _i06VerticalBobAccumulator;
124 uint32 _i06PalettePulseAccumulator;
125 uint16 _i06FrameCounter;
126 uint16 _i06BaseImageScrollOffset;
127 uint16 _i06PreviousBaseImageScrollOffset;
128 byte _i06PrimarySpriteFrame;
129 byte _i06PrimarySpriteSequenceState;
130 byte _i06PrimarySpriteSequenceStep;
131 byte _i06SecondarySpriteFrame;
132 byte _i06PreviousSecondarySpriteFrame;
133 byte _i06RandomBasePhase;
134 byte _i06PreviousRandomBasePhase;
135 byte _i06VerticalBobOffset;
136 byte _i06VerticalBobTicksRemaining;
137 int _i06VerticalBobDelta;
138 byte _i06PalettePulseStepIndex;
139 byte _currentMusicCue;
140 byte _continuousSoundCue;
141 byte _i05EntriesPerSegment;
142 BlockingAnimationMode _blockingAnimationMode;
143 byte _blockingAnimationFrame;
144 byte _blockingAnimationChunk;
145 bool _i06OptionalOverlayChunk5Enabled;
146 bool _i06BaseFrameDirty;
147 bool _i06PrimarySpriteDirty;
148 bool _i06SecondarySpriteDirty;
149 bool _i06CompositeForceDirty;
150 bool _i06PaletteDirty;
151 bool _i06SequenceFinished;
152};
153
154} // End of namespace Hollywood
155
156#endif // HOLLYWOOD_MONSTERS_SCENES_INTRO_SCENE9050_H
Definition: random.h:44
Definition: hollywood.h:47
Definition: graphics.h:74
Definition: music.h:31
Definition: presentation_scene.h:38
Definition: scene9050.h:35
Definition: music.h:82