diff options
-rw-r--r-- | engines/director/lingo/lingo-builtins.cpp | 11 | ||||
-rw-r--r-- | engines/director/lingo/lingo-code.cpp | 12 | ||||
-rw-r--r-- | engines/director/lingo/lingo.h | 1 |
3 files changed, 19 insertions, 5 deletions
diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp index 6b60ce7730..5001eeabb9 100644 --- a/engines/director/lingo/lingo-builtins.cpp +++ b/engines/director/lingo/lingo-builtins.cpp @@ -144,6 +144,15 @@ void Lingo::printStubWithArglist(const char *funcname, int nargs) { warning("STUB: %s", s.c_str()); } +void Lingo::convertVOIDtoString(int arg, int nargs) { + if (_stack[_stack.size() - nargs + arg].type == VOID) { + if (_stack[_stack.size() - nargs + arg].u.s != NULL) + g_lingo->_stack[_stack.size() - nargs + arg].type = STRING; + else + warning("Incorrect convertVOIDtoString for arg %d of %d", arg, nargs); + } +} + void Lingo::dropStack(int nargs) { for (int i = 0; i < nargs; i++) pop(); @@ -496,6 +505,8 @@ void Lingo::b_moveableSprite(int nargs) { } void Lingo::b_puppetPalette(int nargs) { + g_lingo->convertVOIDtoString(0, nargs); + g_lingo->printStubWithArglist("b_puppetPalette", nargs); g_lingo->dropStack(nargs); diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp index 31bea9e184..fe1c62f3df 100644 --- a/engines/director/lingo/lingo-code.cpp +++ b/engines/director/lingo/lingo-code.cpp @@ -57,7 +57,7 @@ void Lingo::push(Datum d) { void Lingo::pushVoid() { Datum d; - d.u.i = 0; + d.u.s = NULL; d.type = VOID; push(d); } @@ -81,7 +81,7 @@ void Lingo::c_printtop(void) { switch (d.type) { case VOID: - warning("Void"); + warning("Void, came from %s", d.u.s ? d.u.s->c_str() : "<>"); break; case INT: warning("%d", d.u.i); @@ -123,7 +123,7 @@ void Lingo::c_constpush() { void Lingo::c_voidpush() { Datum d; - d.u.i = 0; + d.u.s = NULL; d.type = VOID; g_lingo->push(d); } @@ -186,7 +186,7 @@ void Lingo::c_assign() { return; } - if (d1.u.sym->type == STRING) // Free memory if needed + if ((d1.u.sym->type == STRING || d1.u.sym->type == VOID) && d1.u.sym->u.s) // Free memory if needed delete d1.u.sym->u.s; if (d1.u.sym->type == POINT || d1.u.sym->type == RECT || d1.u.sym->type == ARRAY) @@ -252,6 +252,8 @@ void Lingo::c_eval() { d.u.arr = d.u.sym->u.arr; else if (d.u.sym->type == SYMBOL) d.u.i = d.u.sym->u.i; + else if (d.u.sym->type == VOID) + d.u.s = new Common::String(*d.u.sym->name); else warning("c_eval: unhandled type: %s", d.type2str()); @@ -761,7 +763,7 @@ void Lingo::c_call() { for (int i = nargs; i < sym->nargs; i++) { Datum d; - d.u.i = 0; + d.u.s = NULL; d.type = VOID; g_lingo->push(d); } diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h index 7082befa94..a42b796014 100644 --- a/engines/director/lingo/lingo.h +++ b/engines/director/lingo/lingo.h @@ -256,6 +256,7 @@ public: static void c_open(); void printStubWithArglist(const char *funcname, int nargs); + void convertVOIDtoString(int arg, int nargs); void dropStack(int nargs); static void b_abs(int nargs); |