aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/graphics/video32.h
diff options
context:
space:
mode:
authorColin Snover2017-01-02 23:30:35 -0600
committerColin Snover2017-03-30 19:46:27 -0500
commit766d46153a285794d573d84d237aac3821431a01 (patch)
tree5d85232e856175fc20c4990ad48bf06a9db3d490 /engines/sci/graphics/video32.h
parent65fe7bcfd8431888d9fdf345759bad1a78c455b7 (diff)
downloadscummvm-rg350-766d46153a285794d573d84d237aac3821431a01.tar.gz
scummvm-rg350-766d46153a285794d573d84d237aac3821431a01.tar.bz2
scummvm-rg350-766d46153a285794d573d84d237aac3821431a01.zip
SCI32: Implement known-used portions of kPlayDuck
Diffstat (limited to 'engines/sci/graphics/video32.h')
-rw-r--r--engines/sci/graphics/video32.h105
1 files changed, 103 insertions, 2 deletions
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