aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/console.cpp
diff options
context:
space:
mode:
authorColin Snover2017-10-04 13:23:44 -0500
committerColin Snover2017-12-01 18:48:35 -0600
commit57db3f7535458504f308ea76e87167cf7ee95371 (patch)
treec73da99294cebdd56e47bda374c626b94525eeee /engines/sci/console.cpp
parentf9f5692e0388e06af5c51d2937f07f28175652c2 (diff)
downloadscummvm-rg350-57db3f7535458504f308ea76e87167cf7ee95371.tar.gz
scummvm-rg350-57db3f7535458504f308ea76e87167cf7ee95371.tar.bz2
scummvm-rg350-57db3f7535458504f308ea76e87167cf7ee95371.zip
SCI: Partially clean up SCI16 video playback code
Diffstat (limited to 'engines/sci/console.cpp')
-rw-r--r--engines/sci/console.cpp52
1 files changed, 7 insertions, 45 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index 28ed12275f..42a87ce44e 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -265,60 +265,23 @@ void Console::preEnter() {
_engine->pauseEngine(true);
}
-extern void playVideo(Video::VideoDecoder *videoDecoder, VideoState videoState);
+extern void playVideo(Video::VideoDecoder &videoDecoder);
void Console::postEnter() {
if (!_videoFile.empty()) {
- Video::VideoDecoder *videoDecoder = 0;
-
-#ifdef ENABLE_SCI32
- bool duckMode = false;
-#endif
+ Common::ScopedPtr<Video::VideoDecoder> videoDecoder;
if (_videoFile.hasSuffix(".seq")) {
- videoDecoder = new SEQDecoder(_videoFrameDelay);
-#ifdef ENABLE_SCI32
- } else if (_videoFile.hasSuffix(".vmd")) {
- videoDecoder = new Video::AdvancedVMDDecoder();
- } else if (_videoFile.hasSuffix(".duk")) {
- duckMode = true;
- videoDecoder = new Video::AVIDecoder();
-#endif
+ videoDecoder.reset(new SEQDecoder(_videoFrameDelay));
} else if (_videoFile.hasSuffix(".avi")) {
- videoDecoder = new Video::AVIDecoder();
+ videoDecoder.reset(new Video::AVIDecoder());
} else {
warning("Unrecognized video type");
}
if (videoDecoder && videoDecoder->loadFile(_videoFile)) {
_engine->_gfxCursor->kernelHide();
-
-#ifdef ENABLE_SCI32
- // Duck videos are 16bpp, so we need to change pixel formats
- int oldWidth = g_system->getWidth();
- int oldHeight = g_system->getHeight();
- if (duckMode) {
- Common::List<Graphics::PixelFormat> formats;
- formats.push_back(videoDecoder->getPixelFormat());
- initGraphics(640, 480, formats);
-
- if (g_system->getScreenFormat().bytesPerPixel != videoDecoder->getPixelFormat().bytesPerPixel)
- error("Could not switch screen format for the duck video");
- }
-#endif
-
- VideoState emptyState;
- emptyState.reset();
- emptyState.fileName = _videoFile;
- emptyState.flags = kDoubled; // always allow the videos to be double sized
- playVideo(videoDecoder, emptyState);
-
-#ifdef ENABLE_SCI32
- // Switch back to 8bpp if we played a duck video
- if (duckMode)
- initGraphics(oldWidth, oldHeight);
-#endif
-
+ playVideo(*videoDecoder);
_engine->_gfxCursor->kernelShow();
} else
warning("Could not play video %s\n", _videoFile.c_str());
@@ -2045,7 +2008,7 @@ bool Console::cmdPicVisualize(int argc, const char **argv) {
bool Console::cmdPlayVideo(int argc, const char **argv) {
if (argc < 2) {
- debugPrintf("Plays a SEQ, AVI, VMD, RBT or DUK video.\n");
+ debugPrintf("Plays a SEQ or AVI video.\n");
debugPrintf("Usage: %s <video file name> <delay>\n", argv[0]);
debugPrintf("The video file name should include the extension\n");
debugPrintf("Delay is only used in SEQ videos and is measured in ticks (default: 10)\n");
@@ -2055,8 +2018,7 @@ bool Console::cmdPlayVideo(int argc, const char **argv) {
Common::String filename = argv[1];
filename.toLowercase();
- if (filename.hasSuffix(".seq") || filename.hasSuffix(".avi") || filename.hasSuffix(".vmd") ||
- filename.hasSuffix(".rbt") || filename.hasSuffix(".duk")) {
+ if (filename.hasSuffix(".seq") || filename.hasSuffix(".avi")) {
_videoFile = filename;
_videoFrameDelay = (argc == 2) ? 10 : atoi(argv[2]);
return cmdExit(0, 0);