mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-12 14:09:28 +00:00
DIRECTOR: LINGO: Make m_perform inject the current object into the stack
Fixes the dialogue trees in Total Distortion.
This commit is contained in:
parent
7c145266b6
commit
9c6d95e041
@ -1456,7 +1456,7 @@ void LC::call(const Common::String &name, int nargs, bool allowRetVal) {
|
||||
objName.type = VARREF;
|
||||
Datum obj = g_lingo->varFetch(objName, true);
|
||||
if (obj.type == OBJECT && (obj.u.obj->getObjType() & (kFactoryObj | kXObj))) {
|
||||
debugC(3, kDebugLingoExec, "Method called on object: <%s>", obj.asString(true).c_str());
|
||||
debugC(3, kDebugLingoExec, "Factory/XObject method called on object: <%s>", obj.asString(true).c_str());
|
||||
AbstractObject *target = obj.u.obj;
|
||||
if (firstArg.u.s->equalsIgnoreCase("mNew")) {
|
||||
target = target->clone();
|
||||
@ -1475,7 +1475,7 @@ void LC::call(const Common::String &name, int nargs, bool allowRetVal) {
|
||||
|
||||
// Script/Xtra method call
|
||||
if (firstArg.type == OBJECT && !(firstArg.u.obj->getObjType() & (kFactoryObj | kXObj))) {
|
||||
debugC(3, kDebugLingoExec, "Method called on object: <%s>", firstArg.asString(true).c_str());
|
||||
debugC(3, kDebugLingoExec, "Script/Xtra method called on object: <%s>", firstArg.asString(true).c_str());
|
||||
AbstractObject *target = firstArg.u.obj;
|
||||
if (name.equalsIgnoreCase("birth") || name.equalsIgnoreCase("new")) {
|
||||
target = target->clone();
|
||||
|
@ -381,10 +381,12 @@ void LM::m_put(int nargs) {
|
||||
void LM::m_perform(int nargs) {
|
||||
// Lingo doesn't seem to bother cloning the object when
|
||||
// mNew is called with mPerform
|
||||
AbstractObject *me = g_lingo->_currentMe.u.obj;
|
||||
Datum d(g_lingo->_currentMe);
|
||||
AbstractObject *me = d.u.obj;
|
||||
Datum methodName = g_lingo->_stack.remove_at(g_lingo->_stack.size() - nargs); // Take method name out of stack
|
||||
nargs -= 1;
|
||||
Symbol funcSym = me->getMethod(*methodName.u.s);
|
||||
// Object methods expect the first argument to be the object
|
||||
g_lingo->_stack.insert_at(g_lingo->_stack.size() - nargs + 1, d);
|
||||
LC::call(funcSym, nargs, true);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user