aboutsummaryrefslogtreecommitdiff
path: root/engines/director/lingo/lingo-preprocessor.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2019-12-24 15:32:36 +0100
committerEugene Sandulenko2019-12-24 15:32:36 +0100
commit1f03acd5bba9b29164edfe7bf8cac7e841cf6cca (patch)
tree9ea87a699b695d59101ebc008b951732fbac5c76 /engines/director/lingo/lingo-preprocessor.cpp
parente71ebaae8fa8697bc2072689f68c4dd26061913d (diff)
downloadscummvm-rg350-1f03acd5bba9b29164edfe7bf8cac7e841cf6cca.tar.gz
scummvm-rg350-1f03acd5bba9b29164edfe7bf8cac7e841cf6cca.tar.bz2
scummvm-rg350-1f03acd5bba9b29164edfe7bf8cac7e841cf6cca.zip
DIRECTOR: LINGO: Added preprocessing for 'when' statements with 'if'
Diffstat (limited to 'engines/director/lingo/lingo-preprocessor.cpp')
-rw-r--r--engines/director/lingo/lingo-preprocessor.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/engines/director/lingo/lingo-preprocessor.cpp b/engines/director/lingo/lingo-preprocessor.cpp
index 8d4f74fdea..fd9cab91ff 100644
--- a/engines/director/lingo/lingo-preprocessor.cpp
+++ b/engines/director/lingo/lingo-preprocessor.cpp
@@ -265,6 +265,29 @@ Common::String Lingo::codePreprocessor(const char *s, bool simple) {
debugC(2, kDebugLingoParse, "second-if");
iflevel--;
}
+ } else if (tok.equals("when")) {
+ debugC(2, kDebugLingoParse, "start-when");
+
+ if (strstr(lineStart, "if") && strstr(lineStart, "then")) {
+ tok = prevtok(&line.c_str()[line.size() - 1], lineStart, &prevEnd);
+ debugC(2, kDebugLingoParse, "when-start-if <%s>", tok.c_str());
+
+ if (tok.equals("if")) {
+ debugC(2, kDebugLingoParse, "when-end-if");
+ tok = prevtok(prevEnd, lineStart);
+
+ if (tok.equals("end")) {
+ // do nothing, we open and close same line
+ debugC(2, kDebugLingoParse, "when-end-end");
+ } else {
+ res += " end if";
+ }
+ } else {
+ res += " end if";
+ }
+ }
+ } else {
+ debugC(2, kDebugLingoParse, "nothing");
}
}