From cc31846eb51cb42575f351f30c305d365fd3f812 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 17 Oct 2009 10:42:00 +0000 Subject: Added a new console command, "play_video", which can play a SEQ or AVI file svn-id: r45178 --- engines/sci/console.cpp | 57 +++++++++++++++++++++++++++++++++++++++++++++++ engines/sci/console.h | 3 +++ engines/sci/seq_decoder.h | 4 ++-- 3 files changed, 62 insertions(+), 2 deletions(-) diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 6640aba5bd..fc49e2de22 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -44,6 +44,9 @@ #include "sci/gui/gui.h" #include "sci/gui/gui_cursor.h" +#include "graphics/video/avi_decoder.h" +#include "sci/seq_decoder.h" + #include "common/savefile.h" namespace Sci { @@ -111,6 +114,7 @@ Console::Console(SciEngine *vm) : GUI::Debugger() { DCmd_Register("draw_cel", WRAP_METHOD(Console, cmdDrawCel)); DCmd_Register("view_info", WRAP_METHOD(Console, cmdViewInfo)); DCmd_Register("undither", WRAP_METHOD(Console, cmdUndither)); + DCmd_Register("play_video", WRAP_METHOD(Console, cmdPlayVideo)); // GUI DCmd_Register("current_port", WRAP_METHOD(Console, cmdCurrentPort)); DCmd_Register("print_port", WRAP_METHOD(Console, cmdPrintPort)); @@ -207,6 +211,37 @@ void Console::postEnter() { if (_vm->_gamestate) _vm->_gamestate->_sound.sfx_suspend(false); _vm->_mixer->pauseAll(false); + + if (!_videoFile.empty()) { + _vm->_gamestate->_gui->hideCursor(); + + if (_videoFile.hasSuffix(".seq")) { + Graphics::SeqDecoder *seqDecoder = new Graphics::SeqDecoder(); + Graphics::VideoPlayer *player = new Graphics::VideoPlayer(seqDecoder); + if (seqDecoder->loadFile(_videoFile.c_str(), _videoFrameDelay)) + player->playVideo(); + else + DebugPrintf("Failed to open movie file %s\n", _videoFile.c_str()); + seqDecoder->closeFile(); + delete player; + delete seqDecoder; + } else if (_videoFile.hasSuffix(".avi")) { + Graphics::AviDecoder *aviDecoder = new Graphics::AviDecoder(g_system->getMixer()); + Graphics::VideoPlayer *player = new Graphics::VideoPlayer(aviDecoder); + if (aviDecoder->loadFile(_videoFile.c_str())) + player->playVideo(); + else + DebugPrintf("Failed to open movie file %s\n", _videoFile.c_str()); + aviDecoder->closeFile(); + delete player; + delete aviDecoder; + } + + _vm->_gamestate->_gui->showCursor(); + + _videoFile.clear(); + _videoFrameDelay = 0; + } } @@ -1076,6 +1111,28 @@ bool Console::cmdUndither(int argc, const char **argv) { return _vm->_gamestate->_gui->debugUndither(flag); } +bool Console::cmdPlayVideo(int argc, const char **argv) { + if (argc < 2) { + DebugPrintf("Plays a SEQ or AVI video.\n"); + DebugPrintf("Usage: %s