diff options
author | neuromancer | 2019-12-20 18:50:44 -0300 |
---|---|---|
committer | Filippos Karapetis | 2019-12-20 23:50:44 +0200 |
commit | d0571e6ab5e235e60884ebeffa0da7a3181d2ba6 (patch) | |
tree | 6ca739925cf1c40f3102b29651eb26cd76743c9f /engines/lure | |
parent | 986ceec96cbbd4b794033634d78d9b858d4ba123 (diff) | |
download | scummvm-rg350-d0571e6ab5e235e60884ebeffa0da7a3181d2ba6.tar.gz scummvm-rg350-d0571e6ab5e235e60884ebeffa0da7a3181d2ba6.tar.bz2 scummvm-rg350-d0571e6ab5e235e60884ebeffa0da7a3181d2ba6.zip |
LURE: Enable the optional use of TTS to read descriptions as a narrator
Diffstat (limited to 'engines/lure')
-rw-r--r-- | engines/lure/detection.cpp | 39 | ||||
-rw-r--r-- | engines/lure/surface.cpp | 20 |
2 files changed, 55 insertions, 4 deletions
diff --git a/engines/lure/detection.cpp b/engines/lure/detection.cpp index 0a87303974..abc766e263 100644 --- a/engines/lure/detection.cpp +++ b/engines/lure/detection.cpp @@ -25,7 +25,8 @@ #include "engines/advancedDetector.h" #include "engines/engine.h" #include "common/savefile.h" - +#include "common/system.h" +#include "common/translation.h" #include "lure/lure.h" namespace Lure { @@ -62,6 +63,23 @@ static const PlainGameDescriptor lureGames[] = { }; +#ifdef USE_TTS +#define GAMEOPTION_TTS_NARRATOR GUIO_GAMEOPTIONS1 + +static const ADExtraGuiOptionsMap optionsList[] = { + + GAMEOPTION_TTS_NARRATOR, + { + _s("TTS Narrator"), + _s("Use TTS to read the descriptions (if TTS is available)"), + "tts_narrator", + false + } + +}; + +#endif + namespace Lure { static const LureGameDescription gameDescriptions[] = { @@ -73,7 +91,11 @@ static const LureGameDescription gameDescriptions[] = { Common::EN_ANY, Common::kPlatformDOS, ADGF_NO_FLAGS, - GUIO0() + #ifdef USE_TTS + GUIO1(GAMEOPTION_TTS_NARRATOR) + #else + GUIO0() + #endif }, GF_FLOPPY, }, @@ -86,7 +108,12 @@ static const LureGameDescription gameDescriptions[] = { Common::EN_ANY, Common::kPlatformDOS, ADGF_NO_FLAGS, - GUIO0() + #ifdef USE_TTS + GUIO1(GAMEOPTION_TTS_NARRATOR) + #else + GUIO0() + #endif + }, GF_FLOPPY | GF_EGA, }, @@ -205,7 +232,11 @@ static const LureGameDescription gameDescriptions[] = { class LureMetaEngine : public AdvancedMetaEngine { public: - LureMetaEngine() : AdvancedMetaEngine(Lure::gameDescriptions, sizeof(Lure::LureGameDescription), lureGames) { + LureMetaEngine() : AdvancedMetaEngine(Lure::gameDescriptions, sizeof(Lure::LureGameDescription), lureGames + #ifdef USE_TTS + , optionsList + #endif + ) { _md5Bytes = 1024; // Use kADFlagUseExtraAsHint to distinguish between EGA and VGA versions diff --git a/engines/lure/surface.cpp b/engines/lure/surface.cpp index 55ba28de9a..9881256502 100644 --- a/engines/lure/surface.cpp +++ b/engines/lure/surface.cpp @@ -30,6 +30,11 @@ #include "lure/strings.h" #include "lure/surface.h" #include "common/endian.h" +#include "common/config-manager.h" + +#ifdef USE_TTS +#include "common/text-to-speech.h" +#endif namespace Lure { @@ -467,13 +472,28 @@ Surface *Surface::newDialog(uint16 width, uint8 numLines, const char **lines, bo Surface *s = new Surface(width, size.y); s->createDialog(); + #ifdef USE_TTS + Common::String text; + #endif uint16 yP = Surface::textY(); for (uint8 ctr = 0; ctr < numLines; ++ctr) { + #ifdef USE_TTS + text += lines[ctr]; + #endif s->writeString(Surface::textX(), yP, lines[ctr], true, color, varLength); yP += squashedLines ? FONT_HEIGHT - 1 : FONT_HEIGHT; } + + #ifdef USE_TTS + if (ConfMan.getBool("tts_narrator")) { + Common::TextToSpeechManager *_ttsMan = g_system->getTextToSpeechManager(); + _ttsMan->stop(); + _ttsMan->say(text.c_str()); + } + #endif + return s; } |