From 766d46153a285794d573d84d237aac3821431a01 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Mon, 2 Jan 2017 23:30:35 -0600 Subject: SCI32: Implement known-used portions of kPlayDuck --- engines/sci/graphics/video32.h | 105 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 103 insertions(+), 2 deletions(-) (limited to 'engines/sci/graphics/video32.h') diff --git a/engines/sci/graphics/video32.h b/engines/sci/graphics/video32.h index 5ed8fd954a..fae5cafbbe 100644 --- a/engines/sci/graphics/video32.h +++ b/engines/sci/graphics/video32.h @@ -28,10 +28,11 @@ #include "common/str.h" // for String #include "sci/engine/vm_types.h" // for reg_t #include "sci/video/robot_decoder.h" // for RobotDecoder +#include "sci/sound/audio32.h" // for Audio32::kMaxVolume +#include "video/avi_decoder.h" // for AVIDecoder::setVolume namespace Video { class AdvancedVMDDecoder; -class AVIDecoder; } namespace Sci { class EventManager; @@ -531,6 +532,103 @@ private: bool _showCursor; }; +#pragma mark - +#pragma mark DuckPlayer + +class DuckPlayer { +public: + enum DuckStatus { + kDuckClosed = 0, + kDuckOpen = 1, + kDuckPlaying = 2, + kDuckPaused = 3 + }; + + DuckPlayer(SegManager *segMan, EventManager *eventMan); + + ~DuckPlayer(); + + /** + * Opens a stream to a Duck resource. + */ + void open(const GuiResourceId resourceId, const int displayMode, const int16 x, const int16 y); + + /** + * Stops playback and closes the currently open Duck stream. + */ + void close(); + + /** + * Begins playback of the current Duck video. + */ + void play(const int lastFrameNo); + + /** + * Sets a flag indicating that an opaque plane should be added + * to the graphics manager underneath the video surface during + * playback. + */ + void setDoFrameOut(const bool value) { _doFrameOut = value; } + + /** + * Sets the volume of the decoder. + */ + void setVolume(const uint8 value) { + _volume = (uint)value * Audio::Mixer::kMaxChannelVolume / Audio32::kMaxVolume; + _decoder->setVolume(_volume); + } + +private: + SegManager *_segMan; + EventManager *_eventMan; + Video::AVIDecoder *_decoder; + + /** + * An empty plane drawn behind the video when the doFrameOut + * flag is true. + */ + Plane *_plane; + + /** + * The player status. + */ + DuckStatus _status; + + /** + * The screen rect where the video should be drawn. + */ + Common::Rect _drawRect; + + /** + * The playback volume for the player. + */ + uint8 _volume; + + /** + * If true, frameOut will be called during Duck video playback to update + * other parts of the screen. + */ + bool _doFrameOut; + + /** + * If true, the video will be pixel doubled during playback. + */ + bool _pixelDouble; + + /** + * The buffer used to perform scaling of the video. + */ + byte *_scaleBuffer; + + /** + * Renders the current frame to the system video buffer. + */ + void renderFrame() const; +}; + +#pragma mark - +#pragma mark Video32 + /** * Video32 provides facilities for playing back * video in SCI engine. @@ -541,18 +639,21 @@ public: _SEQPlayer(segMan), _AVIPlayer(segMan, eventMan), _VMDPlayer(segMan, eventMan), - _robotPlayer(segMan) {} + _robotPlayer(segMan), + _duckPlayer(segMan, eventMan) {} SEQPlayer &getSEQPlayer() { return _SEQPlayer; } AVIPlayer &getAVIPlayer() { return _AVIPlayer; } VMDPlayer &getVMDPlayer() { return _VMDPlayer; } RobotDecoder &getRobotPlayer() { return _robotPlayer; } + DuckPlayer &getDuckPlayer() { return _duckPlayer; } private: SEQPlayer _SEQPlayer; AVIPlayer _AVIPlayer; VMDPlayer _VMDPlayer; RobotDecoder _robotPlayer; + DuckPlayer _duckPlayer; }; } // End of namespace Sci -- cgit v1.2.3