From e16ae1a2e72f4cc7265214db489c73cebc1d8a35 Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Sat, 13 Jun 2015 20:35:00 +0200 Subject: SHERLOCK: 3DO: support for talk movies --- engines/sherlock/scalpel/3do/movie_decoder.cpp | 1 - engines/sherlock/scalpel/scalpel_talk.cpp | 29 ++++++++++++++++++++++ engines/sherlock/scalpel/scalpel_talk.h | 6 +++++ .../sherlock/scalpel/scalpel_user_interface.cpp | 4 +++ engines/sherlock/screen.cpp | 4 +++ engines/sherlock/screen.h | 5 ++++ engines/sherlock/talk.cpp | 10 ++++++++ engines/sherlock/talk.h | 6 +++++ 8 files changed, 64 insertions(+), 1 deletion(-) diff --git a/engines/sherlock/scalpel/3do/movie_decoder.cpp b/engines/sherlock/scalpel/3do/movie_decoder.cpp index d1471c59dd..29f2510598 100644 --- a/engines/sherlock/scalpel/3do/movie_decoder.cpp +++ b/engines/sherlock/scalpel/3do/movie_decoder.cpp @@ -501,5 +501,4 @@ bool Scalpel3DOMoviePlay(const char *filename, Common::Point pos) { return !skipVideo; } - } // End of namespace Sherlock diff --git a/engines/sherlock/scalpel/scalpel_talk.cpp b/engines/sherlock/scalpel/scalpel_talk.cpp index ea5a0fb713..3a5ac677eb 100644 --- a/engines/sherlock/scalpel/scalpel_talk.cpp +++ b/engines/sherlock/scalpel/scalpel_talk.cpp @@ -27,6 +27,7 @@ #include "sherlock/scalpel/scalpel_user_interface.h" #include "sherlock/sherlock.h" #include "sherlock/screen.h" +#include "sherlock/scalpel/3do/movie_decoder.h" namespace Sherlock { @@ -523,6 +524,34 @@ void ScalpelTalk::talkWait(const byte *&str) { } } +void ScalpelTalk::talk3DOMovieTrigger(int selector, int subIndex) { + if (_vm->getPlatform() != Common::kPlatform3DO) { + // No 3DO? No movie! + return; + } + + // Find out a few things that we need + int roomNr = _vm->_scene->_currentScene; + + // Make a quick update, so that current text is shown on screen + _vm->_screen->update(); + + // Figure out that movie filename + Common::String movieFilename; + + movieFilename = _scriptName; + movieFilename.deleteChar(1); // remove 2nd character of scriptname + + movieFilename.insertChar(selector + 'a', movieFilename.size()); + movieFilename.insertChar(subIndex + 'a', movieFilename.size()); + movieFilename = Common::String::format("movies/%02d/%s.stream", roomNr, movieFilename.c_str()); + + Scalpel3DOMoviePlay(movieFilename.c_str(), Common::Point(5, 5)); + + // Restore screen HACK + _vm->_screen->makeAllDirty(); +} + } // End of namespace Scalpel } // End of namespace Sherlock diff --git a/engines/sherlock/scalpel/scalpel_talk.h b/engines/sherlock/scalpel/scalpel_talk.h index 5794813457..3a94fbcf89 100644 --- a/engines/sherlock/scalpel/scalpel_talk.h +++ b/engines/sherlock/scalpel/scalpel_talk.h @@ -62,6 +62,12 @@ protected: * Pause when displaying a talk dialog on-screen */ virtual void talkWait(const byte *&str); + + /** + * Trigger to play a 3DO talk dialog movie + */ + virtual void talk3DOMovieTrigger(int selector, int subIndex); + public: ScalpelTalk(SherlockEngine *vm); virtual ~ScalpelTalk() {} diff --git a/engines/sherlock/scalpel/scalpel_user_interface.cpp b/engines/sherlock/scalpel/scalpel_user_interface.cpp index dc5ab01020..843a109cf0 100644 --- a/engines/sherlock/scalpel/scalpel_user_interface.cpp +++ b/engines/sherlock/scalpel/scalpel_user_interface.cpp @@ -1640,6 +1640,10 @@ void ScalpelUserInterface::doTalkControl() { sound._speechOn = false; } + // Trigger to play 3DO movie + int selector = _vm->_ui->_selector; + talk.talk3DOMovieTrigger(selector, 0); + talk.waitForMore(talk._statements[_selector]._statement.size()); if (talk._talkToAbort) return; diff --git a/engines/sherlock/screen.cpp b/engines/sherlock/screen.cpp index 91f2594f50..d21343bfc1 100644 --- a/engines/sherlock/screen.cpp +++ b/engines/sherlock/screen.cpp @@ -71,6 +71,10 @@ void Screen::update() { _dirtyRects.clear(); } +void Screen::makeAllDirty() { + addDirtyRect(Common::Rect(0, 0, this->w(), this->h())); +} + void Screen::getPalette(byte palette[PALETTE_SIZE]) { g_system->getPaletteManager()->grabPalette(palette, 0, PALETTE_COUNT); } diff --git a/engines/sherlock/screen.h b/engines/sherlock/screen.h index aa67e60b91..a4b1a837b8 100644 --- a/engines/sherlock/screen.h +++ b/engines/sherlock/screen.h @@ -102,6 +102,11 @@ public: */ void update(); + /** + * Makes the whole screen dirty, Hack for 3DO movie playing + */ + void makeAllDirty(); + /** * Return the currently active palette */ diff --git a/engines/sherlock/talk.cpp b/engines/sherlock/talk.cpp index bb8a059d34..1a27f8e9fc 100644 --- a/engines/sherlock/talk.cpp +++ b/engines/sherlock/talk.cpp @@ -1035,6 +1035,8 @@ void Talk::doScript(const Common::String &script) { } } + uint16 subIndex = 1; + do { Common::String tempString; _wait = 0; @@ -1075,6 +1077,14 @@ void Talk::doScript(const Common::String &script) { _openTalkWindow = false; } + if (_wait) { + // Trigger to play 3DO movie + int selector = _vm->_ui->_selector; + talk3DOMovieTrigger(selector, subIndex); + + subIndex++; + } + if (_wait) // Handling pausing talkWait(str); diff --git a/engines/sherlock/talk.h b/engines/sherlock/talk.h index 9c44f8ed83..aea2800a1f 100644 --- a/engines/sherlock/talk.h +++ b/engines/sherlock/talk.h @@ -263,6 +263,12 @@ protected: * Pause when displaying a talk dialog on-screen */ virtual void talkWait(const byte *&str); + + /** + * Trigger to play a 3DO talk dialog movie + */ + virtual void talk3DOMovieTrigger(int selector, int subIndex) {}; + public: TalkSequence _talkSequenceStack[TALK_SEQUENCE_STACK_SIZE]; bool _talkToAbort; -- cgit v1.2.3