aboutsummaryrefslogtreecommitdiff
path: root/engines/mads
diff options
context:
space:
mode:
authorneuromancer2019-12-20 22:51:20 -0300
committerFilippos Karapetis2019-12-21 16:45:35 +0200
commite7ff394f3302f493e50f2fa5a2a906fd1915a275 (patch)
tree8126c0af14253906c8ab8a4f6bfbce9802402336 /engines/mads
parent4e7e0344de05845b835b7344a3a8585adaffdef8 (diff)
downloadscummvm-rg350-e7ff394f3302f493e50f2fa5a2a906fd1915a275.tar.gz
scummvm-rg350-e7ff394f3302f493e50f2fa5a2a906fd1915a275.tar.bz2
scummvm-rg350-e7ff394f3302f493e50f2fa5a2a906fd1915a275.zip
MADS: Enable the optional use of TTS to read descriptions as a narrator in Rex Nebular
Diffstat (limited to 'engines/mads')
-rw-r--r--engines/mads/detection.cpp16
-rw-r--r--engines/mads/detection_tables.h4
-rw-r--r--engines/mads/dialogs.cpp20
3 files changed, 39 insertions, 1 deletions
diff --git a/engines/mads/detection.cpp b/engines/mads/detection.cpp
index 65725a8726..3f0f8e5733 100644
--- a/engines/mads/detection.cpp
+++ b/engines/mads/detection.cpp
@@ -81,6 +81,10 @@ static const PlainGameDescriptor MADSGames[] = {
#define GAMEOPTION_NAUGHTY_MODE GUIO_GAMEOPTIONS4
//#define GAMEOPTION_GRAPHICS_DITHERING GUIO_GAMEOPTIONS5
+#ifdef USE_TTS
+#define GAMEOPTION_TTS_NARRATOR GUIO_GAMEOPTIONS5
+#endif
+
#include "mads/detection_tables.h"
static const ADExtraGuiOptionsMap optionsList[] = {
@@ -134,6 +138,18 @@ 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/mads/detection_tables.h b/engines/mads/detection_tables.h
index e541fc6f80..ad2a4ca228 100644
--- a/engines/mads/detection_tables.h
+++ b/engines/mads/detection_tables.h
@@ -56,7 +56,11 @@ static const MADSGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformDOS,
ADGF_NO_FLAGS,
+ #ifdef USE_TTS
+ GUIO6(GUIO_NOSPEECH, GAMEOPTION_EASY_MOUSE, GAMEOPTION_ANIMATED_INVENTORY, GAMEOPTION_ANIMATED_INTERFACE, GAMEOPTION_NAUGHTY_MODE, GAMEOPTION_TTS_NARRATOR)
+ #else
GUIO5(GUIO_NOSPEECH, GAMEOPTION_EASY_MOUSE, GAMEOPTION_ANIMATED_INVENTORY, GAMEOPTION_ANIMATED_INTERFACE, GAMEOPTION_NAUGHTY_MODE)
+ #endif
},
GType_RexNebular,
0
diff --git a/engines/mads/dialogs.cpp b/engines/mads/dialogs.cpp
index 33739388f7..e1ae37451d 100644
--- a/engines/mads/dialogs.cpp
+++ b/engines/mads/dialogs.cpp
@@ -26,6 +26,11 @@
#include "mads/screen.h"
#include "mads/msurface.h"
#include "mads/nebular/dialogs_nebular.h"
+#include "common/config-manager.h"
+
+#ifdef USE_TTS
+#include "common/text-to-speech.h"
+#endif
namespace MADS {
@@ -338,6 +343,9 @@ void TextDialog::draw() {
// Draw the text lines
int lineYp = _position.y + 5;
+ #ifdef USE_TTS
+ Common::String text;
+ #endif
for (int lineNum = 0; lineNum <= _numLines; ++lineNum) {
if (_lineXp[lineNum] == -1) {
// Draw a line across the entire dialog
@@ -353,7 +361,9 @@ void TextDialog::draw() {
if (_portrait != nullptr)
xp += _portrait->w + 5;
-
+ #ifdef USE_TTS
+ text += _lines[lineNum];
+ #endif
_font->writeString(_vm->_screen, _lines[lineNum],
Common::Point(xp, yp), 1);
@@ -367,6 +377,14 @@ void TextDialog::draw() {
lineYp += _font->getHeight() + 1;
}
+
+ #ifdef USE_TTS
+ if (ConfMan.getBool("tts_narrator")) {
+ Common::TextToSpeechManager *_ttsMan = g_system->getTextToSpeechManager();
+ _ttsMan->stop();
+ _ttsMan->say(text.c_str());
+ }
+ #endif
}
void TextDialog::calculateBounds() {