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();
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 setCondition(int16 condition) { _condition = condition; }
111  void setConditionBit(int16 cb) { _conditionBit = cb; }
112  void setDisableWhenComplete(bool upd) { _disableWhenComplete = upd; }
113  void setLoop(bool loop) { _loop = loop; }
114  void setScriptDriven(bool b) { _scriptDriven = b; }
115  void setSoundHeading(uint16 v) { _soundHeading = v; }
116  void setSoundAttenuation(uint16 v) { _soundAttenuation = v; }
117  void setAdditiveBlending(bool b) { _additiveBlending = b; }
118  void setTransparency(int32 v) { _transparency = v; }
119  void setTransparencyVar(uint16 v) { _transparencyVar = v; }
120 
121 protected:
122  bool _enabled;
123  bool _loop;
124  bool _disableWhenComplete;
125  bool _scriptDriven;
126  bool _isLastFrame;
127 
128  int16 _condition;
129  uint16 _conditionBit;
130 
131  uint16 _startFrameVar;
132  uint16 _endFrameVar;
133  uint16 _posUVar;
134  uint16 _posVVar;
135  uint16 _volumeVar;
136 
137  uint32 _soundHeading;
138  uint32 _soundAttenuation;
139 
140  uint16 _nextFrameReadVar;
141  uint16 _nextFrameWriteVar;
142 
143  uint16 _playingVar;
144 
145  uint16 _transparencyVar;
146 
147  void updateVolume();
148 };
149 
150 class SimpleMovie : public Movie {
151 public:
152  SimpleMovie(Myst3Engine *vm, uint16 id);
153  virtual ~SimpleMovie();
154 
155  void update();
156  bool endOfVideo();
157 
158  void playStartupSound();
159  void refreshAmbientSounds();
160 
161  void setSynchronized(bool b) { _synchronized = b; }
162 
163  void play();
164 
165 private:
166  bool _synchronized;
167  uint _startEngineTick;
168 };
169 
170 // Used by the projectors on J'nanin, see puzzle #14
172 public:
173  ProjectorMovie(Myst3Engine *vm, uint16 id, Graphics::Surface *background);
174  virtual ~ProjectorMovie();
175 
176  void update();
177 
178 private:
179  Graphics::Surface *_background;
180  Graphics::Surface *_frame;
181 
182  static const uint kBlurIterations = 30;
183  uint8 _blurTableX[kBlurIterations];
184  uint8 _blurTableY[kBlurIterations];
185 };
186 
187 } // End of namespace Myst3
188 
189 #endif // MOVIE_H_
Definition: movie.h:150
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:171
void pause(bool pause)
Definition: gfx.h:36
Definition: myst3.h:87
Definition: subtitles.h:34