ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

movie.h

Go to the documentation of this file.
00001 /* ResidualVM - A 3D game interpreter
00002  *
00003  * ResidualVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the AUTHORS
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef MOVIE_H_
00024 #define MOVIE_H_
00025 
00026 #include "engines/myst3/gfx.h"
00027 #include "engines/myst3/node.h"
00028 
00029 #include "math/vector3d.h"
00030 #include "video/bink_decoder.h"
00031 
00032 namespace Myst3 {
00033 
00034 struct VideoData;
00035 class Myst3Engine;
00036 class Texture;
00037 class Subtitles;
00038 
00039 class Movie : public Drawable {
00040 public:
00041     Movie(Myst3Engine *vm, uint16 id);
00042     virtual ~Movie();
00043 
00044     virtual void draw() override;
00045     virtual void drawOverlay() override;
00046 
00048     void pause(bool pause);
00049 
00050     uint16 getId() { return _id; }
00051     bool isVideoLoaded() {return _bink.isVideoLoaded(); }
00052     void setPosU(int32 v) { _posU = v; }
00053     void setPosV(int32 v) { _posV = v; }
00054     void setForce2d(bool b);
00055     void setForceOpaque(bool b) { _forceOpaque = b; }
00056     void setStartFrame(int32 v);
00057     void setEndFrame(int32 v);
00058     void setVolume(int32 v) { _volume = v; }
00059 
00060 protected:
00061     Myst3Engine *_vm;
00062 
00063     uint16 _id;
00064     Subtitles *_subtitles;
00065 
00066     Math::Vector3d _pTopLeft;
00067     Math::Vector3d _pBottomLeft;
00068     Math::Vector3d _pBottomRight;
00069     Math::Vector3d _pTopRight;
00070 
00071     bool _force2d;
00072     bool _forceOpaque;
00073     int32 _posU;
00074     int32 _posV;
00075 
00076     Video::BinkDecoder _bink;
00077     Texture *_texture;
00078 
00079     int32 _startFrame;
00080     int32 _endFrame;
00081 
00082     int32 _volume;
00083 
00084     bool _additiveBlending;
00085     int32 _transparency;
00086 
00087     int32 adjustFrameForRate(int32 frame, bool dataToBink);
00088     void loadPosition(const VideoData &videoData);
00089     void drawNextFrameToTexture();
00090 
00091     void draw2d();
00092     void draw3d();
00093 };
00094 
00095 class ScriptedMovie : public Movie {
00096 public:
00097     ScriptedMovie(Myst3Engine *vm, uint16 id);
00098     virtual ~ScriptedMovie();
00099 
00100     void draw() override;
00101     void drawOverlay() override;
00102     virtual void update();
00103 
00104     void setEndFrameVar(uint16 v) { _endFrameVar = v; }
00105     void setNextFrameReadVar(uint16 v) { _nextFrameReadVar = v; }
00106     void setNextFrameWriteVar(uint16 v) { _nextFrameWriteVar = v; }
00107     void setPlayingVar(uint16 v) { _playingVar = v; }
00108     void setPosUVar(uint16 v) { _posUVar = v; }
00109     void setPosVVar(uint16 v) { _posVVar = v; }
00110     void setVolumeVar(uint16 v) { _volumeVar = v; }
00111     void setStartFrameVar(uint16 v) { _startFrameVar = v; }
00112     void setCondition(int16 condition) { _condition = condition; }
00113     void setConditionBit(int16 cb) { _conditionBit = cb; }
00114     void setDisableWhenComplete(bool upd) { _disableWhenComplete = upd; }
00115     void setLoop(bool loop) { _loop = loop; }
00116     void setScriptDriven(bool b) { _scriptDriven = b; }
00117     void setSoundHeading(uint16 v) { _soundHeading = v; }
00118     void setSoundAttenuation(uint16 v) { _soundAttenuation = v; }
00119     void setAdditiveBlending(bool b) { _additiveBlending = b; }
00120     void setTransparency(int32 v) { _transparency = v; }
00121     void setTransparencyVar(uint16 v) { _transparencyVar = v; }
00122 
00123 protected:
00124     bool _enabled;
00125     bool _loop;
00126     bool _disableWhenComplete;
00127     bool _scriptDriven;
00128     bool _isLastFrame;
00129 
00130     int16 _condition;
00131     uint16 _conditionBit;
00132 
00133     uint16 _startFrameVar;
00134     uint16 _endFrameVar;
00135     uint16 _posUVar;
00136     uint16 _posVVar;
00137     uint16 _volumeVar;
00138 
00139     uint32 _soundHeading;
00140     uint32 _soundAttenuation;
00141 
00142     uint16 _nextFrameReadVar;
00143     uint16 _nextFrameWriteVar;
00144 
00145     uint16 _playingVar;
00146 
00147     uint16 _transparencyVar;
00148 
00149     void updateVolume();
00150 };
00151 
00152 class SimpleMovie : public Movie {
00153 public:
00154     SimpleMovie(Myst3Engine *vm, uint16 id);
00155     virtual ~SimpleMovie();
00156 
00157     void update();
00158     bool endOfVideo();
00159 
00160     void playStartupSound();
00161     void refreshAmbientSounds();
00162 
00163     void setSynchronized(bool b) { _synchronized = b; }
00164 
00165     void play();
00166 
00167 private:
00168     bool _synchronized;
00169     uint _startEngineTick;
00170 };
00171 
00172 // Used by the projectors on J'nanin, see puzzle #14
00173 class ProjectorMovie : public ScriptedMovie {
00174 public:
00175     ProjectorMovie(Myst3Engine *vm, uint16 id, Graphics::Surface *background);
00176     virtual ~ProjectorMovie();
00177 
00178     void update();
00179 
00180 private:
00181     Graphics::Surface *_background;
00182     Graphics::Surface *_frame;
00183 
00184     static const uint kBlurIterations = 30;
00185     uint8 _blurTableX[kBlurIterations];
00186     uint8 _blurTableY[kBlurIterations];
00187 };
00188 
00189 } // End of namespace Myst3
00190 
00191 #endif // MOVIE_H_


Generated on Sat Aug 24 2019 05:00:55 for ResidualVM by doxygen 1.7.1
curved edge   curved edge