diff options
author | Matthew Hoops | 2010-11-11 05:18:40 +0000 |
---|---|---|
committer | Matthew Hoops | 2010-11-11 05:18:40 +0000 |
commit | da33617061d3d35becaaa741c8144377bf40f39b (patch) | |
tree | ac71ec3c3885c7f63b0beaf0d661ac4e50591a20 | |
parent | 5e8e77a81450c7399dbd62ec83805af990d925a4 (diff) | |
download | scummvm-rg350-da33617061d3d35becaaa741c8144377bf40f39b.tar.gz scummvm-rg350-da33617061d3d35becaaa741c8144377bf40f39b.tar.bz2 scummvm-rg350-da33617061d3d35becaaa741c8144377bf40f39b.zip |
SCI: Allow duck videos to be played from the console
svn-id: r54195
-rw-r--r-- | engines/sci/console.cpp | 44 |
1 files changed, 39 insertions, 5 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 539e205023..c5b8d2ae0d 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -58,6 +58,8 @@ #include "common/file.h" #include "common/savefile.h" +#include "engines/util.h" + namespace Sci { int g_debug_sleeptime_factor = 1; @@ -226,10 +228,12 @@ void Console::preEnter() { void Console::postEnter() { if (!_videoFile.empty()) { - _engine->_gfxCursor->kernelHide(); - Graphics::VideoDecoder *videoDecoder = 0; +#ifdef ENABLE_SCI32 + bool duckMode = false; +#endif + if (_videoFile.hasSuffix(".seq")) { SeqDecoder *seqDecoder = new SeqDecoder(); seqDecoder->setFrameDelay(_videoFrameDelay); @@ -238,11 +242,34 @@ void Console::postEnter() { } else if (_videoFile.hasSuffix(".vmd")) { videoDecoder = new Graphics::VMDDecoder(g_system->getMixer()); #endif + } else if (_videoFile.hasSuffix(".duk")) { +#ifdef ENABLE_SCI32 + duckMode = true; + videoDecoder = new Graphics::AviDecoder(g_system->getMixer()); +#else + warning("Duck videos require SCI32 support compiled in"); +#endif } else if (_videoFile.hasSuffix(".avi")) { videoDecoder = new Graphics::AviDecoder(g_system->getMixer()); } 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, true, formats); + + if (g_system->getScreenFormat().bytesPerPixel != videoDecoder->getPixelFormat().bytesPerPixel) + error("Could not switch screen format for the duck video"); + } +#endif + uint16 x = (g_system->getWidth() - videoDecoder->getWidth()) / 2; uint16 y = (g_system->getHeight() - videoDecoder->getHeight()) / 2; bool skipVideo = false; @@ -273,10 +300,17 @@ void Console::postEnter() { } delete videoDecoder; + +#ifdef ENABLE_SCI32 + // Switch back to 8bpp if we played a duck video + if (duckMode) + initGraphics(oldWidth, oldHeight, oldWidth > 320); +#endif + + _engine->_gfxCursor->kernelShow(); } else warning("Could not play video %s\n", _videoFile.c_str()); - _engine->_gfxCursor->kernelShow(); _videoFile.clear(); _videoFrameDelay = 0; } @@ -1547,7 +1581,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 or VMD video.\n"); + DebugPrintf("Plays a SEQ, AVI, DUK or VMD 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"); @@ -1557,7 +1591,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")) { + if (filename.hasSuffix(".seq") || filename.hasSuffix(".avi") || filename.hasSuffix(".vmd") || filename.hasSuffix(".duk")) { _videoFile = filename; _videoFrameDelay = (argc == 2) ? 10 : atoi(argv[2]); return Cmd_Exit(0, 0); |