ScummVM API documentation
presentation.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_RUNAWAY_PRESENTATION_H
23#define HOLLYWOOD_RUNAWAY_PRESENTATION_H
24
25#include "common/random.h"
26#include "common/language.h"
27#include "common/ustr.h"
28#include "hollywood/runaway/audio.h"
29#include "hollywood/runaway/graphics.h"
30#include "hollywood/runaway/speech.h"
31#include "hollywood/scene_text_store.h"
32
33namespace Common {
34struct Event;
35}
36
37namespace Hollywood {
38
39void dimRunawayViewport(Graphics::ManagedSurface &screen, uint brightness, uint maximum = 1000);
40
41// Shared input policy for full-screen sequences, including films hosted by rooms.
43public:
44 virtual ~RunawayPresentation() {}
45 // Returns true when the pause menu is requested.
46 bool handlePresentationEvent(const Common::Event &event);
47 void processPresentationInput(uint32 now);
48
49 // The engine owns one mouse state across consecutive and nested presentations.
50 class MouseState {
51 public:
53 Common::Point update(bool active);
54
55 private:
56 Common::Point _position;
57 bool _active = false, _wasVisible = false;
58 };
59
60protected:
61 virtual void skipPresentation(uint32 now) = 0;
62 virtual void skipPresentationSpeech(uint32 now) {}
63 virtual bool clickSkipsPresentation() const { return false; }
64
65private:
66 bool _skipRequested = false, _skipSpeechRequested = false;
67};
68
70public:
71 bool load();
72 void start(uint32 now) { _started = _now = now; }
73 void update(uint32 now) { _now = now; }
74 bool finished() const;
75 void draw(Graphics::ManagedSurface &screen) const;
76
77private:
78 Graphics::ManagedSurface _roll, _card;
79 uint32 _started = 0, _now = 0;
80};
81
83public:
84 explicit RunawayInterrogation(Audio::Mixer *mixer) :
85 _audio(mixer), _random("runawayInterrogation"), _speech(_audio, _random, RunawaySpeech::kTextLipSync) {}
86 bool load();
87 void start(uint32 now);
88 void update(uint32 now);
89 void skipSpeech();
90 void stop();
91 void draw(Graphics::ManagedSurface &screen) const;
92 bool finished() const { return _phrase >= _phraseCount; }
93 bool speaking() const { return _row != 0; }
94 const Common::U32String &subtitle() const { return _speech.subtitle(); }
95
96private:
97 void nextPhrase();
98 void showSpeechRow();
99 RunawayAudio _audio;
100 Common::RandomSource _random;
101 RunawaySpeech _speech;
102 SceneTextStore _text;
103 Graphics::ManagedSurface _background;
104 RunawayAnimation _actors[3];
105 uint _frames[3] = {};
106 bool _idle[3] = {};
107 byte _speakers[4] = {}, _phrase = 0, _phraseCount = 0;
108 uint16 _row = 0, _lastRow = 0, _sample = 0;
109 uint32 _now = 0, _lastTick[3] = {};
110};
111
113public:
114 RunawayEnding(Audio::Mixer *mixer, Common::Language language) : _audio(mixer), _random("runawayEnding"), _language(language) {}
115 bool load();
116 void start(uint32 now);
117 void update(uint32 now);
118 void skip(uint32 now);
119 void draw(Graphics::ManagedSurface &screen) const;
120 bool finished() const { return _stage == kFinished; }
121
122private:
123 void skipPresentation(uint32 now) override { skip(now); }
124 bool clickSkipsPresentation() const override { return true; }
125
126 enum Stage { kOutside, kSlideshow, kCard, kFinished };
127 void nextSlide(uint32 now);
128 RunawayAudio _audio;
129 Common::RandomSource _random;
130 Common::Language _language;
131 Graphics::ManagedSurface _outside, _card, _slide, _demoLogo;
132 RunawayAnimation _layers[7];
133 Common::Array<byte> _occlusion[2];
134 uint _frames[7] = {};
135 bool _active[7] = {};
136 Stage _stage = kOutside;
137 uint _screenshot = 0;
138 uint32 _started = 0, _now = 0, _lastTick = 0;
139 uint32 _fadeStarted = 0, _fadeDuration = 0, _musicUntil = 0;
140};
141
142} // End of namespace Hollywood
143
144#endif
Definition: mixer.h:70
Definition: random.h:44
Definition: ustr.h:57
Definition: managed_surface.h:51
Definition: graphics.h:54
Definition: audio.h:29
Definition: presentation.h:69
Definition: presentation.h:112
Definition: presentation.h:82
Definition: presentation.h:50
Definition: presentation.h:42
Definition: speech.h:31
Definition: scene_text_store.h:64
Language
Definition: language.h:45
Definition: algorithm.h:29
Definition: events.h:218
Definition: rect.h:144