aboutsummaryrefslogtreecommitdiff
path: root/engines/mutationofjb
diff options
context:
space:
mode:
authorĽubomír Remák2018-03-08 23:05:44 +0100
committerEugene Sandulenko2018-08-25 23:12:01 +0200
commitb4dad9bca7593029ab368bc99f7bd96c71cbf4d8 (patch)
tree108ff4ccbf9c7577c637184153cdf702f4dbbdb9 /engines/mutationofjb
parentdae522f63c05029298da1694038af9b24655ac05 (diff)
downloadscummvm-rg350-b4dad9bca7593029ab368bc99f7bd96c71cbf4d8.tar.gz
scummvm-rg350-b4dad9bca7593029ab368bc99f7bd96c71cbf4d8.tar.bz2
scummvm-rg350-b4dad9bca7593029ab368bc99f7bd96c71cbf4d8.zip
MUTATIONOFJB: Show multiple script commands in showsection debug command.
Diffstat (limited to 'engines/mutationofjb')
-rw-r--r--engines/mutationofjb/commands/saycommand.cpp6
-rw-r--r--engines/mutationofjb/commands/saycommand.h2
-rw-r--r--engines/mutationofjb/debug.cpp29
-rw-r--r--engines/mutationofjb/debug.h5
-rw-r--r--engines/mutationofjb/script.cpp6
5 files changed, 44 insertions, 4 deletions
diff --git a/engines/mutationofjb/commands/saycommand.cpp b/engines/mutationofjb/commands/saycommand.cpp
index 9448203911..a0c9c79bd6 100644
--- a/engines/mutationofjb/commands/saycommand.cpp
+++ b/engines/mutationofjb/commands/saycommand.cpp
@@ -93,7 +93,9 @@ bool SayCommandParser::parse(const Common::String &line, ScriptParseContext &par
break;
}
}
- startPos++;
+ if (startPos != currentLine.size()) {
+ startPos++;
+ }
uint endPos;
for (endPos = startPos; endPos < currentLine.size(); ++endPos) {
@@ -120,7 +122,7 @@ bool SayCommandParser::parse(const Common::String &line, ScriptParseContext &par
if (lineToSay.empty()) {
lineToSay = talkStr;
} else {
- lineToSay = " " + talkStr;
+ lineToSay += " " + talkStr;
}
if (cont) {
diff --git a/engines/mutationofjb/commands/saycommand.h b/engines/mutationofjb/commands/saycommand.h
index 16303de467..e2a1207afc 100644
--- a/engines/mutationofjb/commands/saycommand.h
+++ b/engines/mutationofjb/commands/saycommand.h
@@ -37,7 +37,7 @@ public:
class SayCommand : public SeqCommand {
public:
- SayCommand(Common::String &lineToSay, Common::String &voiceFile, bool waitForPrevious, bool talkingAnimation) :
+ SayCommand(const Common::String &lineToSay, const Common::String &voiceFile, bool waitForPrevious, bool talkingAnimation) :
_lineToSay(lineToSay),
_voiceFile(voiceFile),
_waitForPrevious(waitForPrevious),
diff --git a/engines/mutationofjb/debug.cpp b/engines/mutationofjb/debug.cpp
index 4861ab1f52..cf96fc62ac 100644
--- a/engines/mutationofjb/debug.cpp
+++ b/engines/mutationofjb/debug.cpp
@@ -24,6 +24,8 @@
#include "mutationofjb/mutationofjb.h"
#include "mutationofjb/script.h"
#include "mutationofjb/commands/command.h"
+#include "mutationofjb/commands/seqcommand.h"
+#include "mutationofjb/commands/conditionalcommand.h"
#include "common/debug-channels.h"
#include "common/translation.h"
#include "common/scummsys.h"
@@ -87,6 +89,31 @@ bool Console::cmd_listsections(int argc, const char **argv) {
return true;
}
+void Console::showIndent(int indentLevel) {
+ for (int i = 0; i < indentLevel; ++i) {
+ debugPrintf(" ");
+ }
+}
+
+void Console::showCommands(Command *command, int indentLevel) {
+ while (command) {
+ showIndent(indentLevel);
+ debugPrintf("%s\n", command->debugString().c_str());
+
+ if (SeqCommand *const seqCmd = dynamic_cast<SeqCommand *>(command)) {
+ command = seqCmd->next();
+ } else if (ConditionalCommand *const condCmd = dynamic_cast<ConditionalCommand *>(command)) {
+ showCommands(condCmd->getTrueCommand(), indentLevel + 1);
+ showIndent(indentLevel);
+ debugPrintf("ELSE\n");
+ showCommands(condCmd->getFalseCommand(), indentLevel + 1);
+ command = nullptr;
+ } else {
+ command = nullptr;
+ }
+ }
+}
+
bool Console::cmd_showsection(int argc, const char **argv) {
if (argc == 4) {
Script *script = nullptr;
@@ -146,7 +173,7 @@ bool Console::cmd_showsection(int argc, const char **argv) {
if (found) {
if (command) {
- debugPrintf("%s\n", command->debugString().c_str());
+ showCommands(command);
}
} else {
debugPrintf("Section not found.\n");
diff --git a/engines/mutationofjb/debug.h b/engines/mutationofjb/debug.h
index a41bacaaf3..ee187cb605 100644
--- a/engines/mutationofjb/debug.h
+++ b/engines/mutationofjb/debug.h
@@ -28,6 +28,7 @@
namespace MutationOfJB {
class MutationOfJBEngine;
+class Command;
class Console : public GUI::Debugger {
public:
@@ -36,6 +37,10 @@ public:
private:
bool cmd_listsections(int argc, const char **argv);
bool cmd_showsection(int argc, const char **argv);
+
+ void showIndent(int indentLevel);
+ void showCommands(Command *command, int indentLevel = 0);
+
MutationOfJBEngine *_vm;
};
diff --git a/engines/mutationofjb/script.cpp b/engines/mutationofjb/script.cpp
index 98b1727935..1b11545741 100644
--- a/engines/mutationofjb/script.cpp
+++ b/engines/mutationofjb/script.cpp
@@ -31,6 +31,9 @@
#include "mutationofjb/commands/endblockcommand.h"
#include "mutationofjb/commands/changecommand.h"
#include "mutationofjb/commands/saycommand.h"
+#include "mutationofjb/commands/additemcommand.h"
+#include "mutationofjb/commands/removeitemcommand.h"
+#include "mutationofjb/commands/removeallitemscommand.h"
namespace MutationOfJB {
@@ -43,6 +46,9 @@ static CommandParser** getParsers() {
new ChangeStaticCommandParser,
new ChangeSceneCommandParser,
new SayCommandParser,
+ new AddItemCommandParser,
+ new RemoveItemCommandParser,
+ new RemoveAllItemsCommandParser,
nullptr
};