From 97733b6f27c938b8bec72e0d840394dcca7339dc Mon Sep 17 00:00:00 2001 From: taylorzhancher Date: Wed, 4 Aug 2021 22:21:37 +0800 Subject: [PATCH 1/5] SUPERNOVA: Adding TTS to the game, with GUI options --- engines/supernova/detection.cpp | 17 ++++++++++++++--- engines/supernova/screen.cpp | 5 +++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/engines/supernova/detection.cpp b/engines/supernova/detection.cpp index 40c7a88acd73..394bcfeb218b 100644 --- a/engines/supernova/detection.cpp +++ b/engines/supernova/detection.cpp @@ -28,6 +28,7 @@ #include "supernova/supernova.h" #define GAMEOPTION_IMPROVED GUIO_GAMEOPTIONS1 +#define GAMEOPTION_TTS GUIO_GAMEOPTIONS2 static const DebugChannelDef debugFlagList[] = { {Supernova::kDebugGeneral, "general", "Supernova general debug channel"}, @@ -45,6 +46,16 @@ static const ADExtraGuiOptionsMap optionsList[] = { } }, + { + GAMEOPTION_TTS, + { + _s("Enable Text to Speech"), + _s("Use TTS to read the descriptions (if TTS is available)"), + "tts_enabled", + false + } + }, + AD_EXTRA_GUI_OPTIONS_TERMINATOR }; @@ -64,7 +75,7 @@ static const ADGameDescription gameDescriptions[] = { Common::DE_DEU, Common::kPlatformDOS, ADGF_NO_FLAGS, - GUIO2(GAMEOPTION_IMPROVED, GUIO_NOMIDI) + GUIO3(GAMEOPTION_TTS, GAMEOPTION_IMPROVED, GUIO_NOMIDI) }, { "msn1", @@ -73,7 +84,7 @@ static const ADGameDescription gameDescriptions[] = { Common::EN_ANY, Common::kPlatformDOS, ADGF_NO_FLAGS, - GUIO2(GAMEOPTION_IMPROVED, GUIO_NOMIDI) + GUIO3(GAMEOPTION_TTS, GAMEOPTION_IMPROVED, GUIO_NOMIDI) }, { "msn1", @@ -82,7 +93,7 @@ static const ADGameDescription gameDescriptions[] = { Common::IT_ITA, Common::kPlatformDOS, ADGF_NO_FLAGS, - GUIO2(GAMEOPTION_IMPROVED, GUIO_NOMIDI) + GUIO3(GAMEOPTION_TTS, GAMEOPTION_IMPROVED, GUIO_NOMIDI) }, // Mission Supernova 2 { diff --git a/engines/supernova/screen.cpp b/engines/supernova/screen.cpp index 83694addb2ab..5cc28a010bb3 100644 --- a/engines/supernova/screen.cpp +++ b/engines/supernova/screen.cpp @@ -27,6 +27,7 @@ #include "graphics/palette.h" #include "graphics/surface.h" #include "common/config-manager.h" +#include "common/text-to-speech.h" #include "supernova/imageid.h" #include "supernova/resman.h" @@ -286,12 +287,16 @@ void Screen::renderMessage(int stringId, MessagePosition position, text = Common::String::format(text.c_str(), var1.c_str()); } + renderMessage(text, position); } void Screen::renderMessage(const Common::String &text, MessagePosition position) { if (!text.empty()) renderMessage(text.c_str(), position); + Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager(); + if (ttsMan != nullptr && ConfMan.getBool("tts_enabled")) + ttsMan->say(text, Common::TextToSpeechManager::INTERRUPT_NO_REPEAT); } void Screen::renderText(const uint16 character) { From fc11f6acd8afdd1d600f80f9088b1e7e310148de Mon Sep 17 00:00:00 2001 From: taylorzhancher Date: Sun, 8 Aug 2021 17:56:29 +0800 Subject: [PATCH 2/5] SUPERNOVA: Add TTS to dialogue tree options --- engines/supernova/game-manager.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/engines/supernova/game-manager.cpp b/engines/supernova/game-manager.cpp index 2c8eba57726a..f317b641afc4 100644 --- a/engines/supernova/game-manager.cpp +++ b/engines/supernova/game-manager.cpp @@ -21,6 +21,8 @@ */ #include "common/system.h" +#include "common/config-manager.h" +#include "common/text-to-speech.h" #include "graphics/cursorman.h" #include "graphics/palette.h" #include "gui/message.h" @@ -553,15 +555,22 @@ bool GameManager::isNullObject(Object *obj) { } void GameManager::sentence(int number, bool brightness) { + Common::String string; + Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager(); if (number < 0) return; _vm->renderBox(0, 141 + _rowsStart[number] * 10, 320, _rows[number] * 10 - 1, brightness ? kColorWhite44 : kColorWhite25); if (_texts[_rowsStart[number]] == kStringDialogSeparator) _vm->renderText(kStringConversationEnd, 1, 142 + _rowsStart[number] * 10, brightness ? kColorRed : kColorDarkRed); else { - for (int r = _rowsStart[number]; r < _rowsStart[number] + _rows[number]; ++r) + for (int r = _rowsStart[number]; r < _rowsStart[number] + _rows[number]; ++r) { _vm->renderText(_texts[r], 1, 142 + r * 10, brightness ? kColorGreen : kColorDarkGreen); + if (!string.empty()) + string += " "; + string += _vm->getGameString(_texts[r]); + } } + ttsMan->say(string, Common::TextToSpeechManager::QUEUE_NO_REPEAT); } void GameManager::say(int textId) { From 1e2b0c691368323aca56d8892411266303f0048d Mon Sep 17 00:00:00 2001 From: taylorzhancher Date: Sat, 14 Aug 2021 17:41:37 +0800 Subject: [PATCH 3/5] SUPERNOVA: Add friendly encoding, detection for supernova2, TTS for highlights in action panel and dialogue tree --- engines/supernova/detection.cpp | 4 ++-- engines/supernova/game-manager.cpp | 19 ++++++++++++++----- engines/supernova/game-manager.h | 2 ++ engines/supernova/screen.cpp | 7 ++++--- engines/supernova/screen.h | 2 ++ engines/supernova/supernova.cpp | 10 ++++++++++ engines/supernova/supernova.h | 2 ++ 7 files changed, 36 insertions(+), 10 deletions(-) diff --git a/engines/supernova/detection.cpp b/engines/supernova/detection.cpp index 394bcfeb218b..9095f5211a7d 100644 --- a/engines/supernova/detection.cpp +++ b/engines/supernova/detection.cpp @@ -103,7 +103,7 @@ static const ADGameDescription gameDescriptions[] = { Common::DE_DEU, Common::kPlatformDOS, ADGF_NO_FLAGS, - GUIO2(GAMEOPTION_IMPROVED, GUIO_NOMIDI) + GUIO3(GAMEOPTION_TTS, GAMEOPTION_IMPROVED, GUIO_NOMIDI) }, { "msn2", @@ -112,7 +112,7 @@ static const ADGameDescription gameDescriptions[] = { Common::EN_ANY, Common::kPlatformDOS, ADGF_NO_FLAGS, - GUIO2(GAMEOPTION_IMPROVED, GUIO_NOMIDI) + GUIO3(GAMEOPTION_TTS, GAMEOPTION_IMPROVED, GUIO_NOMIDI) }, AD_TABLE_END_MARKER }; diff --git a/engines/supernova/game-manager.cpp b/engines/supernova/game-manager.cpp index f317b641afc4..00db4088c53e 100644 --- a/engines/supernova/game-manager.cpp +++ b/engines/supernova/game-manager.cpp @@ -362,6 +362,8 @@ void GameManager::processInput() { onInventoryArrowDown } mouseLocation; + _ttsMan = g_system->getTextToSpeechManager(); + if (_mouseField >= 0 && _mouseField < 256) mouseLocation = onObject; else if (_mouseField >= 256 && _mouseField < 512) @@ -527,13 +529,16 @@ void GameManager::processInput() { case onInventoryArrowDown: // Fallthrough _guiInventoryArrow[_mouseField - 768].setHighlight(true); + _ttsMan->say(_guiInventoryArrow[_mouseField - 768].getText(), Common::TextToSpeechManager::INTERRUPT_NO_REPEAT, Common::kDos850); break; case onInventory: _guiInventory[_mouseField - 512].setHighlight(true); _currentInputObject = _inventory.get(_mouseField - 512 + _inventoryScroll); + _ttsMan->say(_guiInventory[_mouseField - 512].getText(), Common::TextToSpeechManager::INTERRUPT_NO_REPEAT, Common::kDos850); break; case onCmdButton: _guiCommandButton[_mouseField - 256].setHighlight(true); + _ttsMan->say(_guiCommandButton[_mouseField - 256].getText(), Common::TextToSpeechManager::INTERRUPT_NO_REPEAT, Common::kDos850); break; case onObject: _currentInputObject = _currentRoom->getObject(_mouseField); @@ -555,14 +560,17 @@ bool GameManager::isNullObject(Object *obj) { } void GameManager::sentence(int number, bool brightness) { - Common::String string; - Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager(); if (number < 0) return; + + _ttsMan = g_system->getTextToSpeechManager(); + Common::String string; + _vm->renderBox(0, 141 + _rowsStart[number] * 10, 320, _rows[number] * 10 - 1, brightness ? kColorWhite44 : kColorWhite25); - if (_texts[_rowsStart[number]] == kStringDialogSeparator) + if (_texts[_rowsStart[number]] == kStringDialogSeparator) { _vm->renderText(kStringConversationEnd, 1, 142 + _rowsStart[number] * 10, brightness ? kColorRed : kColorDarkRed); - else { + string = _vm->getGameString(kStringConversationEnd); + } else { for (int r = _rowsStart[number]; r < _rowsStart[number] + _rows[number]; ++r) { _vm->renderText(_texts[r], 1, 142 + r * 10, brightness ? kColorGreen : kColorDarkGreen); if (!string.empty()) @@ -570,7 +578,8 @@ void GameManager::sentence(int number, bool brightness) { string += _vm->getGameString(_texts[r]); } } - ttsMan->say(string, Common::TextToSpeechManager::QUEUE_NO_REPEAT); + if (_ttsMan != nullptr && ConfMan.getBool("tts_enabled") && brightness) + _ttsMan->say(string, Common::TextToSpeechManager::QUEUE_NO_REPEAT, Common::kDos850); } void GameManager::say(int textId) { diff --git a/engines/supernova/game-manager.h b/engines/supernova/game-manager.h index 2ea8d7b9c010..2c085e26370a 100644 --- a/engines/supernova/game-manager.h +++ b/engines/supernova/game-manager.h @@ -101,6 +101,8 @@ class GuiElement : public Common::Rect { class GameManager { public: + Common::TextToSpeechManager *_ttsMan; + GameManager(SupernovaEngine *vm, Sound *sound); virtual ~GameManager(); diff --git a/engines/supernova/screen.cpp b/engines/supernova/screen.cpp index 5cc28a010bb3..e14d3f205348 100644 --- a/engines/supernova/screen.cpp +++ b/engines/supernova/screen.cpp @@ -294,9 +294,6 @@ void Screen::renderMessage(int stringId, MessagePosition position, void Screen::renderMessage(const Common::String &text, MessagePosition position) { if (!text.empty()) renderMessage(text.c_str(), position); - Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager(); - if (ttsMan != nullptr && ConfMan.getBool("tts_enabled")) - ttsMan->say(text, Common::TextToSpeechManager::INTERRUPT_NO_REPEAT); } void Screen::renderText(const uint16 character) { @@ -535,6 +532,10 @@ void Screen::renderMessage(const char *text, MessagePosition position, int posit int y = 0; byte textColor = 0; + _ttsMan = g_system->getTextToSpeechManager(); + if (_ttsMan != nullptr && ConfMan.getBool("tts_enabled")) + _ttsMan->say(text, Common::TextToSpeechManager::QUEUE_NO_REPEAT, Common::kDos850); + while (*p != '\0') { row[numRows] = p; ++numRows; diff --git a/engines/supernova/screen.h b/engines/supernova/screen.h index 5a94dc05d72b..4d094478b8d1 100644 --- a/engines/supernova/screen.h +++ b/engines/supernova/screen.h @@ -183,6 +183,8 @@ class Screen { void update(); void changeCursor(ResourceManager::CursorId); + Common::TextToSpeechManager *_ttsMan; + private: void renderImageSection(const MSNImage *image, int section, bool invert); diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp index d981efdd4b06..ab5263d48d42 100644 --- a/engines/supernova/supernova.cpp +++ b/engines/supernova/supernova.cpp @@ -33,7 +33,9 @@ #include "common/str.h" #include "common/system.h" #include "common/translation.h" +#include "common/text-to-speech.h" #include "engines/util.h" +#include "engines/advancedDetector.h" #include "graphics/cursorman.h" #include "graphics/surface.h" #include "graphics/screen.h" @@ -99,6 +101,8 @@ SupernovaEngine::SupernovaEngine(OSystem *syst) _MSPart = 0; _improved = ConfMan.getBool("improved"); + + _ttsMan = g_system->getTextToSpeechManager(); } SupernovaEngine::~SupernovaEngine() { @@ -110,6 +114,9 @@ SupernovaEngine::~SupernovaEngine() { } Common::Error SupernovaEngine::run() { + // if (_ttsMan != nullptr) + // _ttsMan->setLanguage(Common::getLanguageCode(getLanguage())); + init(); while (!shouldQuit()) { @@ -830,5 +837,8 @@ void SupernovaEngine::stopSound() { _sound->stop(); } +// Common::Language SupernovaEngine::getLanguage() const { +// return _gameDescription->language; +// } } diff --git a/engines/supernova/supernova.h b/engines/supernova/supernova.h index 0be51cc51199..432f47234adf 100644 --- a/engines/supernova/supernova.h +++ b/engines/supernova/supernova.h @@ -137,6 +137,8 @@ class SupernovaEngine : public Engine { void renderBox(const GuiElement &guiElement); void setColor63(byte value); void stopSound(); + // Common::Language getLanguage() const; + Common::TextToSpeechManager *_ttsMan; }; } From 8656f14d084c2b90c9b8acef2c492ec4d0c65777 Mon Sep 17 00:00:00 2001 From: taylorzhancher Date: Sun, 15 Aug 2021 23:29:29 +0800 Subject: [PATCH 4/5] SUPERNOVA: Localize ttsMan and tts for objects in the game --- engines/sci/tts.cpp | 37 ++++++++++++++++++++++++++++++ engines/sci/tts.h | 31 +++++++++++++++++++++++++ engines/supernova/game-manager.cpp | 18 ++++++++------- engines/supernova/game-manager.h | 1 - engines/supernova/screen.cpp | 6 ++--- engines/supernova/screen.h | 2 -- engines/supernova/supernova.cpp | 10 +++----- engines/supernova/supernova.h | 2 -- 8 files changed, 84 insertions(+), 23 deletions(-) create mode 100644 engines/sci/tts.cpp create mode 100644 engines/sci/tts.h diff --git a/engines/sci/tts.cpp b/engines/sci/tts.cpp new file mode 100644 index 000000000000..b11e71cde419 --- /dev/null +++ b/engines/sci/tts.cpp @@ -0,0 +1,37 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + + +#include "sci/sci.h" +#include "common/text-to-speech.h" +#include "common/config-manager.h" +#include "common/system.h" +#include "sci/graphics/controls16.h" + +namespace Sci { + +void TTS_SAY(const char *text) { + Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager(); + ttsMan->say(text); +} + +} \ No newline at end of file diff --git a/engines/sci/tts.h b/engines/sci/tts.h new file mode 100644 index 000000000000..8eae1ee0e00f --- /dev/null +++ b/engines/sci/tts.h @@ -0,0 +1,31 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "sci/tts.cpp" +#include "common/text-to-speech.h" +#include "common/config-manager.h" +#include "common/system.h" + + +namespace Sci { + void TTS_SAY(const char *text); +} \ No newline at end of file diff --git a/engines/supernova/game-manager.cpp b/engines/supernova/game-manager.cpp index 00db4088c53e..3670651ea879 100644 --- a/engines/supernova/game-manager.cpp +++ b/engines/supernova/game-manager.cpp @@ -362,7 +362,7 @@ void GameManager::processInput() { onInventoryArrowDown } mouseLocation; - _ttsMan = g_system->getTextToSpeechManager(); + Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager(); if (_mouseField >= 0 && _mouseField < 256) mouseLocation = onObject; @@ -529,19 +529,22 @@ void GameManager::processInput() { case onInventoryArrowDown: // Fallthrough _guiInventoryArrow[_mouseField - 768].setHighlight(true); - _ttsMan->say(_guiInventoryArrow[_mouseField - 768].getText(), Common::TextToSpeechManager::INTERRUPT_NO_REPEAT, Common::kDos850); break; case onInventory: _guiInventory[_mouseField - 512].setHighlight(true); _currentInputObject = _inventory.get(_mouseField - 512 + _inventoryScroll); - _ttsMan->say(_guiInventory[_mouseField - 512].getText(), Common::TextToSpeechManager::INTERRUPT_NO_REPEAT, Common::kDos850); + if (ttsMan != nullptr && ConfMan.getBool("tts_enabled")) + ttsMan->say(_vm->getGameString(_currentInputObject->_name), Common::kDos850); break; case onCmdButton: _guiCommandButton[_mouseField - 256].setHighlight(true); - _ttsMan->say(_guiCommandButton[_mouseField - 256].getText(), Common::TextToSpeechManager::INTERRUPT_NO_REPEAT, Common::kDos850); + if (ttsMan != nullptr && ConfMan.getBool("tts_enabled")) + ttsMan->say(_guiCommandButton[_mouseField - 256].getText(), Common::kDos850); break; case onObject: _currentInputObject = _currentRoom->getObject(_mouseField); + if (!isNullObject(_currentInputObject)) + ttsMan->say(_vm->getGameString(_currentInputObject->_name), Common::kDos850); break; case onNone: default: @@ -562,8 +565,7 @@ bool GameManager::isNullObject(Object *obj) { void GameManager::sentence(int number, bool brightness) { if (number < 0) return; - - _ttsMan = g_system->getTextToSpeechManager(); + Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager(); Common::String string; _vm->renderBox(0, 141 + _rowsStart[number] * 10, 320, _rows[number] * 10 - 1, brightness ? kColorWhite44 : kColorWhite25); @@ -578,8 +580,8 @@ void GameManager::sentence(int number, bool brightness) { string += _vm->getGameString(_texts[r]); } } - if (_ttsMan != nullptr && ConfMan.getBool("tts_enabled") && brightness) - _ttsMan->say(string, Common::TextToSpeechManager::QUEUE_NO_REPEAT, Common::kDos850); + if (ttsMan != nullptr && ConfMan.getBool("tts_enabled") && brightness) + ttsMan->say(string, Common::TextToSpeechManager::QUEUE_NO_REPEAT, Common::kDos850); } void GameManager::say(int textId) { diff --git a/engines/supernova/game-manager.h b/engines/supernova/game-manager.h index 2c085e26370a..39f697a57dcd 100644 --- a/engines/supernova/game-manager.h +++ b/engines/supernova/game-manager.h @@ -101,7 +101,6 @@ class GuiElement : public Common::Rect { class GameManager { public: - Common::TextToSpeechManager *_ttsMan; GameManager(SupernovaEngine *vm, Sound *sound); virtual ~GameManager(); diff --git a/engines/supernova/screen.cpp b/engines/supernova/screen.cpp index e14d3f205348..9dec30267242 100644 --- a/engines/supernova/screen.cpp +++ b/engines/supernova/screen.cpp @@ -532,9 +532,9 @@ void Screen::renderMessage(const char *text, MessagePosition position, int posit int y = 0; byte textColor = 0; - _ttsMan = g_system->getTextToSpeechManager(); - if (_ttsMan != nullptr && ConfMan.getBool("tts_enabled")) - _ttsMan->say(text, Common::TextToSpeechManager::QUEUE_NO_REPEAT, Common::kDos850); + Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager(); + if (ttsMan != nullptr && ConfMan.getBool("tts_enabled")) + ttsMan->say(text, Common::TextToSpeechManager::QUEUE_NO_REPEAT, Common::kDos850); while (*p != '\0') { row[numRows] = p; diff --git a/engines/supernova/screen.h b/engines/supernova/screen.h index 4d094478b8d1..5a94dc05d72b 100644 --- a/engines/supernova/screen.h +++ b/engines/supernova/screen.h @@ -183,8 +183,6 @@ class Screen { void update(); void changeCursor(ResourceManager::CursorId); - Common::TextToSpeechManager *_ttsMan; - private: void renderImageSection(const MSNImage *image, int section, bool invert); diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp index ab5263d48d42..b10183e21133 100644 --- a/engines/supernova/supernova.cpp +++ b/engines/supernova/supernova.cpp @@ -102,7 +102,6 @@ SupernovaEngine::SupernovaEngine(OSystem *syst) _improved = ConfMan.getBool("improved"); - _ttsMan = g_system->getTextToSpeechManager(); } SupernovaEngine::~SupernovaEngine() { @@ -114,8 +113,9 @@ SupernovaEngine::~SupernovaEngine() { } Common::Error SupernovaEngine::run() { - // if (_ttsMan != nullptr) - // _ttsMan->setLanguage(Common::getLanguageCode(getLanguage())); + Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager(); + if (ttsMan != nullptr) + ttsMan->setLanguage(ConfMan.get("language")); init(); @@ -837,8 +837,4 @@ void SupernovaEngine::stopSound() { _sound->stop(); } -// Common::Language SupernovaEngine::getLanguage() const { -// return _gameDescription->language; -// } - } diff --git a/engines/supernova/supernova.h b/engines/supernova/supernova.h index 432f47234adf..0be51cc51199 100644 --- a/engines/supernova/supernova.h +++ b/engines/supernova/supernova.h @@ -137,8 +137,6 @@ class SupernovaEngine : public Engine { void renderBox(const GuiElement &guiElement); void setColor63(byte value); void stopSound(); - // Common::Language getLanguage() const; - Common::TextToSpeechManager *_ttsMan; }; } From e56ab82ba24fc8147a45aaef801a73e160ab59eb Mon Sep 17 00:00:00 2001 From: taylorzhancher Date: Mon, 16 Aug 2021 14:24:56 +0800 Subject: [PATCH 5/5] SUPERNOVA: Fix null check --- engines/sci/tts.cpp | 37 ------------------------------ engines/sci/tts.h | 31 ------------------------- engines/supernova/game-manager.cpp | 4 ++-- 3 files changed, 2 insertions(+), 70 deletions(-) delete mode 100644 engines/sci/tts.cpp delete mode 100644 engines/sci/tts.h diff --git a/engines/sci/tts.cpp b/engines/sci/tts.cpp deleted file mode 100644 index b11e71cde419..000000000000 --- a/engines/sci/tts.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - - -#include "sci/sci.h" -#include "common/text-to-speech.h" -#include "common/config-manager.h" -#include "common/system.h" -#include "sci/graphics/controls16.h" - -namespace Sci { - -void TTS_SAY(const char *text) { - Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager(); - ttsMan->say(text); -} - -} \ No newline at end of file diff --git a/engines/sci/tts.h b/engines/sci/tts.h deleted file mode 100644 index 8eae1ee0e00f..000000000000 --- a/engines/sci/tts.h +++ /dev/null @@ -1,31 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "sci/tts.cpp" -#include "common/text-to-speech.h" -#include "common/config-manager.h" -#include "common/system.h" - - -namespace Sci { - void TTS_SAY(const char *text); -} \ No newline at end of file diff --git a/engines/supernova/game-manager.cpp b/engines/supernova/game-manager.cpp index 3670651ea879..9489211a91b8 100644 --- a/engines/supernova/game-manager.cpp +++ b/engines/supernova/game-manager.cpp @@ -533,7 +533,7 @@ void GameManager::processInput() { case onInventory: _guiInventory[_mouseField - 512].setHighlight(true); _currentInputObject = _inventory.get(_mouseField - 512 + _inventoryScroll); - if (ttsMan != nullptr && ConfMan.getBool("tts_enabled")) + if (ttsMan != nullptr && ConfMan.getBool("tts_enabled") && !isNullObject(_currentInputObject)) ttsMan->say(_vm->getGameString(_currentInputObject->_name), Common::kDos850); break; case onCmdButton: @@ -543,7 +543,7 @@ void GameManager::processInput() { break; case onObject: _currentInputObject = _currentRoom->getObject(_mouseField); - if (!isNullObject(_currentInputObject)) + if (ttsMan != nullptr && ConfMan.getBool("tts_enabled") && !isNullObject(_currentInputObject)) ttsMan->say(_vm->getGameString(_currentInputObject->_name), Common::kDos850); break; case onNone: