diff options
author | Eugene Sandulenko | 2016-08-02 21:28:47 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-03 23:40:36 +0200 |
commit | 0bda62233740a121b52faf90ef01f5cd9cf92a06 (patch) | |
tree | 0d9397dcc7d91f4a4223fbf77ad9578a2f5cf628 /engines/director/lingo | |
parent | 8a29870a8a15912c6238635fc260eb873e8aa5dc (diff) | |
download | scummvm-rg350-0bda62233740a121b52faf90ef01f5cd9cf92a06.tar.gz scummvm-rg350-0bda62233740a121b52faf90ef01f5cd9cf92a06.tar.bz2 scummvm-rg350-0bda62233740a121b52faf90ef01f5cd9cf92a06.zip |
DIRECTOR: Lingo: Implemented 'me' function support for factories
Diffstat (limited to 'engines/director/lingo')
-rw-r--r-- | engines/director/lingo/lingo-codegen.cpp | 19 | ||||
-rw-r--r-- | engines/director/lingo/lingo-gr.cpp | 2 | ||||
-rw-r--r-- | engines/director/lingo/lingo-gr.y | 2 |
3 files changed, 18 insertions, 5 deletions
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp index e59f57ab4f..07fb52290c 100644 --- a/engines/director/lingo/lingo-codegen.cpp +++ b/engines/director/lingo/lingo-codegen.cpp @@ -207,12 +207,25 @@ void Lingo::codeArgStore() { } int Lingo::codeFunc(Common::String *s, int numpar) { - g_lingo->code1(g_lingo->c_call); - g_lingo->codeString(s->c_str()); + int ret = g_lingo->code1(g_lingo->c_call); + + if (s->equalsIgnoreCase("me")) { + if (!g_lingo->_currentFactory.empty()) { + g_lingo->codeString(g_lingo->_currentFactory.c_str()); + debug(2, "Repaced 'me' with %s", g_lingo->_currentFactory.c_str()); + } else { + warning("'me' out of factory method"); + g_lingo->codeString(s->c_str()); + } + } else { + g_lingo->codeString(s->c_str()); + } inst num = 0; WRITE_UINT32(&num, numpar); g_lingo->code1(num); + + return ret; } void Lingo::codeLabel(int label) { @@ -239,7 +252,7 @@ void Lingo::processIf(int elselabel, int endlabel) { break; WRITE_UINT32(&ielse1, else1); - (*_currentScript)[label + 2] = ielse1; /* elsepart */ + (*_currentScript)[label + 2] = ielse1; /* elsepart */ (*_currentScript)[label + 3] = iend; /* end, if cond fails */ else1 = label; diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp index c38e774b08..aa296ede98 100644 --- a/engines/director/lingo/lingo-gr.cpp +++ b/engines/director/lingo/lingo-gr.cpp @@ -2377,7 +2377,7 @@ yyreduce: case 105: #line 480 "engines/director/lingo/lingo-gr.y" - { g_lingo->_indef = true; ;} + { g_lingo->_indef = true; g_lingo->_currentFactory.clear(); ;} break; case 106: diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y index 2726d523cd..4ab7ed3f99 100644 --- a/engines/director/lingo/lingo-gr.y +++ b/engines/director/lingo/lingo-gr.y @@ -477,7 +477,7 @@ gotomovie: tOF tMOVIE STRING { $$ = $3; } // // See also: // on keyword -defn: tMACRO ID { g_lingo->_indef = true; } +defn: tMACRO ID { g_lingo->_indef = true; g_lingo->_currentFactory.clear(); } begin argdef nl argstore stmtlist { g_lingo->code2(g_lingo->c_constpush, (inst)0); // Push fake value on stack g_lingo->code1(g_lingo->c_procret); |