aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Snover2016-08-04 18:42:39 -0500
committerColin Snover2016-08-11 20:50:33 -0500
commitcdab24aa07c18ad4a25a1659f7fca15cca5e358e (patch)
tree258ea2b62c6ef6291bd0a01f0ef68a22ab26fdaf
parent4ff0924e57a9bc9101ee0799a967fe3373dd2574 (diff)
downloadscummvm-rg350-cdab24aa07c18ad4a25a1659f7fca15cca5e358e.tar.gz
scummvm-rg350-cdab24aa07c18ad4a25a1659f7fca15cca5e358e.tar.bz2
scummvm-rg350-cdab24aa07c18ad4a25a1659f7fca15cca5e358e.zip
SCI32: Fix KQ7 1.51 basic video playback
There is still a problem where the background is white instead of black; this is caused by the palette of the video using entry 0 as white. This seems to have worked out OK in SSCI because the video was not actually played back inside the engine itself, so didn't interfere with the palette of the engine. ScummVM has no such separation, so the palette of the video interferes with the palette of the blank background pic, turning it white.
-rw-r--r--engines/sci/graphics/video32.cpp34
1 files changed, 31 insertions, 3 deletions
diff --git a/engines/sci/graphics/video32.cpp b/engines/sci/graphics/video32.cpp
index ac4522c1a0..e8baed2c76 100644
--- a/engines/sci/graphics/video32.cpp
+++ b/engines/sci/graphics/video32.cpp
@@ -161,9 +161,18 @@ AVIPlayer::IOStatus AVIPlayer::open(const Common::String &fileName) {
}
AVIPlayer::IOStatus AVIPlayer::init1x(const int16 x, const int16 y, int16 width, int16 height) {
+
+ _pixelDouble = false;
+
if (!width || !height) {
width = _decoder->getWidth();
height = _decoder->getHeight();
+ } else if (getSciVersion() == SCI_VERSION_2_1_EARLY && g_sci->getGameId() == GID_KQ7) {
+ // KQ7 1.51 provides an explicit width and height when it wants scaling,
+ // though the width and height it provides are not scaled
+ _pixelDouble = true;
+ width *= 2;
+ height *= 2;
}
// QFG4CD gives non-multiple-of-2 values for width and height,
@@ -177,7 +186,7 @@ AVIPlayer::IOStatus AVIPlayer::init1x(const int16 x, const int16 y, int16 width,
_drawRect.right = x + width;
_drawRect.bottom = y + height;
- // SCI2.1 uses init2x to draw a pixel-doubled AVI, but SCI2 has only the
+ // SCI2.1mid uses init2x to draw a pixel-doubled AVI, but SCI2 has only the
// one play routine which automatically pixel-doubles in hi-res mode
if (getSciVersion() == SCI_VERSION_2) {
// NOTE: This is somewhat of a hack; credits.avi from GK1 is not
@@ -201,7 +210,6 @@ AVIPlayer::IOStatus AVIPlayer::init1x(const int16 x, const int16 y, int16 width,
}
}
- _pixelDouble = false;
init();
return kIOSuccess;
@@ -223,7 +231,24 @@ void AVIPlayer::init() {
int16 xRes;
int16 yRes;
+ bool useScreenDimensions = false;
if (g_sci->_gfxFrameout->_isHiRes && _decoder->getWidth() > 320) {
+ useScreenDimensions = true;
+ }
+
+ // KQ7 1.51 gives video position in screen coordinates, not game
+ // coordinates, because in SSCI they are passed to Video for Windows, which
+ // renders as an overlay on the game video. Because we put the video into a
+ // ScreenItem instead of rendering directly to the hardware surface, the
+ // coordinates need to be converted to game script coordinates
+ if (g_sci->getGameId() == GID_KQ7 && getSciVersion() == SCI_VERSION_2_1_EARLY) {
+ useScreenDimensions = !_pixelDouble;
+ // This y-translation is arbitrary, based on what roughly centers the
+ // videos in the game window
+ _drawRect.translate(-_drawRect.left / 2, -_drawRect.top * 2 / 3);
+ }
+
+ if (useScreenDimensions) {
xRes = g_sci->_gfxFrameout->getCurrentBuffer().screenWidth;
yRes = g_sci->_gfxFrameout->getCurrentBuffer().screenHeight;
} else {
@@ -265,9 +290,12 @@ AVIPlayer::IOStatus AVIPlayer::play(const int16 from, const int16 to, const int1
if (!async) {
renderVideo();
+ } else if (getSciVersion() == SCI_VERSION_2_1_EARLY) {
+ playUntilEvent((EventFlags)(kEventFlagEnd | kEventFlagEscapeKey));
+ } else {
+ _status = kAVIPlaying;
}
- _status = kAVIPlaying;
return kIOSuccess;
}