diff options
author | Eugene Sandulenko | 2016-09-02 17:11:05 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-09-02 17:25:31 +0200 |
commit | 3f8eab1757fbf54939d53f9e84d274aa2659b189 (patch) | |
tree | 73854fd8e5c3f187f5b0825ac1d735b26cf47dba /engines/director/lingo | |
parent | 1e9e6d901fce43dd92aa944d037e8d49805fa69d (diff) | |
download | scummvm-rg350-3f8eab1757fbf54939d53f9e84d274aa2659b189.tar.gz scummvm-rg350-3f8eab1757fbf54939d53f9e84d274aa2659b189.tar.bz2 scummvm-rg350-3f8eab1757fbf54939d53f9e84d274aa2659b189.zip |
DIRECTOR: Lingo: Implement in-place macro calling
Diffstat (limited to 'engines/director/lingo')
-rw-r--r-- | engines/director/lingo/lingo-code.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp index 405489ba44..66f16536f8 100644 --- a/engines/director/lingo/lingo-code.cpp +++ b/engines/director/lingo/lingo-code.cpp @@ -216,6 +216,15 @@ void Lingo::c_varpush() { char *name = (char *)&(*g_lingo->_currentScript)[g_lingo->_pc]; Datum d; + g_lingo->_pc += g_lingo->calcStringAlignment(name); + + if (g_lingo->_handlers.contains(name)) { + d.type = HANDLER; + d.u.s = new Common::String(name); + g_lingo->push(d); + return; + } + d.u.sym = g_lingo->lookupVar(name); if (d.u.sym->type == CASTREF) { d.type = INT; @@ -228,8 +237,6 @@ void Lingo::c_varpush() { d.type = VAR; } - g_lingo->_pc += g_lingo->calcStringAlignment(name); - g_lingo->push(d); } @@ -298,6 +305,12 @@ void Lingo::c_eval() { Datum d; d = g_lingo->pop(); + if (d.type == HANDLER) { + g_lingo->call(*d.u.s, 0); + delete d.u.s; + return; + } + if (d.type != VAR) { // It could be cast ref g_lingo->push(d); return; |