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 class Myst3Engine;
00035 class Texture;
00036 class Subtitles;
00037 
00038 class Movie : public Drawable {
00039 public:
00040     Movie(Myst3Engine *vm, uint16 id);
00041     virtual ~Movie();
00042 
00043     virtual void draw() override;
00044     virtual void drawOverlay() override;
00045 
00047     void pause(bool pause);
00048 
00049     uint16 getId() { return _id; }
00050     bool isVideoLoaded() {return _bink.isVideoLoaded(); }
00051     void setPosU(int32 v) { _posU = v; }
00052     void setPosV(int32 v) { _posV = v; }
00053     void setForce2d(bool b);
00054     void setForceOpaque(bool b) { _forceOpaque = b; }
00055     void setStartFrame(int32 v);
00056     void setEndFrame(int32 v);
00057     void setVolume(int32 v) { _volume = v; }
00058 
00059 protected:
00060     Myst3Engine *_vm;
00061 
00062     uint16 _id;
00063     Subtitles *_subtitles;
00064 
00065     Math::Vector3d _pTopLeft;
00066     Math::Vector3d _pBottomLeft;
00067     Math::Vector3d _pBottomRight;
00068     Math::Vector3d _pTopRight;
00069 
00070     bool _force2d;
00071     bool _forceOpaque;
00072     int32 _posU;
00073     int32 _posV;
00074 
00075     Video::BinkDecoder _bink;
00076     Texture *_texture;
00077 
00078     int32 _startFrame;
00079     int32 _endFrame;
00080 
00081     int32 _volume;
00082 
00083     bool _additiveBlending;
00084     int32 _transparency;
00085 
00086     int32 adjustFrameForRate(int32 frame, bool dataToBink);
00087     void loadPosition(const ResourceDescription::VideoData &videoData);
00088     void drawNextFrameToTexture();
00089 
00090     void draw2d();
00091     void draw3d();
00092 };
00093 
00094 class ScriptedMovie : public Movie {
00095 public:
00096     ScriptedMovie(Myst3Engine *vm, uint16 id);
00097     virtual ~ScriptedMovie();
00098 
00099     void draw() override;
00100     void drawOverlay() override;
00101     virtual void update();
00102 
00103     void setEndFrameVar(uint16 v) { _endFrameVar = v; }
00104     void setNextFrameReadVar(uint16 v) { _nextFrameReadVar = v; }
00105     void setNextFrameWriteVar(uint16 v) { _nextFrameWriteVar = v; }
00106     void setPlayingVar(uint16 v) { _playingVar = v; }
00107     void setPosUVar(uint16 v) { _posUVar = v; }
00108     void setPosVVar(uint16 v) { _posVVar = v; }
00109     void setVolumeVar(uint16 v) { _volumeVar = v; }
00110     void setStartFrameVar(uint16 v) { _startFrameVar = v; }
00111     void setCondition(int16 condition) { _condition = condition; }
00112     void setConditionBit(int16 cb) { _conditionBit = cb; }
00113     void setDisableWhenComplete(bool upd) { _disableWhenComplete = upd; }
00114     void setLoop(bool loop) { _loop = loop; }
00115     void setScriptDriven(bool b) { _scriptDriven = b; }
00116     void setSoundHeading(uint16 v) { _soundHeading = v; }
00117     void setSoundAttenuation(uint16 v) { _soundAttenuation = v; }
00118     void setAdditiveBlending(bool b) { _additiveBlending = b; }
00119     void setTransparency(int32 v) { _transparency = v; }
00120     void setTransparencyVar(uint16 v) { _transparencyVar = v; }
00121 
00122 protected:
00123     bool _enabled;
00124     bool _loop;
00125     bool _disableWhenComplete;
00126     bool _scriptDriven;
00127     bool _isLastFrame;
00128 
00129     int16 _condition;
00130     uint16 _conditionBit;
00131 
00132     uint16 _startFrameVar;
00133     uint16 _endFrameVar;
00134     uint16 _posUVar;
00135     uint16 _posVVar;
00136     uint16 _volumeVar;
00137 
00138     uint32 _soundHeading;
00139     uint32 _soundAttenuation;
00140 
00141     uint16 _nextFrameReadVar;
00142     uint16 _nextFrameWriteVar;
00143 
00144     uint16 _playingVar;
00145 
00146     uint16 _transparencyVar;
00147 
00148     void updateVolume();
00149 };
00150 
00151 class SimpleMovie : public Movie {
00152 public:
00153     SimpleMovie(Myst3Engine *vm, uint16 id);
00154     virtual ~SimpleMovie();
00155 
00156     void update();
00157     bool endOfVideo();
00158 
00159     void playStartupSound();
00160     void refreshAmbientSounds();
00161 
00162     void setSynchronized(bool b) { _synchronized = b; }
00163 
00164     void play();
00165 
00166 private:
00167     bool _synchronized;
00168     uint _startEngineTick;
00169 };
00170 
00171 // Used by the projectors on J'nanin, see puzzle #14
00172 class ProjectorMovie : public ScriptedMovie {
00173 public:
00174     ProjectorMovie(Myst3Engine *vm, uint16 id, Graphics::Surface *background);
00175     virtual ~ProjectorMovie();
00176 
00177     void update();
00178 
00179 private:
00180     Graphics::Surface *_background;
00181     Graphics::Surface *_frame;
00182 
00183     static const uint kBlurIterations = 30;
00184     uint8 _blurTableX[kBlurIterations];
00185     uint8 _blurTableY[kBlurIterations];
00186 };
00187 
00188 } // End of namespace Myst3
00189 
00190 #endif // MOVIE_H_


Generated on Sat May 30 2020 05:00:49 for ResidualVM by doxygen 1.7.1
curved edge   curved edge