-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
WAGE: Add text-to-speech (TTS) #6546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added my notes
@@ -197,6 +197,14 @@ bool Gui::processSceneEvents(WindowClick click, Common::Event &event) { | |||
|
|||
return true; | |||
} | |||
if (event.type = Common::EVENT_MOUSEMOVE) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (event.type = Common::EVENT_MOUSEMOVE) { | |
if (event.type = Common::EVENT_MOUSEMOVE) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E.g. it is best to split the blocks with an empty line, so there is a visual cue to the reader.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, this should be a check for equality, not an assignment, i.e:
if (event.type = Common::EVENT_MOUSEMOVE) { | |
if (event.type == Common::EVENT_MOUSEMOVE) { |
engines/wage/gui.cpp
Outdated
if (event.type = Common::EVENT_MOUSEMOVE) { | ||
Designed *obj = _scene->lookUpEntity(event.mouse.x, event.mouse.y); | ||
|
||
if (obj != nullptr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (obj != nullptr) | |
if (obj) |
This is a common practice to make it less comprehensive
engines/wage/wage.h
Outdated
@@ -219,6 +223,11 @@ class WageEngine : public Engine { | |||
void updateSoundTimerForScene(Scene *scene, bool firstTime); | |||
void setMenu(Common::String soundName); | |||
void appendText(const char *str); | |||
void sayText(const Common::String str) { | |||
sayText(str, Common::TextToSpeechManager::INTERRUPT_NO_REPEAT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better to move this to C++ code and as such, eliminate #include "common/text-to-speech.h"
which increases header dependency -> longer compilation time
engines/wage/wage.h
Outdated
@@ -47,6 +47,7 @@ | |||
#ifndef WAGE_WAGE_H | |||
#define WAGE_WAGE_H | |||
|
|||
#include "engines/advancedDetector.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be needed.
engines/wage/wage.cpp
Outdated
@@ -118,6 +119,12 @@ Common::Error WageEngine::run() { | |||
height = 768; | |||
} | |||
|
|||
Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager(); | |||
if (ttsMan != nullptr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (ttsMan != nullptr) { | |
if (ttsMan) { |
engines/wage/wage.cpp
Outdated
@@ -264,14 +271,28 @@ void WageEngine::setMenu(Common::String menu) { | |||
|
|||
void WageEngine::appendText(const char *str) { | |||
Common::String s(str); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert this
engines/wage/wage.cpp
Outdated
_inputText.clear(); | ||
} | ||
|
||
void WageEngine::sayText(const Common::String str, Common::TextToSpeechManager::Action action) { | ||
Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager(); | ||
if (ttsMan != nullptr && ConfMan.getBool("tts_enabled")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (ttsMan != nullptr && ConfMan.getBool("tts_enabled")) | |
if (ttsMan && ConfMan.getBool("tts_enabled")) |
and below
engines/wage/wage.cpp
Outdated
@@ -574,7 +596,7 @@ void WageEngine::processTurn(Common::String *textInput, Designed *clickInput) { | |||
processTurnInternal(&input, clickInput); | |||
Scene *playerScene = _world->_player->_currentScene; | |||
|
|||
if (prevScene != playerScene && playerScene != _world->_storageScene) { | |||
if (prevScene != playerScene && playerScene != _world->_storageScene) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please revert
engines/wage/wage.cpp
Outdated
@@ -605,5 +627,9 @@ void WageEngine::processTurn(Common::String *textInput, Designed *clickInput) { | |||
_inputText.clear(); | |||
} | |||
|
|||
Common::Language WageEngine::getLanguage() const{ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove this empty line
engines/wage/wage.cpp
Outdated
@@ -605,5 +627,9 @@ void WageEngine::processTurn(Common::String *textInput, Designed *clickInput) { | |||
_inputText.clear(); | |||
} | |||
|
|||
Common::Language WageEngine::getLanguage() const{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Common::Language WageEngine::getLanguage() const{ | |
Common::Language WageEngine::getLanguage() const { |
Please follow our code formatting guidelines. Adn you may see this formatting everywhere
Adds text-to-speech to the following: