aboutsummaryrefslogtreecommitdiff
path: root/engines/mutationofjb/commands
diff options
context:
space:
mode:
authorĽubomír Remák2018-07-21 20:29:11 +0200
committerEugene Sandulenko2018-08-25 23:12:01 +0200
commit3306cbfeaa2f1c6fd471daaee054290df7e44280 (patch)
tree56379cb27336281e9ca92b12d6db7ab6d84c31e8 /engines/mutationofjb/commands
parent2e656e69b3b9416f5164f0963951df203f4978e5 (diff)
downloadscummvm-rg350-3306cbfeaa2f1c6fd471daaee054290df7e44280.tar.gz
scummvm-rg350-3306cbfeaa2f1c6fd471daaee054290df7e44280.tar.bz2
scummvm-rg350-3306cbfeaa2f1c6fd471daaee054290df7e44280.zip
MUTATIONOFJB: Implement SayCommand::execute.
Diffstat (limited to 'engines/mutationofjb/commands')
-rw-r--r--engines/mutationofjb/commands/saycommand.cpp21
-rw-r--r--engines/mutationofjb/commands/talkcommand.cpp3
2 files changed, 19 insertions, 5 deletions
diff --git a/engines/mutationofjb/commands/saycommand.cpp b/engines/mutationofjb/commands/saycommand.cpp
index 854c957b1b..0474a3e1ac 100644
--- a/engines/mutationofjb/commands/saycommand.cpp
+++ b/engines/mutationofjb/commands/saycommand.cpp
@@ -21,7 +21,13 @@
*/
#include "mutationofjb/commands/saycommand.h"
+
+#include "mutationofjb/game.h"
+#include "mutationofjb/gamedata.h"
#include "mutationofjb/script.h"
+#include "mutationofjb/tasks/saytask.h"
+#include "mutationofjb/tasks/taskmanager.h"
+
#include "common/str.h"
#include "common/debug.h"
#include "common/debug-channels.h"
@@ -140,9 +146,18 @@ bool SayCommandParser::parse(const Common::String &line, ScriptParseContext &par
}
-Command::ExecuteResult SayCommand::execute(ScriptExecutionContext &) {
- // TODO: Actual implementation.
- debug("%s [%s]", _lineToSay.c_str(), _voiceFile.c_str());
+Command::ExecuteResult SayCommand::execute(ScriptExecutionContext &scriptExecCtx) {
+ Game &game = scriptExecCtx.getGame();
+
+ if (_waitForPrevious) {
+ if (game.getActiveSayTask()) {
+ return InProgress;
+ }
+ }
+
+ TaskPtr task(new SayTask(_lineToSay, game.getGameData()._color));
+ game.getTaskManager().startTask(task);
+
return Finished;
}
diff --git a/engines/mutationofjb/commands/talkcommand.cpp b/engines/mutationofjb/commands/talkcommand.cpp
index 8411e9080a..6a3b204bb5 100644
--- a/engines/mutationofjb/commands/talkcommand.cpp
+++ b/engines/mutationofjb/commands/talkcommand.cpp
@@ -57,11 +57,10 @@ bool TalkCommandParser::parse(const Common::String &line, ScriptParseContext &,
Command::ExecuteResult TalkCommand::execute(ScriptExecutionContext &scriptExeCtx) {
if (!_task) {
_task = TaskPtr(new ConversationTask(scriptExeCtx.getGameData()._currentScene, scriptExeCtx.getGame().getGameData()._conversationInfo, _mode));
- scriptExeCtx.getGame().getTaskManager().addTask(_task);
+ scriptExeCtx.getGame().getTaskManager().startTask(_task);
}
if (_task->getState() == Task::FINISHED) {
- scriptExeCtx.getGame().getTaskManager().removeTask(_task);
_task.reset();
return Command::Finished;