diff options
author | Ľubomír Remák | 2018-03-20 22:15:23 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2018-08-25 23:12:01 +0200 |
commit | 7a081f0605f2282fdce907bedfc9cae55dc67ab7 (patch) | |
tree | 520e4fff4e6d582ab911f18d997d3f7048b22bee /engines/mutationofjb/commands | |
parent | 1d84041508b3acaf7a47fde81e7e334c004507b8 (diff) | |
download | scummvm-rg350-7a081f0605f2282fdce907bedfc9cae55dc67ab7.tar.gz scummvm-rg350-7a081f0605f2282fdce907bedfc9cae55dc67ab7.tar.bz2 scummvm-rg350-7a081f0605f2282fdce907bedfc9cae55dc67ab7.zip |
MUTATIONOFJB: Load local (room) scripts.
Diffstat (limited to 'engines/mutationofjb/commands')
-rw-r--r-- | engines/mutationofjb/commands/command.cpp | 1 | ||||
-rw-r--r-- | engines/mutationofjb/commands/command.h | 3 | ||||
-rw-r--r-- | engines/mutationofjb/commands/conditionalcommand.cpp | 4 | ||||
-rw-r--r-- | engines/mutationofjb/commands/conditionalcommand.h | 2 | ||||
-rw-r--r-- | engines/mutationofjb/commands/endblockcommand.cpp | 10 | ||||
-rw-r--r-- | engines/mutationofjb/commands/endblockcommand.h | 6 | ||||
-rw-r--r-- | engines/mutationofjb/commands/gotocommand.cpp | 4 |
7 files changed, 25 insertions, 5 deletions
diff --git a/engines/mutationofjb/commands/command.cpp b/engines/mutationofjb/commands/command.cpp index 943986e89d..6c4dc47cbb 100644 --- a/engines/mutationofjb/commands/command.cpp +++ b/engines/mutationofjb/commands/command.cpp @@ -26,6 +26,7 @@ namespace MutationOfJB { void CommandParser::transition(ScriptParseContext &, Command *, Command *, CommandParser *) {} +void CommandParser::finish(ScriptParseContext &parseCtx) {} CommandParser::~CommandParser() {} Command::~Command() {} diff --git a/engines/mutationofjb/commands/command.h b/engines/mutationofjb/commands/command.h index ccfdea25f0..c6fce1e892 100644 --- a/engines/mutationofjb/commands/command.h +++ b/engines/mutationofjb/commands/command.h @@ -43,6 +43,9 @@ public: /* Old command - created by this parser. */ virtual void transition(ScriptParseContext &parseCtx, Command *oldCommand, Command *newCommand, CommandParser *newCommandParser); + + /* Called after parsing. */ + virtual void finish(ScriptParseContext &parseCtx); }; class Command { diff --git a/engines/mutationofjb/commands/conditionalcommand.cpp b/engines/mutationofjb/commands/conditionalcommand.cpp index 1e0b7555c2..aa42d1c4db 100644 --- a/engines/mutationofjb/commands/conditionalcommand.cpp +++ b/engines/mutationofjb/commands/conditionalcommand.cpp @@ -38,6 +38,10 @@ void ConditionalCommandParser::transition(ScriptParseContext &parseContext, Comm condCommand->setTrueCommand(newCommand); } +void ConditionalCommandParser::finish(ScriptParseContext &) { + _lastTag = 0; +} + ConditionalCommand::ConditionalCommand() : _trueCommand(nullptr), diff --git a/engines/mutationofjb/commands/conditionalcommand.h b/engines/mutationofjb/commands/conditionalcommand.h index 4a4e7e1064..d64efbf180 100644 --- a/engines/mutationofjb/commands/conditionalcommand.h +++ b/engines/mutationofjb/commands/conditionalcommand.h @@ -30,7 +30,9 @@ namespace MutationOfJB { class ConditionalCommandParser : public CommandParser { public: + ConditionalCommandParser() : _lastTag(0) {} virtual void transition(ScriptParseContext &parseCtx, Command *oldCommand, Command *newCommand, CommandParser *newCommandParser); + virtual void finish(ScriptParseContext &parseCtx) override; protected: char _lastTag; }; diff --git a/engines/mutationofjb/commands/endblockcommand.cpp b/engines/mutationofjb/commands/endblockcommand.cpp index 019c3b5432..2d2ebe3478 100644 --- a/engines/mutationofjb/commands/endblockcommand.cpp +++ b/engines/mutationofjb/commands/endblockcommand.cpp @@ -121,6 +121,16 @@ void EndBlockCommandParser::transition(ScriptParseContext &parseCtx, Command *, } } +void EndBlockCommandParser::finish(ScriptParseContext &) { + _elseFound = false; + _ifTag = 0; + + if (!_pendingActionInfos.empty()) { + debug("Problem: Pending action infos from end block parser is not empty!"); + } + _pendingActionInfos.clear(); +} + Command::ExecuteResult EndBlockCommand::execute(GameData &) { return Finished; } diff --git a/engines/mutationofjb/commands/endblockcommand.h b/engines/mutationofjb/commands/endblockcommand.h index 24c4e5c432..3af86a3d82 100644 --- a/engines/mutationofjb/commands/endblockcommand.h +++ b/engines/mutationofjb/commands/endblockcommand.h @@ -35,9 +35,9 @@ class EndBlockCommandParser : public CommandParser { public: EndBlockCommandParser() : _elseFound(false), _ifTag(0) {} - virtual bool parse(const Common::String &line, ScriptParseContext &parseCtx, Command *&command); - virtual void transition(ScriptParseContext &parseCtx, Command *oldCommand, Command *newCommand, CommandParser *newCommandParser); - + virtual bool parse(const Common::String &line, ScriptParseContext &parseCtx, Command *&command) override; + virtual void transition(ScriptParseContext &parseCtx, Command *oldCommand, Command *newCommand, CommandParser *newCommandParser) override; + virtual void finish(ScriptParseContext &parseCtx) override; private: bool _elseFound; char _ifTag; diff --git a/engines/mutationofjb/commands/gotocommand.cpp b/engines/mutationofjb/commands/gotocommand.cpp index 40560f3bfb..a1d1a9d819 100644 --- a/engines/mutationofjb/commands/gotocommand.cpp +++ b/engines/mutationofjb/commands/gotocommand.cpp @@ -26,7 +26,7 @@ #include "mutationofjb/script.h" /* - GOTO <label> + "GOTO " <label> Jumps to a label. */ @@ -38,7 +38,7 @@ bool GotoCommandParser::parse(const Common::String &line, ScriptParseContext &pa return false; } - Common::String label = line.c_str() + 6; + Common::String label = line.c_str() + 5; GotoCommand *gotoCmd = new GotoCommand(); if (parseCtx._labels.contains(label)) { |