aboutsummaryrefslogtreecommitdiff
path: root/engines/director/lingo
diff options
context:
space:
mode:
authorEugene Sandulenko2017-02-08 22:11:23 +0100
committerEugene Sandulenko2017-02-08 22:11:23 +0100
commitd8a103d9e26f4d9ddb4b17f418559044b003343a (patch)
treeae44725200bb8aa1408e3ffbc0815184664fa6dc /engines/director/lingo
parentc0dd0f4f53ea5cbaa12a61db6b7972c399c7b0c6 (diff)
downloadscummvm-rg350-d8a103d9e26f4d9ddb4b17f418559044b003343a.tar.gz
scummvm-rg350-d8a103d9e26f4d9ddb4b17f418559044b003343a.tar.bz2
scummvm-rg350-d8a103d9e26f4d9ddb4b17f418559044b003343a.zip
DIRECTOR: Lingo: Documented D4 "Predefined methods and special messages" Lingo
Diffstat (limited to 'engines/director/lingo')
-rw-r--r--engines/director/lingo/lingo-builtins.cpp37
-rw-r--r--engines/director/lingo/lingo-codegen.cpp7
-rw-r--r--engines/director/lingo/lingo.cpp8
3 files changed, 31 insertions, 21 deletions
diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index 92511b1448..03e1a86544 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -274,6 +274,22 @@ static const char *builtinFunctions[] = {
0
};
+
+static const char *predefinedMethods[] = {
+ "mAtFrame", // D3
+ "mDescribe", // D3
+ "mDispose", // D3
+ "mGet", // D3
+ "mInstanceRespondsTo", // D3
+ "mMessageList", // D3
+ "mName", // D3
+ "mNew", // D3
+ "mPerform", // D3
+ "mPut", // D3
+ "mRespondsTo", // D3
+ 0
+};
+
void Lingo::initBuiltIns() {
for (BuiltinProto *blt = builtins; blt->name; blt++) {
Symbol *sym = new Symbol;
@@ -299,6 +315,13 @@ void Lingo::initBuiltIns() {
for (const char **b = twoWordBuiltins; *b; b++)
_twoWordBuiltins[*b] = true;
+
+ // Set predefined methods
+ for (const char **b = predefinedMethods; *b; b++) {
+ Symbol *s = g_lingo->lookupVar(*b, true, true);
+ s->type = SYMBOL;
+ s->u.s = new Common::String(*b);
+ }
}
void Lingo::printSTUBWithArglist(const char *funcname, int nargs) {
@@ -1335,20 +1358,6 @@ void Lingo::b_factory(int nargs) {
// This is intentionally empty
}
-// TODO:
-// List of predefined methods in D3
-// mAtFrame
-// mDescribe
-// mDispose
-// mGet
-// mInstanceRespondsTo
-// mMessageList
-// mName
-// mNew
-// mPerform
-// mPut
-// mRespondsTo
-
void Lingo::factoryCall(Common::String &name, int nargs) {
Common::String s("factoryCall: ");
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp
index 65f2b2d11a..94fe7068a4 100644
--- a/engines/director/lingo/lingo-codegen.cpp
+++ b/engines/director/lingo/lingo-codegen.cpp
@@ -142,7 +142,7 @@ Common::String Lingo::decodeInstruction(uint pc, uint *newPc) {
}
Symbol *Lingo::lookupVar(const char *name, bool create, bool putInGlobalList) {
- Symbol *sym;
+ Symbol *sym = nullptr;
// Looking for the cast member constants
if (_vm->getVersion() < 4) { // TODO: There could be a flag 'Allow Outdated Lingo' in Movie Info in D4
@@ -165,7 +165,7 @@ Symbol *Lingo::lookupVar(const char *name, bool create, bool putInGlobalList) {
}
}
- if (!_localvars->contains(name)) { // Create variable if it was not defined
+ if (!_localvars || !_localvars->contains(name)) { // Create variable if it was not defined
if (!create)
return NULL;
@@ -174,7 +174,8 @@ Symbol *Lingo::lookupVar(const char *name, bool create, bool putInGlobalList) {
sym->type = VOID;
sym->u.i = 0;
- (*_localvars)[name] = sym;
+ if (_localvars)
+ (*_localvars)[name] = sym;
if (putInGlobalList) {
sym->global = true;
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 9a92d2f2ac..0ce1944c74 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -91,10 +91,6 @@ Lingo::Lingo(DirectorEngine *vm) : _vm(vm) {
_eventHandlerTypes[t->handler] = t->name;
}
- initBuiltIns();
- initFuncs();
- initTheEntities();
-
_currentScript = 0;
_currentScriptType = kMovieScript;
_currentEntityId = 0;
@@ -119,6 +115,10 @@ Lingo::Lingo(DirectorEngine *vm) : _vm(vm) {
_localvars = NULL;
+ initBuiltIns();
+ initFuncs();
+ initTheEntities();
+
warning("Lingo Inited");
}