[Scummvm-git-logs] scummvm master -> 5176a39a90a964ece725a4ca4b0e74fc39f49db5
djsrv
dservilla at gmail.com
Mon Jul 20 16:04:34 UTC 2020
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
7ae8fc0ff0 DIRECTOR: LINGO: Fix c_call resolution order
5176a39a90 DIRECTOR: LINGO: Suppress var not found warnings
Commit: 7ae8fc0ff046f1b6c90f3ae7ae7dbadf8b916a34
https://github.com/scummvm/scummvm/commit/7ae8fc0ff046f1b6c90f3ae7ae7dbadf8b916a34
Author: djsrv (dservilla at gmail.com)
Date: 2020-07-20T11:56:05-04:00
Commit Message:
DIRECTOR: LINGO: Fix c_call resolution order
Changed paths:
engines/director/lingo/lingo-code.cpp
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 2a8fbc0e63..7bfe69626f 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -1349,12 +1349,39 @@ void LC::call(const Common::String &name, int nargs, SymbolType bltinType) {
Symbol funcSym;
- // Script/Xtra method call
if (nargs > 0) {
- Datum d = g_lingo->peek(nargs - 1);
- if (d.type == OBJECT && !(d.u.obj->getObjType() & (kFactoryObj | kXObj))) {
- debugC(3, kDebugLingoExec, "Method called on object: <%s>", d.asString(true).c_str());
- AbstractObject *target = d.u.obj;
+ Datum firstArg = g_lingo->_stack[g_lingo->_stack.size() - nargs];
+
+ // Factory/XObject method call
+ if (firstArg.lazy) { // first arg could be method name
+ Datum objName(name);
+ objName.type = VAR;
+ Datum obj = g_lingo->varFetch(objName);
+ if (obj.type == OBJECT && (obj.u.obj->getObjType() & (kFactoryObj | kXObj))) {
+ debugC(3, kDebugLingoExec, "Method called on object: <%s>", obj.asString(true).c_str());
+ AbstractObject *target = obj.u.obj;
+ if (firstArg.u.s->equalsIgnoreCase("mNew")) {
+ target = target->clone();
+ }
+ funcSym = target->getMethod(*firstArg.u.s);
+ if (target->getObjType() == kScriptObj && funcSym.type == HANDLER) {
+ // For kFactoryObj handlers the target is the first argument
+ g_lingo->_stack[g_lingo->_stack.size() - nargs] = funcSym.target;
+ } else {
+ // Otherwise, take the method name out of the stack
+ g_lingo->_stack.remove_at(g_lingo->_stack.size() - nargs);
+ nargs -= 1;
+ }
+ call(funcSym, nargs);
+ return;
+ }
+ firstArg = firstArg.eval();
+ }
+
+ // 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());
+ AbstractObject *target = firstArg.u.obj;
if (name.equalsIgnoreCase("birth") || name.equalsIgnoreCase("new")) {
target = target->clone();
}
@@ -1374,33 +1401,9 @@ void LC::call(const Common::String &name, int nargs, SymbolType bltinType) {
}
}
- // Normal handler call
+ // Handler
funcSym = g_lingo->getHandler(name);
- // Factory/XObject method call
- if (funcSym.type == VOIDSYM) {
- Datum objName(name);
- objName.type = VAR;
- Datum d = g_lingo->varFetch(objName);
- if (d.type == OBJECT && (d.u.obj->getObjType() & (kFactoryObj | kXObj))) {
- debugC(3, kDebugLingoExec, "Method called on object: <%s>", d.asString(true).c_str());
- AbstractObject *target = d.u.obj;
- Datum methodName = g_lingo->_stack[g_lingo->_stack.size() - nargs];
- if (methodName.u.s->equalsIgnoreCase("mNew")) {
- target = target->clone();
- }
- funcSym = target->getMethod(*methodName.u.s);
- if (target->getObjType() == kScriptObj && funcSym.type == HANDLER) {
- // For kFactoryObj handlers the target is the first argument
- g_lingo->_stack[g_lingo->_stack.size() - nargs] = funcSym.target;
- } else {
- // Otherwise, take the methodName out of the stack
- g_lingo->_stack.remove_at(g_lingo->_stack.size() - nargs);
- nargs -= 1;
- }
- }
- }
-
// Builtin
if (funcSym.type == VOIDSYM) {
switch (bltinType) {
Commit: 5176a39a90a964ece725a4ca4b0e74fc39f49db5
https://github.com/scummvm/scummvm/commit/5176a39a90a964ece725a4ca4b0e74fc39f49db5
Author: djsrv (dservilla at gmail.com)
Date: 2020-07-20T11:56:05-04:00
Commit Message:
DIRECTOR: LINGO: Suppress var not found warnings
Changed paths:
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 7bfe69626f..b7c137a88f 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -1356,7 +1356,7 @@ void LC::call(const Common::String &name, int nargs, SymbolType bltinType) {
if (firstArg.lazy) { // first arg could be method name
Datum objName(name);
objName.type = VAR;
- Datum obj = g_lingo->varFetch(objName);
+ Datum obj = g_lingo->varFetch(objName, false, nullptr, true);
if (obj.type == OBJECT && (obj.u.obj->getObjType() & (kFactoryObj | kXObj))) {
debugC(3, kDebugLingoExec, "Method called on object: <%s>", obj.asString(true).c_str());
AbstractObject *target = obj.u.obj;
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 263a621cbc..203742f902 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -1269,7 +1269,7 @@ void Lingo::varAssign(Datum &var, Datum &value, bool global, DatumHash *localvar
}
}
-Datum Lingo::varFetch(Datum &var, bool global, DatumHash *localvars) {
+Datum Lingo::varFetch(Datum &var, bool global, DatumHash *localvars, bool silent) {
if (localvars == nullptr) {
localvars = _localvars;
}
@@ -1307,7 +1307,8 @@ Datum Lingo::varFetch(Datum &var, bool global, DatumHash *localvars) {
return _globalvars[name];
}
- warning("varFetch: variable %s not found", name.c_str());
+ if (!silent)
+ warning("varFetch: variable %s not found", name.c_str());
return result;
} else if (var.type == FIELDREF) {
CastMember *cast = _vm->getCurrentMovie()->getCastMember(var.u.i);
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index bfb2e237e3..c395cf77cd 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -288,7 +288,7 @@ public:
void cleanLocalVars();
int castIdFetch(Datum &var);
void varAssign(Datum &var, Datum &value, bool global = false, DatumHash *localvars = nullptr);
- Datum varFetch(Datum &var, bool global = false, DatumHash *localvars = nullptr);
+ Datum varFetch(Datum &var, bool global = false, DatumHash *localvars = nullptr, bool silent = false);
int getAlignedType(const Datum &d1, const Datum &d2);
More information about the Scummvm-git-logs
mailing list