diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sherlock/debugger.cpp | 4 | ||||
-rw-r--r-- | engines/sherlock/scalpel/3do/movie_decoder.cpp | 43 | ||||
-rw-r--r-- | engines/sherlock/scalpel/3do/movie_decoder.h | 3 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel.cpp | 48 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel.h | 5 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel_talk.cpp | 11 |
6 files changed, 60 insertions, 54 deletions
diff --git a/engines/sherlock/debugger.cpp b/engines/sherlock/debugger.cpp index 50293db648..39f8da3806 100644 --- a/engines/sherlock/debugger.cpp +++ b/engines/sherlock/debugger.cpp @@ -23,7 +23,7 @@ #include "sherlock/debugger.h" #include "sherlock/sherlock.h" #include "sherlock/music.h" -#include "sherlock/scalpel/3do/movie_decoder.h" +#include "sherlock/scalpel/scalpel.h" #include "sherlock/scalpel/scalpel_debugger.h" #include "sherlock/tattoo/tattoo_debugger.h" #include "audio/mixer.h" @@ -54,7 +54,7 @@ Debugger::Debugger(SherlockEngine *vm) : GUI::Debugger(), _vm(vm) { void Debugger::postEnter() { if (!_3doPlayMovieFile.empty()) { - Scalpel3DOMoviePlay(_3doPlayMovieFile.c_str(), Common::Point(0, 0)); + static_cast<Scalpel::ScalpelEngine *>(_vm)->play3doMovie(_3doPlayMovieFile, Common::Point(0, 0)); _3doPlayMovieFile.clear(); } diff --git a/engines/sherlock/scalpel/3do/movie_decoder.cpp b/engines/sherlock/scalpel/3do/movie_decoder.cpp index 8e8f99bc19..da4d08ca47 100644 --- a/engines/sherlock/scalpel/3do/movie_decoder.cpp +++ b/engines/sherlock/scalpel/3do/movie_decoder.cpp @@ -464,47 +464,4 @@ Audio::AudioStream *Scalpel3DOMovieDecoder::StreamAudioTrack::getAudioStream() c return _audioStream; } -// Test-code - -// Code for showing a movie. Only meant for testing/debug purposes -bool Scalpel3DOMoviePlay(const char *filename, Common::Point pos) { - Scalpel3DOMovieDecoder *videoDecoder = new Scalpel3DOMovieDecoder(); - - if (!videoDecoder->loadFile(filename)) { - warning("Scalpel3DOMoviePlay: could not open '%s'", filename); - return false; - } - - bool skipVideo = false; - //byte bytesPerPixel = videoDecoder->getPixelFormat().bytesPerPixel; - uint16 width = videoDecoder->getWidth(); - uint16 height = videoDecoder->getHeight(); - //uint16 pitch = videoDecoder->getWidth() * bytesPerPixel; - - videoDecoder->start(); - - while (!g_engine->shouldQuit() && !videoDecoder->endOfVideo() && (!skipVideo)) { - if (videoDecoder->needsUpdate()) { - const Graphics::Surface *frame = videoDecoder->decodeNextFrame(); - - if (frame) { - g_system->copyRectToScreen(frame->getPixels(), frame->pitch, pos.x, pos.y, width, height); - g_system->updateScreen(); - } - } - - Common::Event event; - while (g_system->getEventManager()->pollEvent(event)) { - if ((event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE)) - skipVideo = true; - } - - g_system->delayMillis(10); - } - videoDecoder->close(); - delete videoDecoder; - - return !skipVideo; -} - } // End of namespace Sherlock diff --git a/engines/sherlock/scalpel/3do/movie_decoder.h b/engines/sherlock/scalpel/3do/movie_decoder.h index 9f1670fc6c..73b125443b 100644 --- a/engines/sherlock/scalpel/3do/movie_decoder.h +++ b/engines/sherlock/scalpel/3do/movie_decoder.h @@ -119,9 +119,6 @@ private: StreamAudioTrack *_audioTrack; }; -// Testing -extern bool Scalpel3DOMoviePlay(const char *filename, Common::Point pos); - } // End of namespace Sherlock #endif diff --git a/engines/sherlock/scalpel/scalpel.cpp b/engines/sherlock/scalpel/scalpel.cpp index 73ee33b9e1..e91c7746c9 100644 --- a/engines/sherlock/scalpel/scalpel.cpp +++ b/engines/sherlock/scalpel/scalpel.cpp @@ -32,7 +32,6 @@ #include "sherlock/sherlock.h" #include "sherlock/music.h" #include "sherlock/animation.h" -// for 3DO #include "sherlock/scalpel/3do/movie_decoder.h" namespace Sherlock { @@ -660,7 +659,7 @@ bool ScalpelEngine::show3DOSplash() { if (finished) { // EA logo movie - Scalpel3DOMoviePlay("EAlogo.stream", Common::Point(20, 0)); + play3doMovie("EAlogo.stream", Common::Point(20, 0)); } // Always clear screen @@ -1241,6 +1240,51 @@ void ScalpelEngine::showScummVMRestoreDialog() { } } +bool ScalpelEngine::play3doMovie(const Common::String &filename, const Common::Point &pos) { + Scalpel3DOMovieDecoder *videoDecoder = new Scalpel3DOMovieDecoder(); + + if (!videoDecoder->loadFile(filename)) { + warning("Scalpel3DOMoviePlay: could not open '%s'", filename.c_str()); + return false; + } + + bool skipVideo = false; + //byte bytesPerPixel = videoDecoder->getPixelFormat().bytesPerPixel; + uint16 width = videoDecoder->getWidth(); + uint16 height = videoDecoder->getHeight(); + //uint16 pitch = videoDecoder->getWidth() * bytesPerPixel; + + _events->clearEvents(); + videoDecoder->start(); + + while (!shouldQuit() && !videoDecoder->endOfVideo() && !skipVideo) { + if (videoDecoder->needsUpdate()) { + const Graphics::Surface *frame = videoDecoder->decodeNextFrame(); + + if (frame) { + g_system->copyRectToScreen(frame->getPixels(), frame->pitch, pos.x, pos.y, width, height); + g_system->updateScreen(); + } + } + + _events->pollEventsAndWait(); + _events->setButtonState(); + + if (_events->kbHit()) { + Common::KeyState keyState = _events->getKey(); + if (keyState.keycode == Common::KEYCODE_ESCAPE) + skipVideo = true; + } else if (_events->_pressed) { + skipVideo = true; + } + } + + videoDecoder->close(); + delete videoDecoder; + + return !skipVideo; +} + } // End of namespace Scalpel } // End of namespace Sherlock diff --git a/engines/sherlock/scalpel/scalpel.h b/engines/sherlock/scalpel/scalpel.h index 5c46b16973..1a208d7c0a 100644 --- a/engines/sherlock/scalpel/scalpel.h +++ b/engines/sherlock/scalpel/scalpel.h @@ -138,6 +138,11 @@ public: * Show the ScummVM restore savegame dialog */ void showScummVMRestoreDialog(); + + /** + * Play back a 3do movie + */ + bool play3doMovie(const Common::String &filename, const Common::Point &pos); }; } // End of namespace Scalpel diff --git a/engines/sherlock/scalpel/scalpel_talk.cpp b/engines/sherlock/scalpel/scalpel_talk.cpp index 2dda817445..0c0feed12f 100644 --- a/engines/sherlock/scalpel/scalpel_talk.cpp +++ b/engines/sherlock/scalpel/scalpel_talk.cpp @@ -554,6 +554,9 @@ void ScalpelTalk::switchSpeaker() { } void ScalpelTalk::talk3DOMovieTrigger(int subIndex) { + ScalpelEngine &vm = *(ScalpelEngine *)_vm; + Screen &screen = *_vm->_screen; + // Find out a few things that we need int userSelector = _vm->_ui->_selector; int scriptSelector = _scriptSelect; @@ -569,13 +572,13 @@ void ScalpelTalk::talk3DOMovieTrigger(int subIndex) { selector = scriptSelector; subIndex--; // for scripts we adjust subIndex, b/c we won't get called from doTalkControl() } else { - warning("talk3DOMovieTrigger: unable to find selector"); - return; + warning("talk3DOMovieTrigger: unable to find selector"); + return; } } // Make a quick update, so that current text is shown on screen - _vm->_screen->update(); + screen.update(); // Figure out that movie filename Common::String movieFilename; @@ -597,7 +600,7 @@ void ScalpelTalk::talk3DOMovieTrigger(int subIndex) { warning("selector: %d", selector); warning("subindex: %d", subIndex); - Scalpel3DOMoviePlay(movieFilename.c_str(), Common::Point(5, 5)); + vm.play3doMovie(movieFilename, Common::Point(5, 5)); // Restore screen HACK _vm->_screen->makeAllDirty(); |