[Scummvm-git-logs] scummvm master -> 92e1d2079c84f9ed3013331bcdb47369204a90d9
bluegr
bluegr at gmail.com
Sat Jul 17 06:27:45 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
92e1d2079c CGE: Add Text To Speech (TTS) for Soltys
Commit: 92e1d2079c84f9ed3013331bcdb47369204a90d9
https://github.com/scummvm/scummvm/commit/92e1d2079c84f9ed3013331bcdb47369204a90d9
Author: Twan (77198777+taylorzhancher at users.noreply.github.com)
Date: 2021-07-17T09:27:42+03:00
Commit Message:
CGE: Add Text To Speech (TTS) for Soltys
Add TTS to the opening story, game objects, game options and the ending message
Changed paths:
engines/cge/cge.cpp
engines/cge/cge.h
engines/cge/detection.cpp
engines/cge/talk.cpp
engines/cge/talk.h
diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp
index 899a24235e..4304050902 100644
--- a/engines/cge/cge.cpp
+++ b/engines/cge/cge.cpp
@@ -27,6 +27,7 @@
#include "common/error.h"
#include "common/file.h"
#include "common/fs.h"
+#include "common/text-to-speech.h"
#include "engines/advancedDetector.h"
#include "engines/util.h"
#include "gui/message.h"
@@ -222,6 +223,9 @@ Common::Error CGEEngine::run() {
g_system->delayMillis(10);
GUI::MessageDialog dialog(msg);
dialog.runModal();
+ Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
+ if (ttsMan != nullptr && ConfMan.getBool("tts_enabled"))
+ ttsMan->say(msg);
}
}
diff --git a/engines/cge/cge.h b/engines/cge/cge.h
index f70dbde27c..27d87822c8 100644
--- a/engines/cge/cge.h
+++ b/engines/cge/cge.h
@@ -34,6 +34,7 @@
#include "cge/console.h"
#include "cge/bitmap.h"
#include "cge/sound.h"
+#include "common/text-to-speech.h"
struct ADGameDescription;
diff --git a/engines/cge/detection.cpp b/engines/cge/detection.cpp
index d7ece80907..8e14b89a3e 100644
--- a/engines/cge/detection.cpp
+++ b/engines/cge/detection.cpp
@@ -39,6 +39,7 @@ static const DebugChannelDef debugFlagList[] = {
namespace CGE {
#define GAMEOPTION_COLOR_BLIND_DEFAULT_OFF GUIO_GAMEOPTIONS1
+#define GAMEOPTION_TTS GUIO_GAMEOPTIONS2
static const PlainGameDescriptor CGEGames[] = {
{ "soltys", "Soltys" },
@@ -50,51 +51,51 @@ static const ADGameDescription gameDescriptions[] = {
"soltys", "Freeware",
AD_ENTRY2s("vol.cat", "0c33e2c304821a2444d297fc5e2d67c6", 50176,
"vol.dat", "f9ae2e7f8f7cac91378cdafca43faf1e", 8437676),
- Common::PL_POL, Common::kPlatformDOS, ADGF_NO_FLAGS, GUIO1(GAMEOPTION_COLOR_BLIND_DEFAULT_OFF)
+ Common::PL_POL, Common::kPlatformDOS, ADGF_NO_FLAGS, GUIO2(GAMEOPTION_COLOR_BLIND_DEFAULT_OFF, GAMEOPTION_TTS)
},
{
"soltys", _s("Missing game code"),
AD_ENTRY2s("vol.cat", "1e077c8ff58109a187f07ac54b0c873a", 18788,
"vol.dat", "75d385a6074c58b69f7730481f256051", 1796710),
- Common::EN_ANY, Common::kPlatformDOS, ADGF_DEMO , GUIO1(GAMEOPTION_COLOR_BLIND_DEFAULT_OFF)
+ Common::EN_ANY, Common::kPlatformDOS, ADGF_DEMO , GUIO2(GAMEOPTION_COLOR_BLIND_DEFAULT_OFF, GAMEOPTION_TTS)
},
{
"soltys", _s("Missing game code"),
AD_ENTRY2s("vol.cat", "f17987487fab1ebddd781d8d02fedecc", 7168,
"vol.dat", "c5d9b15863cab61dc125551576dece04", 1075272),
- Common::PL_POL, Common::kPlatformDOS, ADGF_DEMO | ADGF_UNSUPPORTED , GUIO1(GAMEOPTION_COLOR_BLIND_DEFAULT_OFF)
+ Common::PL_POL, Common::kPlatformDOS, ADGF_DEMO | ADGF_UNSUPPORTED , GUIO2(GAMEOPTION_COLOR_BLIND_DEFAULT_OFF, GAMEOPTION_TTS)
},
{
"soltys", "Freeware v1.0",
AD_ENTRY2s("vol.cat", "f1675684c68ab90272f5776f8f2c3974", 50176,
"vol.dat", "4ffeff4abc99ac5999b55ccfc56ab1df", 8430868),
- Common::EN_ANY, Common::kPlatformDOS, ADGF_NO_FLAGS , GUIO1(GAMEOPTION_COLOR_BLIND_DEFAULT_OFF)
+ Common::EN_ANY, Common::kPlatformDOS, ADGF_NO_FLAGS , GUIO2(GAMEOPTION_COLOR_BLIND_DEFAULT_OFF, GAMEOPTION_TTS)
},
{
"soltys", "Freeware v1.0",
AD_ENTRY2s("vol.cat", "20fdce799adb618100ef9ee2362be875", 50176,
"vol.dat", "0e43331c846094d77f5dd201827e0a3b", 8439339),
- Common::PL_POL, Common::kPlatformDOS, ADGF_NO_FLAGS, GUIO1(GAMEOPTION_COLOR_BLIND_DEFAULT_OFF)
+ Common::PL_POL, Common::kPlatformDOS, ADGF_NO_FLAGS, GUIO2(GAMEOPTION_COLOR_BLIND_DEFAULT_OFF, GAMEOPTION_TTS)
},
{
"soltys", "Freeware v1.0",
AD_ENTRY2s("vol.cat", "fcae86b20eaa5cedec17b24fa5e85eb4", 50176,
"vol.dat", "ff10d54acc2c95696c57e05819b6906f", 8450151),
- Common::ES_ESP, Common::kPlatformDOS, ADGF_NO_FLAGS , GUIO1(GAMEOPTION_COLOR_BLIND_DEFAULT_OFF)
+ Common::ES_ESP, Common::kPlatformDOS, ADGF_NO_FLAGS , GUIO2(GAMEOPTION_COLOR_BLIND_DEFAULT_OFF, GAMEOPTION_TTS)
},
{
"soltys", "Russian fan-translation v1.0",
AD_ENTRY2s("vol.cat", "e9f6069c9c4d4156a8dbe004a9c1960d", 50176,
"vol.dat", "f9ae2e7f8f7cac91378cdafca43faf1e", 8749623),
- Common::RU_RUS, Common::kPlatformDOS, ADGF_NO_FLAGS , GUIO1(GAMEOPTION_COLOR_BLIND_DEFAULT_OFF)
+ Common::RU_RUS, Common::kPlatformDOS, ADGF_NO_FLAGS , GUIO2(GAMEOPTION_COLOR_BLIND_DEFAULT_OFF, GAMEOPTION_TTS)
},
{
"soltys", "Russian fan-translation v1.1",
AD_ENTRY2s("vol.cat", "72a93fa5b81f29aaf362f1dc8a5956e0", 50176,
"vol.dat", "b93e053cabf8dfdcece3de59a8e2f9e1", 8739481),
- Common::RU_RUS, Common::kPlatformDOS, ADGF_NO_FLAGS , GUIO1(GAMEOPTION_COLOR_BLIND_DEFAULT_OFF)
+ Common::RU_RUS, Common::kPlatformDOS, ADGF_NO_FLAGS , GUIO2(GAMEOPTION_COLOR_BLIND_DEFAULT_OFF, GAMEOPTION_TTS)
},
AD_TABLE_END_MARKER
@@ -111,6 +112,18 @@ static const ADExtraGuiOptionsMap optionsList[] = {
}
},
+#ifdef USE_TTS
+ {
+ GAMEOPTION_TTS,
+ {
+ _s("Enable Text to Speech"),
+ _s("Use TTS to read the descriptions (if TTS is available)"),
+ "tts_enabled",
+ false
+ }
+ },
+#endif
+
AD_EXTRA_GUI_OPTIONS_TERMINATOR
};
diff --git a/engines/cge/talk.cpp b/engines/cge/talk.cpp
index 6594004203..7b72dda547 100644
--- a/engines/cge/talk.cpp
+++ b/engines/cge/talk.cpp
@@ -30,6 +30,8 @@
#include "cge/game.h"
#include "cge/events.h"
#include "cge/cge_main.h"
+#include "common/config-manager.h"
+#include "common/text-to-speech.h"
namespace CGE {
@@ -75,6 +77,7 @@ uint16 Font::width(const char *text) {
Talk::Talk(CGEEngine *vm, const char *text, TextBoxStyle mode, bool wideSpace)
: Sprite(vm, NULL), _mode(mode), _wideSpace(wideSpace), _vm(vm) {
+ textToSpeech(text);
_ts = NULL;
_flags._syst = true;
update(text);
@@ -88,6 +91,15 @@ Talk::Talk(CGEEngine *vm)
_wideSpace = false;
}
+const char *lastText = "";
+
+void textToSpeech(const char *text) {
+ Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
+ if (lastText != text && ttsMan != nullptr && ConfMan.getBool("tts_enabled"))
+ ttsMan->say(text, Common::TextToSpeechManager::INTERRUPT);
+ lastText = text;
+}
+
void Talk::update(const char *text) {
const uint16 vmarg = (_mode) ? kTextVMargin : 0;
const uint16 hmarg = (_mode) ? kTextHMargin : 0;
@@ -203,6 +215,8 @@ InfoLine::InfoLine(CGEEngine *vm, uint16 w) : Talk(vm), _oldText(NULL), _vm(vm)
}
void InfoLine::update(const char *text) {
+ textToSpeech(text);
+
if (text == _oldText)
return;
diff --git a/engines/cge/talk.h b/engines/cge/talk.h
index e5c6e92613..494924c18b 100644
--- a/engines/cge/talk.h
+++ b/engines/cge/talk.h
@@ -46,6 +46,7 @@ namespace CGE {
#define kFontExt ".CFT"
enum TextBoxStyle { kTBPure, kTBRect, kTBRound };
+void textToSpeech(const char *text);
class Talk : public Sprite {
protected:
More information about the Scummvm-git-logs
mailing list