ScummVM API documentation
movie.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 MOVIE_H_
23 #define MOVIE_H_
24 
25 #include "engines/myst3/gfx.h"
26 #include "engines/myst3/node.h"
27 
28 #include "math/vector3d.h"
29 #include "video/bink_decoder.h"
30 
31 namespace Myst3 {
32 
33 class Myst3Engine;
34 class Texture;
35 class Subtitles;
36 
37 class Movie : public Drawable {
38 public:
39  Movie(Myst3Engine *vm, uint16 id);
40  virtual ~Movie();
41 
42  void draw() override;
43  void drawOverlay() override;
44 
46  void pause(bool pause);
47 
48  uint16 getId() { return _id; }
49  bool isVideoLoaded() {return _bink.isVideoLoaded(); }
50  void setPosU(int32 v) { _posU = v; }
51  void setPosV(int32 v) { _posV = v; }
52  void setForce2d(bool b);
53  void setForceOpaque(bool b) { _forceOpaque = b; }
54  void setStartFrame(int32 v);
55  void setEndFrame(int32 v);
56  void setVolume(int32 v) { _volume = v; }
57 
58 protected:
59  Myst3Engine *_vm;
60 
61  uint16 _id;
62  Subtitles *_subtitles;
63 
64  Math::Vector3d _pTopLeft;
65  Math::Vector3d _pBottomLeft;
66  Math::Vector3d _pBottomRight;
67  Math::Vector3d _pTopRight;
68 
69  bool _force2d;
70  bool _forceOpaque;
71  int32 _posU;
72  int32 _posV;
73 
74  Video::BinkDecoder _bink;
75  Texture *_texture;
76 
77  int32 _startFrame;
78  int32 _endFrame;
79 
80  int32 _volume;
81 
82  bool _additiveBlending;
83  int32 _transparency;
84 
85  int32 adjustFrameForRate(int32 frame, bool dataToBink);
86  void loadPosition(const ResourceDescription::VideoData &videoData);
87  void drawNextFrameToTexture();
88 
89  void draw2d();
90  void draw3d();
91 };
92 
93 class ScriptedMovie : public Movie {
94 public:
95  ScriptedMovie(Myst3Engine *vm, uint16 id);
96  virtual ~ScriptedMovie();
97 
98  void draw() override;
99  void drawOverlay() override;
100  virtual void update(bool pauseAtFirstFrame = false) ;
101 
102  void setEndFrameVar(uint16 v) { _endFrameVar = v; }
103  void setNextFrameReadVar(uint16 v) { _nextFrameReadVar = v; }
104  void setNextFrameWriteVar(uint16 v) { _nextFrameWriteVar = v; }
105  void setPlayingVar(uint16 v) { _playingVar = v; }
106  void setPosUVar(uint16 v) { _posUVar = v; }
107  void setPosVVar(uint16 v) { _posVVar = v; }
108  void setVolumeVar(uint16 v) { _volumeVar = v; }
109  void setStartFrameVar(uint16 v) { _startFrameVar = v; }
110  void setPreloaded(bool b) { _isPreloaded = b; }
111  void setNoFrameSkip(bool b) { _noFrameSkip = b; }
112  void setUnk147(uint16 v) { _unk147 = v; }
113  void setUnk148(uint16 v) { _unk148 = v; }
114  void setCondition(int16 condition) { _condition = condition; }
115  void setConditionBit(int16 cb) { _conditionBit = cb; }
116  void setDisableWhenComplete(bool upd) { _disableWhenComplete = upd; }
117  void setLoop(bool loop) { _loop = loop; }
118  void setScriptDriven(bool b) { _scriptDriven = b; }
119  void setSoundHeading(uint16 v) { _soundHeading = v; }
120  void setSoundAttenuation(uint16 v) { _soundAttenuation = v; }
121  void setAdditiveBlending(bool b) { _additiveBlending = b; }
122  void setTransparency(int32 v) { _transparency = v; }
123  void setTransparencyVar(uint16 v) { _transparencyVar = v; }
124 
125 protected:
126  bool _enabled;
127  bool _loop;
128  bool _disableWhenComplete;
129  bool _scriptDriven;
130  bool _isLastFrame;
131  bool _isPreloaded;
132  bool _noFrameSkip;
133  uint16 _unk147;
134  uint16 _unk148;
135 
136  int16 _condition;
137  uint16 _conditionBit;
138 
139  uint16 _startFrameVar;
140  uint16 _endFrameVar;
141  uint16 _posUVar;
142  uint16 _posVVar;
143  uint16 _volumeVar;
144 
145  uint32 _soundHeading;
146  uint32 _soundAttenuation;
147 
148  uint16 _nextFrameReadVar;
149  uint16 _nextFrameWriteVar;
150 
151  uint16 _playingVar;
152 
153  uint16 _transparencyVar;
154 
155  void updateVolume();
156 };
157 
158 class SimpleMovie : public Movie {
159 public:
160  SimpleMovie(Myst3Engine *vm, uint16 id);
161  virtual ~SimpleMovie();
162 
163  void update();
164  bool endOfVideo();
165 
166  void playStartupSound();
167  void refreshAmbientSounds();
168 
169  void setSynchronized(bool b) { _synchronized = b; }
170 
171  void play();
172 
173 private:
174  bool _synchronized;
175  uint _startEngineTick;
176 };
177 
178 // Used by the projectors on J'nanin, see puzzle #14
180 public:
181  ProjectorMovie(Myst3Engine *vm, uint16 id, Graphics::Surface *background);
182  virtual ~ProjectorMovie();
183 
184  void update(bool pauseAtFirstFrame = false);
185 
186 private:
187  Graphics::Surface *_background;
188  Graphics::Surface *_frame;
189 
190  static const uint kBlurIterations = 30;
191  uint8 _blurTableX[kBlurIterations];
192  uint8 _blurTableY[kBlurIterations];
193 };
194 
195 } // End of namespace Myst3
196 
197 #endif // MOVIE_H_
Definition: movie.h:158
Definition: surface.h:67
Definition: movie.h:37
Definition: ambient.h:27
Definition: archive.h:112
Definition: gfx.h:93
Definition: movie.h:93
Definition: movie.h:179
void pause(bool pause)
Definition: gfx.h:36
Definition: myst3.h:87
Definition: subtitles.h:34