[Scummvm-git-logs] scummvm master -> 191ab2da4ea844c0cd6e654ae925358e79978a87
djsrv
dservilla at gmail.com
Tue Aug 18 19:57:09 UTC 2020
This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
799ac26520 DIRECTOR: LINGO: Fix missing method fallback
d180343a16 DIRECTOR: LINGO: Fix varAssign/Fetch type checks
b19569eb39 DIRECTOR: LINGO: Add eval arg to Lingo::pop/peek
cd91e0fc2a DIRECTOR: LINGO: Push lazy var in cb_objectpush
191ab2da4e DIRECTOR: LINGO: Fix cb_objectcall lazy vars
Commit: 799ac26520ad16a099c653c615557ed79d7a078d
https://github.com/scummvm/scummvm/commit/799ac26520ad16a099c653c615557ed79d7a078d
Author: djsrv (dservilla at gmail.com)
Date: 2020-08-18T15:27:59-04:00
Commit Message:
DIRECTOR: LINGO: Fix missing method fallback
Changed paths:
engines/director/lingo/lingo-code.cpp
engines/director/lingo/tests/factory.lingo
engines/director/lingo/tests/factory2.lingo
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index f5cb0ab5e8..cb5a5cc1ca 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -1469,10 +1469,11 @@ void LC::call(const Common::String &name, int nargs, bool allowRetVal) {
target = target->clone();
}
funcSym = target->getMethod(*firstArg.u.s);
- // Set first arg to target
- g_lingo->_stack[g_lingo->_stack.size() - nargs] = funcSym.target;
- call(funcSym, nargs, allowRetVal);
- return;
+ if (funcSym.type != VOIDSYM) {
+ g_lingo->_stack[g_lingo->_stack.size() - nargs] = funcSym.target; // Set first arg to target
+ call(funcSym, nargs, allowRetVal);
+ return;
+ }
}
firstArg = firstArg.eval();
}
@@ -1486,8 +1487,7 @@ void LC::call(const Common::String &name, int nargs, bool allowRetVal) {
}
funcSym = target->getMethod(name);
if (funcSym.type != VOIDSYM) {
- // Set first arg to target
- g_lingo->_stack[g_lingo->_stack.size() - nargs] = funcSym.target;
+ g_lingo->_stack[g_lingo->_stack.size() - nargs] = funcSym.target; // Set first arg to target
call(funcSym, nargs, allowRetVal);
return;
}
diff --git a/engines/director/lingo/tests/factory.lingo b/engines/director/lingo/tests/factory.lingo
index f3fc43b674..045f926e50 100644
--- a/engines/director/lingo/tests/factory.lingo
+++ b/engines/director/lingo/tests/factory.lingo
@@ -94,3 +94,7 @@ Method mAtFrame2 frame, subFrame
macro KillIt2
global KillLoc
set the locH of sprite 3 to KillLoc
+
+on aim2 test
+ put "fallback worked!"
+end
diff --git a/engines/director/lingo/tests/factory2.lingo b/engines/director/lingo/tests/factory2.lingo
index a7b2317e17..0582e82bfc 100644
--- a/engines/director/lingo/tests/factory2.lingo
+++ b/engines/director/lingo/tests/factory2.lingo
@@ -2,3 +2,6 @@ global aim1
AimGun2
aim1(mDispose)
+
+set notAMethod = 0
+aim2(notAMethod)
Commit: d180343a16c660c27e444838d3ee1bb22b1379f3
https://github.com/scummvm/scummvm/commit/d180343a16c660c27e444838d3ee1bb22b1379f3
Author: djsrv (dservilla at gmail.com)
Date: 2020-08-18T15:27:59-04:00
Commit Message:
DIRECTOR: LINGO: Fix varAssign/Fetch type checks
Changed paths:
engines/director/lingo/lingo.cpp
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index e6e05172f9..6fb1244d02 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -1269,11 +1269,6 @@ void Lingo::varAssign(Datum &var, Datum &value, bool global, DatumHash *localvar
localvars = _localvars;
}
- if (var.type != VAR && var.type != FIELDREF) {
- warning("varAssign: assignment to non-variable");
- return;
- }
-
if (var.type == VAR) {
Common::String name = *var.u.s;
@@ -1317,6 +1312,8 @@ void Lingo::varAssign(Datum &var, Datum &value, bool global, DatumHash *localvar
warning("varAssign: Unhandled cast type %d", member->_type);
break;
}
+ } else {
+ warning("varAssign: assignment to non-variable");
}
}
@@ -1326,11 +1323,6 @@ Datum Lingo::varFetch(Datum &var, bool global, DatumHash *localvars, bool silent
}
Datum result;
- result.type = VOID;
- if (var.type != VAR && var.type != FIELDREF) {
- warning("varFetch: fetch from non-variable");
- return result;
- }
if (var.type == VAR) {
Datum d;
@@ -1376,6 +1368,8 @@ Datum Lingo::varFetch(Datum &var, bool global, DatumHash *localvars, bool silent
warning("varFetch: Unhandled cast type %d", member->_type);
break;
}
+ } else {
+ warning("varFetch: fetch from non-variable");
}
return result;
Commit: b19569eb39a43548978a608c9a710800856228b2
https://github.com/scummvm/scummvm/commit/b19569eb39a43548978a608c9a710800856228b2
Author: djsrv (dservilla at gmail.com)
Date: 2020-08-18T15:27:59-04:00
Commit Message:
DIRECTOR: LINGO: Add eval arg to Lingo::pop/peek
Changed paths:
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index cb5a5cc1ca..6f7ca917c3 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -192,23 +192,23 @@ void Lingo::pushVoid() {
push(d);
}
-Datum Lingo::pop(void) {
+Datum Lingo::pop(bool eval) {
assert (_stack.size() != 0);
Datum ret = _stack.back();
_stack.pop_back();
- if (ret.lazy) {
+ if (eval && ret.lazy) {
ret = ret.eval();
}
return ret;
}
-Datum Lingo::peek(uint offset) {
+Datum Lingo::peek(uint offset, bool eval) {
assert (_stack.size() > offset);
Datum ret = _stack[_stack.size() - 1 - offset];
- if (ret.lazy) {
+ if (eval && ret.lazy) {
ret = ret.eval();
}
return ret;
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 8af8bebcfa..8462a81585 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -437,8 +437,8 @@ private:
public:
void push(Datum d);
- Datum pop(void);
- Datum peek(uint offset);
+ Datum pop(bool eval = true);
+ Datum peek(uint offset, bool eval = true);
public:
Common::HashMap<uint32, const char *> _eventHandlerTypes;
Commit: cd91e0fc2a73b8e7b46e6fa4866225eb62158ad8
https://github.com/scummvm/scummvm/commit/cd91e0fc2a73b8e7b46e6fa4866225eb62158ad8
Author: djsrv (dservilla at gmail.com)
Date: 2020-08-18T15:31:53-04:00
Commit Message:
DIRECTOR: LINGO: Push lazy var in cb_objectpush
Changed paths:
engines/director/lingo/lingo-bytecode.cpp
diff --git a/engines/director/lingo/lingo-bytecode.cpp b/engines/director/lingo/lingo-bytecode.cpp
index 8129a9d4b9..5803c4c07d 100644
--- a/engines/director/lingo/lingo-bytecode.cpp
+++ b/engines/director/lingo/lingo-bytecode.cpp
@@ -358,9 +358,10 @@ void LC::cb_localcall() {
void LC::cb_objectcall() {
g_lingo->readInt();
- Datum d = g_lingo->pop();
+ Datum d = g_lingo->pop(false);
Datum nargs = g_lingo->pop();
+ Common::String name;
if (d.type == INT) {
if (g_lingo->_callstack.empty()) {
warning("cb_objectcall: no call frame");
@@ -368,21 +369,18 @@ void LC::cb_objectcall() {
}
Common::Array<Common::String> *varNames = g_lingo->_callstack.back()->sp.varNames;
if ((d.asInt() % 6 == 0) && varNames && (d.asInt() / 6 < (int)varNames->size())) {
- d = (*varNames)[d.asInt() / 6];
- d.type = SYMBOL;
+ name = (*varNames)[d.asInt() / 6];
} else {
warning("cb_objectcall: invalid variable ID %d", d.asInt());
return;
}
- }
-
- if (d.type != SYMBOL) {
- warning("cb_objectcall: first arg should be of type SYMBOL or INT, not %s", d.type2str());
+ } else if (d.type == VAR) {
+ name = *d.u.s;
+ } else {
+ warning("cb_objectcall: first arg should be of type VAR or INT, not %s", d.type2str());
return;
}
- Common::String name = d.asString();
-
if ((nargs.type != ARGC) && (nargs.type != ARGCNORET)) {
warning("cb_objectcall: second arg should be of type ARGC or ARGCNORET, not %s", nargs.type2str());
return;
@@ -416,9 +414,6 @@ void LC::cb_v4assign() {
// put value after chunkExpression
{
Datum chunkExpr = g_lingo->pop();
- if (chunkExpr.type == SYMBOL) {
- chunkExpr.type = VAR;
- }
g_lingo->push(chunkExpr);
LC::c_putafter();
}
@@ -546,7 +541,8 @@ void LC::cb_objectpush() {
int nameId = g_lingo->readInt();
Common::String name = g_lingo->_currentArchive->getName(nameId);
Datum result(name);
- result.type = SYMBOL;
+ result.type = VAR;
+ result.lazy = true;
g_lingo->push(result);
}
Commit: 191ab2da4ea844c0cd6e654ae925358e79978a87
https://github.com/scummvm/scummvm/commit/191ab2da4ea844c0cd6e654ae925358e79978a87
Author: djsrv (dservilla at gmail.com)
Date: 2020-08-18T15:53:45-04:00
Commit Message:
DIRECTOR: LINGO: Fix cb_objectcall lazy vars
Only the first arg is treated as a lazy var.
Changed paths:
engines/director/lingo/lingo-bytecode.cpp
diff --git a/engines/director/lingo/lingo-bytecode.cpp b/engines/director/lingo/lingo-bytecode.cpp
index 5803c4c07d..8676cb95a8 100644
--- a/engines/director/lingo/lingo-bytecode.cpp
+++ b/engines/director/lingo/lingo-bytecode.cpp
@@ -386,12 +386,12 @@ void LC::cb_objectcall() {
return;
}
- for (int i = 0; i < nargs.u.i; i++) {
- Datum &arg = g_lingo->_stack[g_lingo->_stack.size() - nargs.u.i + i];
- // symbols that are sent to here are actually variable names
- if (arg.type == SYMBOL) {
- arg.type = VAR;
- arg.lazy = true; // var will be evaluated on pop
+ if (nargs.u.i > 0) {
+ Datum &firstArg = g_lingo->_stack[g_lingo->_stack.size() - nargs.u.i];
+ // The first arg could be either a method name or a variable name
+ if (firstArg.type == SYMBOL) {
+ firstArg.type = VAR;
+ firstArg.lazy = true; // var will be evaluated on pop
}
}
More information about the Scummvm-git-logs
mailing list