diff options
author | Eugene Sandulenko | 2016-08-11 19:29:05 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-11 19:50:25 +0200 |
commit | 22b6fec5f3e88d85bbcfa03abf0a5e502ac769f5 (patch) | |
tree | c965579d40fd1ade6e1a58426170a143705fe6fb /engines | |
parent | 01761e991a974e774c07d7d7d145c9de003308df (diff) | |
download | scummvm-rg350-22b6fec5f3e88d85bbcfa03abf0a5e502ac769f5.tar.gz scummvm-rg350-22b6fec5f3e88d85bbcfa03abf0a5e502ac769f5.tar.bz2 scummvm-rg350-22b6fec5f3e88d85bbcfa03abf0a5e502ac769f5.zip |
DIRECTOR: Lingo: Initial code for factory creation
Diffstat (limited to 'engines')
-rw-r--r-- | engines/director/lingo/lingo-builtins.cpp | 16 | ||||
-rw-r--r-- | engines/director/lingo/lingo-code.cpp | 5 | ||||
-rw-r--r-- | engines/director/lingo/lingo-codegen.cpp | 12 | ||||
-rw-r--r-- | engines/director/lingo/lingo.h | 3 |
4 files changed, 35 insertions, 1 deletions
diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp index 573a005bb5..3c888c1b09 100644 --- a/engines/director/lingo/lingo-builtins.cpp +++ b/engines/director/lingo/lingo-builtins.cpp @@ -621,4 +621,20 @@ void Lingo::b_false(int nargs) { g_lingo->push(d); } +void Lingo::b_factory(int nargs) { + // This is intentionally empty +} + +void Lingo::factoryCall(Common::String &name, int nargs) { + Common::String s("factoryCall: "); + + s += name; + + convertVOIDtoString(0, nargs); + + printStubWithArglist(s.c_str(), nargs); + + dropStack(nargs); +} + } // End of namespace Director diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp index 125365a014..fe2b82e5f9 100644 --- a/engines/director/lingo/lingo-code.cpp +++ b/engines/director/lingo/lingo-code.cpp @@ -755,7 +755,10 @@ void Lingo::c_call() { } if (sym->type == BLTIN) { - (*sym->u.bltin)(nargs); + if (sym->u.bltin == b_factory) + g_lingo->factoryCall(name, nargs); + else + (*sym->u.bltin)(nargs); return; } diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp index 4284fa7452..bf96802bb7 100644 --- a/engines/director/lingo/lingo-codegen.cpp +++ b/engines/director/lingo/lingo-codegen.cpp @@ -270,6 +270,18 @@ void Lingo::processIf(int elselabel, int endlabel) { void Lingo::codeFactory(Common::String &name) { _currentFactory = name; + + Symbol *sym = new Symbol; + + sym->name = (char *)calloc(name.size() + 1, 1); + Common::strlcpy(sym->name, name.c_str(), name.size()); + sym->type = BLTIN; + sym->nargs = -1; + sym->maxArgs = 0; + sym->parens = true; + sym->u.bltin = g_lingo->b_factory; + + _handlers[name] = sym; } } diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h index 35bdea9635..a51988c908 100644 --- a/engines/director/lingo/lingo.h +++ b/engines/director/lingo/lingo.h @@ -325,6 +325,9 @@ public: static void b_false(int nargs); static void b_true(int nargs); + static void b_factory(int nargs); + void factoryCall(Common::String &name, int nargs); + void func_mci(Common::String &s); void func_mciwait(Common::String &s); void func_goto(Datum &frame, Datum &movie); |