diff options
Diffstat (limited to 'engines/director/lingo/lingo-code.cpp')
-rw-r--r-- | engines/director/lingo/lingo-code.cpp | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp index 150e242e88..8712f0990c 100644 --- a/engines/director/lingo/lingo-code.cpp +++ b/engines/director/lingo/lingo-code.cpp @@ -65,7 +65,7 @@ static struct FuncDescr { { Lingo::c_stringpush, "c_stringpush", "s" }, { Lingo::c_varpush, "c_varpush", "s" }, { Lingo::c_assign, "c_assign", "" }, - { Lingo::c_eval, "c_eval", "" }, + { Lingo::c_eval, "c_eval", "s" }, { Lingo::c_theentitypush,"c_theentitypush","ii" }, // entity, field { Lingo::c_theentityassign,"c_theentityassign","ii" }, { Lingo::c_swap, "c_swap", "" }, @@ -92,6 +92,7 @@ static struct FuncDescr { { Lingo::c_repeatwhilecode,"c_repeatwhilecode","oo" }, { Lingo::c_repeatwithcode,"c_repeatwithcode","ooooos" }, { Lingo::c_ifcode, "c_ifcode", "oooi" }, + { Lingo::c_whencode, "c_whencode", "os" }, { Lingo::c_goto, "c_goto", "" }, { Lingo::c_gotoloop, "c_gotoloop", "" }, { Lingo::c_gotonext, "c_gotonext", "" }, @@ -170,6 +171,9 @@ void Lingo::c_printtop(void) { case SYMBOL: warning("%s", d.type2str(true)); break; + case OBJECT: + warning("#%s", d.u.s->c_str()); + break; default: warning("--unknown--"); } @@ -263,8 +267,11 @@ void Lingo::c_assign() { delete d2.u.arr; } else if (d2.type == SYMBOL) { d1.u.sym->u.i = d2.u.i; + } else if (d2.type == OBJECT) { + d1.u.sym->u.s = d2.u.s; } else { warning("c_assign: unhandled type: %s", d2.type2str()); + d1.u.sym->u.s = d2.u.s; } d1.u.sym->type = d2.type; @@ -695,24 +702,38 @@ void Lingo::c_ifcode() { int end = READ_UINT32(&(*g_lingo->_currentScript)[savepc + 2]); int skipEnd = READ_UINT32(&(*g_lingo->_currentScript)[savepc + 3]); - debug(8, "executing cond (have to %s end)", skipEnd ? "skip" : "execute"); + debugC(8, kDebugLingoExec, "executing cond (have to %s end)", skipEnd ? "skip" : "execute"); g_lingo->execute(savepc + 4); /* condition */ d = g_lingo->pop(); if (d.toInt()) { - debug(8, "executing then"); + debugC(8, kDebugLingoExec, "executing then"); g_lingo->execute(then); } else if (elsep) { /* else part? */ - debug(8, "executing else"); + debugC(8, kDebugLingoExec, "executing else"); g_lingo->execute(elsep); } if (!g_lingo->_returning && !skipEnd) { g_lingo->_pc = end; /* next stmt */ - debug(8, "executing end"); - } else - debug(8, "Skipped end"); + debugC(8, kDebugLingoExec, "executing end"); + } else { + debugC(8, kDebugLingoExec, "Skipped end"); + } +} + +void Lingo::c_whencode() { + Datum d; + int start = g_lingo->_pc; + int end = READ_UINT32(&(*g_lingo->_currentScript)[start]); + Common::String eventname((char *)&(*g_lingo->_currentScript)[start]); + + start += g_lingo->calcStringAlignment(eventname.c_str()); + + warning("STUB: c_whencode([%5d][%5d], %s)", start, end, eventname.c_str()); + + g_lingo->_pc = end; } //************************ @@ -789,7 +810,7 @@ void Lingo::call(Common::String &name, int nargs) { if (!g_lingo->_handlers.contains(name)) { Symbol *s = g_lingo->lookupVar(name.c_str(), false); if (s && s->type == OBJECT) { - debug(3, "Dereferencing object reference: %s to %s", name.c_str(), s->u.s->c_str()); + debugC(3, kDebugLingoExec, "Dereferencing object reference: %s to %s", name.c_str(), s->u.s->c_str()); name = *s->u.s; } } @@ -843,6 +864,7 @@ void Lingo::call(Common::String &name, int nargs) { g_lingo->push(d); } + debugC(5, kDebugLingoExec, "Pushing frame %d", g_lingo->_callstack.size() + 1); CFrame *fp = new CFrame; fp->sp = sym; @@ -868,7 +890,10 @@ void Lingo::c_procret() { return; } + debugC(5, kDebugLingoExec, "Popping frame %d", g_lingo->_callstack.size() + 1); + CFrame *fp = g_lingo->_callstack.back(); + g_lingo->_callstack.pop_back(); g_lingo->_currentScript = fp->retscript; g_lingo->_pc = fp->retpc; |