From b451d3b51c7b9c1db0e4203791793020f330cb07 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Sun, 16 Jan 2011 16:29:19 +0000 Subject: [PATCH] GOB: Add the property switchColorMode To allow the videoplayer (and ultimatively the demoplayer) to switch color modes if necessary. svn-id: r55262 --- engines/gob/demos/demoplayer.cpp | 2 ++ engines/gob/videoplayer.cpp | 11 ++++++++++- engines/gob/videoplayer.h | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/engines/gob/demos/demoplayer.cpp b/engines/gob/demos/demoplayer.cpp index 9013f600a5a..715e78adbc3 100644 --- a/engines/gob/demos/demoplayer.cpp +++ b/engines/gob/demos/demoplayer.cpp @@ -157,6 +157,8 @@ void DemoPlayer::playVideo(const char *fileName) { props.x = _rebase0 ? 0 : -1; props.y = _rebase0 ? 0 : -1; + props.switchColorMode = true; + int slot; if ((slot = _vm->_vidPlayer->openVideo(true, file, props)) >= 0) { if (_autoDouble) { diff --git a/engines/gob/videoplayer.cpp b/engines/gob/videoplayer.cpp index 7448c85ef16..1b1ed9eb2f1 100644 --- a/engines/gob/videoplayer.cpp +++ b/engines/gob/videoplayer.cpp @@ -37,7 +37,7 @@ namespace Gob { VideoPlayer::Properties::Properties() : type(kVideoTypeTry), sprite(Draw::kFrontSurface), - x(-1), y(-1), width(-1), height(-1), flags(kFlagFrontSurface), + x(-1), y(-1), width(-1), height(-1), flags(kFlagFrontSurface), switchColorMode(false), startFrame(-1), lastFrame(-1), endFrame(-1), forceSeek(false), breakKey(kShortKeyEscape), palCmd(8), palStart(0), palEnd(255), palFrame(-1), fade(false), waitEndFrame(true), canceled(false) { @@ -112,6 +112,15 @@ int VideoPlayer::openVideo(bool primary, const Common::String &file, Properties if (!(video->decoder = openVideo(file, properties))) return -1; + if (video->decoder->isPaletted() != !_vm->isTrueColor()) { + if (!properties.switchColorMode) + return -1; + + _vm->setTrueColor(!video->decoder->isPaletted()); + + video->decoder->colorModeChanged(); + } + // Set the filename video->fileName = file; diff --git a/engines/gob/videoplayer.h b/engines/gob/videoplayer.h index 45b3a7b82d5..bdd6b4f0c5d 100644 --- a/engines/gob/videoplayer.h +++ b/engines/gob/videoplayer.h @@ -74,6 +74,8 @@ public: uint32 flags; ///< Video flags. + bool switchColorMode; ///< Switch between paletted / true color modes? + int32 startFrame; ///< Frame to start playback from. int32 lastFrame; ///< Frame to stop playback at. int32 endFrame; ///< Last frame of this playback cycle.