diff options
author | neuromancer | 2019-12-21 11:49:13 -0300 |
---|---|---|
committer | Filippos Karapetis | 2019-12-21 16:49:13 +0200 |
commit | bd92f2d00aa8630d896b2a02e0adb23ce22dfe3e (patch) | |
tree | 080021b6de1b14715029834633e74a89fbef33ad | |
parent | e7ff394f3302f493e50f2fa5a2a906fd1915a275 (diff) | |
download | scummvm-rg350-bd92f2d00aa8630d896b2a02e0adb23ce22dfe3e.tar.gz scummvm-rg350-bd92f2d00aa8630d896b2a02e0adb23ce22dfe3e.tar.bz2 scummvm-rg350-bd92f2d00aa8630d896b2a02e0adb23ce22dfe3e.zip |
SHERLOCK: Enable the use of TTS to read descriptions as a "narrator" for The Case of Serrated Scalpel
-rw-r--r-- | engines/sherlock/detection.cpp | 17 | ||||
-rw-r--r-- | engines/sherlock/detection_tables.h | 11 | ||||
-rw-r--r-- | engines/sherlock/scalpel/scalpel_user_interface.cpp | 13 | ||||
-rw-r--r-- | engines/sherlock/talk.cpp | 14 |
4 files changed, 52 insertions, 3 deletions
diff --git a/engines/sherlock/detection.cpp b/engines/sherlock/detection.cpp index e886bfcbe2..b54b7064a4 100644 --- a/engines/sherlock/detection.cpp +++ b/engines/sherlock/detection.cpp @@ -62,7 +62,11 @@ static const PlainGameDescriptor sherlockGames[] = { #define GAMEOPTION_HELP_STYLE GUIO_GAMEOPTIONS3 #define GAMEOPTION_PORTRAITS_ON GUIO_GAMEOPTIONS4 #define GAMEOPTION_WINDOW_STYLE GUIO_GAMEOPTIONS5 -#define GAMEOPTION_TRANSPARENT_WINDOWS GUIO_GAMEOPTIONS6 +#define GAMEOPTION_TRANSPARENT_WINDOWS GUIO_GAMEOPTIONS6 + +#ifdef USE_TTS +#define GAMEOPTION_TTS_NARRATOR GUIO_GAMEOPTIONS7 +#endif static const ADExtraGuiOptionsMap optionsList[] = { { @@ -125,6 +129,17 @@ static const ADExtraGuiOptionsMap optionsList[] = { } }, +#ifdef USE_TTS + { + GAMEOPTION_TTS_NARRATOR, + { + _s("TTS Narrator"), + _s("Use TTS to read the descriptions (if TTS is available)"), + "tts_narrator", + false + } + }, +#endif AD_EXTRA_GUI_OPTIONS_TERMINATOR }; diff --git a/engines/sherlock/detection_tables.h b/engines/sherlock/detection_tables.h index 4867b8d8b6..440363534a 100644 --- a/engines/sherlock/detection_tables.h +++ b/engines/sherlock/detection_tables.h @@ -33,8 +33,15 @@ static const SherlockGameDescription gameDescriptions[] = { Common::EN_ANY, Common::kPlatformDOS, ADGF_NO_FLAGS, - GUIO6(GUIO_NOSPEECH, GAMEOPTION_ORIGINAL_SAVES, GAMEOPTION_FADE_STYLE, GAMEOPTION_HELP_STYLE, - GAMEOPTION_PORTRAITS_ON, GAMEOPTION_WINDOW_STYLE) +#ifdef USE_TTS + GUIO7(GUIO_NOSPEECH, GAMEOPTION_ORIGINAL_SAVES, GAMEOPTION_FADE_STYLE, + GAMEOPTION_HELP_STYLE, + GAMEOPTION_PORTRAITS_ON, GAMEOPTION_WINDOW_STYLE, GAMEOPTION_TTS_NARRATOR) +#else + GUIO6(GUIO_NOSPEECH, GAMEOPTION_ORIGINAL_SAVES, GAMEOPTION_FADE_STYLE, + GAMEOPTION_HELP_STYLE, + GAMEOPTION_PORTRAITS_ON, GAMEOPTION_WINDOW_STYLE) +#endif }, GType_SerratedScalpel, }, diff --git a/engines/sherlock/scalpel/scalpel_user_interface.cpp b/engines/sherlock/scalpel/scalpel_user_interface.cpp index b39ccbe0c5..20ba4f53fa 100644 --- a/engines/sherlock/scalpel/scalpel_user_interface.cpp +++ b/engines/sherlock/scalpel/scalpel_user_interface.cpp @@ -31,6 +31,11 @@ #include "sherlock/scalpel/settings.h" #include "sherlock/scalpel/scalpel.h" #include "sherlock/sherlock.h" +#include "common/config-manager.h" + +#ifdef USE_TTS +#include "common/text-to-speech.h" +#endif namespace Sherlock { @@ -2058,6 +2063,14 @@ void ScalpelUserInterface::printObjectDesc(const Common::String &str, bool first screen.slamRect(Common::Rect(0, CONTROLS_Y, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT)); } + + #ifdef USE_TTS + if (ConfMan.getBool("tts_narrator")) { + Common::TextToSpeechManager *_ttsMan = g_system->getTextToSpeechManager(); + _ttsMan->stop(); + _ttsMan->say(str.c_str()); + } + #endif } void ScalpelUserInterface::printObjectDesc() { diff --git a/engines/sherlock/talk.cpp b/engines/sherlock/talk.cpp index b4987f070a..ec20f807df 100644 --- a/engines/sherlock/talk.cpp +++ b/engines/sherlock/talk.cpp @@ -33,6 +33,11 @@ #include "sherlock/tattoo/tattoo_scene.h" #include "sherlock/tattoo/tattoo_talk.h" #include "sherlock/tattoo/tattoo_user_interface.h" +#include "common/config-manager.h" + +#ifdef USE_TTS +#include "common/text-to-speech.h" +#endif namespace Sherlock { @@ -351,6 +356,15 @@ void Talk::talkTo(const Common::String filename) { // Make a copy of the statement (in case the script frees the statement list), and then execute it Statement statement = _statements[select]; + + #ifdef USE_TTS + if (_talkTo == -1 && ConfMan.getBool("tts_narrator")) { + Common::TextToSpeechManager *_ttsMan = g_system->getTextToSpeechManager(); + _ttsMan->stop(); + _ttsMan->say(_statements[select]._reply.c_str()); + } + #endif + doScript(_statements[select]._reply); if (IS_ROSE_TATTOO) { |