From 6a32f07ee8b32a947472220ff47942a332de61fc Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 25 Oct 2018 02:53:57 +0300 Subject: SCI32: Add support for upscaling VMD videos This feature can be used for the Windows version of KQ7, as well as PQ:SWAT --- engines/sci/graphics/video32.cpp | 24 ++++++++++++++++++------ engines/sci/graphics/video32.h | 2 +- 2 files changed, 19 insertions(+), 7 deletions(-) (limited to 'engines/sci') diff --git a/engines/sci/graphics/video32.cpp b/engines/sci/graphics/video32.cpp index 8d68c8e3bb..8849e985c6 100644 --- a/engines/sci/graphics/video32.cpp +++ b/engines/sci/graphics/video32.cpp @@ -570,11 +570,26 @@ VMDPlayer::IOStatus VMDPlayer::open(const Common::String &fileName, const OpenFl return kIOError; } -void VMDPlayer::init(int16 x, const int16 y, const PlayFlags flags, const int16 boostPercent, const int16 boostStartColor, const int16 boostEndColor) { +void VMDPlayer::init(int16 x, int16 y, const PlayFlags flags, const int16 boostPercent, const int16 boostStartColor, const int16 boostEndColor) { + const int16 screenWidth = g_sci->_gfxFrameout->getScreenWidth(); + const int16 screenHeight = g_sci->_gfxFrameout->getScreenHeight(); + const bool upscaleVideos = ConfMan.getBool("enable_video_upscale"); + + _doublePixels = (flags & kPlayFlagDoublePixels) || upscaleVideos; + _stretchVertical = flags & kPlayFlagStretchVertical; + + const int16 width = _decoder->getWidth() << _doublePixels; + const int16 height = _decoder->getHeight() << (_doublePixels || _stretchVertical); + if (getSciVersion() < SCI_VERSION_3) { x &= ~1; } - _doublePixels = flags & kPlayFlagDoublePixels; + + if (upscaleVideos) { + x = (screenWidth - width) / 2; + y = (screenHeight - height) / 2; + } + _blackLines = ConfMan.getBool("enable_black_lined_video") && (flags & kPlayFlagBlackLines); // If ScummVM has been configured to disable black lines on video playback, // the boosts need to be ignored too or else the brightness of the video @@ -587,11 +602,8 @@ void VMDPlayer::init(int16 x, const int16 y, const PlayFlags flags, const int16 #ifdef SCI_VMD_BLACK_PALETTE _blackPalette = flags & kPlayFlagBlackPalette; #endif - _stretchVertical = flags & kPlayFlagStretchVertical; - setDrawRect(x, y, - (_decoder->getWidth() << _doublePixels), - (_decoder->getHeight() << (_doublePixels || _stretchVertical))); + setDrawRect(x, y, width, height); } VMDPlayer::IOStatus VMDPlayer::close() { diff --git a/engines/sci/graphics/video32.h b/engines/sci/graphics/video32.h index ce5e4ba883..d418c58b86 100644 --- a/engines/sci/graphics/video32.h +++ b/engines/sci/graphics/video32.h @@ -319,7 +319,7 @@ public: * Initializes the VMD rendering parameters for the current VMD. This must * be called after `open`. */ - void init(const int16 x, const int16 y, const PlayFlags flags, const int16 boostPercent, const int16 boostStartColor, const int16 boostEndColor); + void init(int16 x, int16 y, const PlayFlags flags, const int16 boostPercent, const int16 boostStartColor, const int16 boostEndColor); /** * Stops playback and closes the currently open VMD stream. -- cgit v1.2.3