From 19f90177b72f4b18311cc4cff488c6567434a5fe Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Sat, 2 Jul 2016 22:23:33 -0500 Subject: SCI32: Clean up Video32/VMDPlayer --- engines/sci/graphics/video32.h | 206 +++++++++++++++++++++++------------------ 1 file changed, 118 insertions(+), 88 deletions(-) (limited to 'engines/sci/graphics/video32.h') diff --git a/engines/sci/graphics/video32.h b/engines/sci/graphics/video32.h index d51316bfbd..cf863ba41d 100644 --- a/engines/sci/graphics/video32.h +++ b/engines/sci/graphics/video32.h @@ -29,6 +29,11 @@ class Plane; class ScreenItem; class SegManager; +#pragma mark VMDPlayer + +/** + * VMDPlayer is used to play VMD videos. + */ class VMDPlayer { public: enum OpenFlags { @@ -44,7 +49,6 @@ public: enum PlayFlags { kPlayFlagNone = 0, kPlayFlagDoublePixels = 1, - kPlayFlagNoFrameskip = 2, // NOTE: the current VMD decoder does not allow this kPlayFlagBlackLines = 4, kPlayFlagBoost = 0x10, kPlayFlagLeaveScreenBlack = 0x20, @@ -67,6 +71,14 @@ public: VMDPlayer(SegManager *segMan, EventManager *eventMan); ~VMDPlayer(); +private: + SegManager *_segMan; + EventManager *_eventMan; + Video::AdvancedVMDDecoder *_decoder; + +#pragma mark - +#pragma mark VMDPlayer - Playback +public: /** * Opens a stream to a VMD resource. */ @@ -83,33 +95,35 @@ public: */ IOStatus close(); - /** - * Restricts use of the system palette by VMD playback to - * the given range of palette indexes. - */ - void restrictPalette(const uint8 startColor, const uint8 endColor); - // NOTE: Was WaitForEvent in SSCI EventFlags kernelPlayUntilEvent(const EventFlags flags, const int16 lastFrameNo, const int16 yieldInterval); +private: /** - * Sets the area of the screen that should be blacked out - * during VMD playback. + * Whether or not a VMD stream has been opened with + * `open`. */ - void setBlackoutArea(const Common::Rect &rect) { _blackoutRect = rect; } + bool _isOpen; /** - * Sets whether or not the mouse cursor should be drawn. - * This does not have any effect during playback, but can - * be used to prevent the mouse cursor from being shown - * after the video has finished. + * Whether or not a VMD player has been initialised + * with `init`. */ - void setShowCursor(const bool shouldShow) { _showCursor = shouldShow; } + bool _isInitialized; -private: - SegManager *_segMan; - EventManager *_eventMan; - Video::AdvancedVMDDecoder *_decoder; + /** + * For VMDs played with the `kEventFlagYieldToVM` flag, + * the number of frames that should be rendered until + * yielding back to the SCI VM. + */ + int32 _yieldInterval; + + /** + * For VMDs played with the `kEventFlagYieldToVM` flag, + * the last frame when control of the main thread was + * yielded back to the SCI VM. + */ + int _lastYieldedFrameNo; /** * Plays the VMD until an event occurs (e.g. user @@ -117,41 +131,38 @@ private: */ EventFlags playUntilEvent(const EventFlags flags); +#pragma mark - +#pragma mark VMDPlayer - Rendering +private: /** - * Renders a frame of video to the output bitmap. + * The location of the VMD plane, in game script + * coordinates. */ - void renderFrame() const; + int16 _x, _y; /** - * Fills the given palette with RGB values from - * the VMD palette, applying brightness boost if - * it is enabled. + * The plane where the VMD will be drawn. */ - void fillPalette(Palette &palette) const; + Plane *_plane; /** - * Whether or not a VMD stream has been opened with - * `open`. + * The screen item representing the VMD surface. */ - bool _isOpen; + ScreenItem *_screenItem; - /** - * Whether or not a VMD player has been initialised - * with `init`. - */ - bool _isInitialized; + // TODO: planeIsOwned and priority are used in SCI3+ only /** - * Whether or not the playback area of the VMD - * should be left black at the end of playback. + * If true, the plane for this VMD was set + * externally and is not owned by this VMDPlayer. */ - bool _leaveScreenBlack; + bool _planeIsOwned; /** - * Whether or not the area of the VMD should be left - * displaying the final frame of the video. + * The screen priority of the video. + * @see ScreenItem::_priority */ - bool _leaveLastFrame; + int _priority; /** * Whether or not the video should be pixel doubled. @@ -171,24 +182,60 @@ private: bool _blackLines; /** - * The amount of brightness boost for the video. - * Values above 100 increase brightness; values below - * 100 reduce it. + * Whether or not the playback area of the VMD + * should be left black at the end of playback. */ - int16 _boostPercent; + bool _leaveScreenBlack; /** - * The first color in the palette that should be - * brightness boosted. + * Whether or not the area of the VMD should be left + * displaying the final frame of the video. */ - uint8 _boostStartColor; + bool _leaveLastFrame; /** - * The last color in the palette that should be - * brightness boosted. + * Renders a frame of video to the output bitmap. */ - uint8 _boostEndColor; + void renderFrame() const; + + /** + * Fills the given palette with RGB values from + * the VMD palette, applying brightness boost if + * it is enabled. + */ + void fillPalette(Palette &palette) const; + +#pragma mark - +#pragma mark VMDPlayer - Blackout +public: + /** + * Sets the area of the screen that should be blacked out + * during VMD playback. + */ + void setBlackoutArea(const Common::Rect &rect) { _blackoutRect = rect; } + +private: + /** + * The dimensions of the blackout plane. + */ + Common::Rect _blackoutRect; + + /** + * An optional plane that will be used to black out + * areas of the screen outside of the VMD surface. + */ + Plane *_blackoutPlane; + +#pragma mark - +#pragma mark VMDPlayer - Palette +public: + /** + * Restricts use of the system palette by VMD playback to + * the given range of palette indexes. + */ + void restrictPalette(const uint8 startColor, const uint8 endColor); +private: /** * The first color in the system palette that the VMD * can write to. @@ -209,62 +256,45 @@ private: */ bool _blackPalette; - // TODO: planeSet and priority are used in SCI3+ only - bool _planeSet; - - /** - * The screen priority of the video. - * @see ScreenItem::_priority - */ - int _priority; - +#pragma mark - +#pragma mark VMDPlayer - Brightness boost +private: /** - * The plane where the VMD will be drawn. + * The amount of brightness boost for the video. + * Values above 100 increase brightness; values below + * 100 reduce it. */ - Plane *_plane; + int16 _boostPercent; /** - * The screen item representing the VMD surface. + * The first color in the palette that should be + * brightness boosted. */ - ScreenItem *_screenItem; + uint8 _boostStartColor; /** - * An optional plane that will be used to black out - * areas of the screen outside the area of the VMD - * surface. + * The last color in the palette that should be + * brightness boosted. */ - Plane *_blackoutPlane; + uint8 _boostEndColor; +#pragma mark - +#pragma mark VMDPlayer - Mouse cursor +public: /** - * The dimensions of the blackout plane. + * Sets whether or not the mouse cursor should be drawn. + * This does not have any effect during playback, but can + * be used to prevent the mouse cursor from being shown + * again after the video has finished. */ - Common::Rect _blackoutRect; + void setShowCursor(const bool shouldShow) { _showCursor = shouldShow; } +private: /** * Whether or not the mouse cursor should be shown * during playback. */ bool _showCursor; - - /** - * The location of the VMD plane, in game script - * coordinates. - */ - int16 _x, _y; - - /** - * For VMDs played with the `kEventFlagYieldToVM` flag, - * the number of frames that should be drawn until - * yielding back to the SCI VM. - */ - int32 _yieldInterval; - - /** - * For VMDs played with the `kEventFlagYieldToVM` flag, - * the last frame when control of the main thread was - * yielded back to the SCI VM. - */ - int _lastYieldedFrameNo; }; class Video32 { -- cgit v1.2.3