aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2016-09-01 10:24:31 +0200
committerEugene Sandulenko2016-09-01 10:26:42 +0200
commit3735f79d5b3d81665a7f91f955ec58951abddaef (patch)
tree2ef18e0d70cb05fd76308b162ee3d19c5b42ed23
parent439c68b5cfda42a576b3b194a3cd9ae15f905aad (diff)
downloadscummvm-rg350-3735f79d5b3d81665a7f91f955ec58951abddaef.tar.gz
scummvm-rg350-3735f79d5b3d81665a7f91f955ec58951abddaef.tar.bz2
scummvm-rg350-3735f79d5b3d81665a7f91f955ec58951abddaef.zip
DIRECTOR: Lingo: Implemented when..then keyword logic
-rw-r--r--engines/director/lingo/lingo-code.cpp4
-rw-r--r--engines/director/lingo/lingo-codegen.cpp7
-rw-r--r--engines/director/lingo/lingo.h2
3 files changed, 9 insertions, 4 deletions
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 9e3350a1df..d7b91d2839 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -760,7 +760,9 @@ void Lingo::c_whencode() {
start += g_lingo->calcStringAlignment(eventname.c_str());
- warning("STUB: c_whencode([%5d][%5d], %s)", start, end, eventname.c_str());
+ g_lingo->define(eventname, start, 0, NULL, end);
+
+ debugC(3, kDebugLingoExec, "c_whencode([%5d][%5d], %s)", start, end, eventname.c_str());
g_lingo->_pc = end;
}
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp
index c145184a19..440efb5b44 100644
--- a/engines/director/lingo/lingo-codegen.cpp
+++ b/engines/director/lingo/lingo-codegen.cpp
@@ -191,7 +191,7 @@ void Lingo::cleanLocalVars() {
delete g_lingo->_localvars;
}
-void Lingo::define(Common::String &name, int start, int nargs, Common::String *prefix) {
+void Lingo::define(Common::String &name, int start, int nargs, Common::String *prefix, int end) {
Symbol *sym;
if (prefix)
@@ -214,7 +214,10 @@ void Lingo::define(Common::String &name, int start, int nargs, Common::String *p
delete sym->u.defn;
}
- sym->u.defn = new ScriptData(&(*_currentScript)[start], _currentScript->size() - start + 1);
+ if (end == -1)
+ end = _currentScript->size();
+
+ sym->u.defn = new ScriptData(&(*_currentScript)[start], end - start + 1);
sym->nargs = nargs;
}
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 0b3121574b..464e4eeaa1 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -198,7 +198,7 @@ public:
void popContext();
Symbol *lookupVar(const char *name, bool create = true, bool putInGlobalList = false);
void cleanLocalVars();
- void define(Common::String &s, int start, int nargs, Common::String *prefix = NULL);
+ void define(Common::String &s, int start, int nargs, Common::String *prefix = NULL, int end = -1);
void processIf(int elselabel, int endlabel);
int alignTypes(Datum &d1, Datum &d2);