From 3f8eab1757fbf54939d53f9e84d274aa2659b189 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 2 Sep 2016 17:11:05 +0200 Subject: DIRECTOR: Lingo: Implement in-place macro calling --- engines/director/lingo/lingo-code.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'engines') 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; -- cgit v1.2.3