[Scummvm-git-logs] scummvm master -> bb8704f7d078417f0efc2993b2e67c81f15bbff3

djsrv dservilla at gmail.com
Tue Jun 23 18:15:03 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:
d8c8df88f3 DIRECTOR: LINGO: Implement cb prop instructions
bb8704f7d0 DIRECTOR: LINGO: Fix cb_localcall


Commit: d8c8df88f3bff9248670d9ec1beb2a8e1404ac5b
    https://github.com/scummvm/scummvm/commit/d8c8df88f3bff9248670d9ec1beb2a8e1404ac5b
Author: djsrv (dservilla at gmail.com)
Date: 2020-06-23T14:14:01-04:00

Commit Message:
DIRECTOR: LINGO: Implement cb prop instructions

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 adee74eeff..47b8b04d03 100644
--- a/engines/director/lingo/lingo-bytecode.cpp
+++ b/engines/director/lingo/lingo-bytecode.cpp
@@ -499,17 +499,14 @@ void LC::cb_objectfieldassign() {
 	Common::String fieldName = g_lingo->getName(fieldNameId);
 	Datum object = g_lingo->pop();
 	Datum value = g_lingo->pop();
-	warning("STUB: cb_objectfieldassign(%s, %s, %s)", object.asString(true).c_str(), fieldName.c_str(), value.asString(true).c_str());
+	g_lingo->setObjectProp(object, fieldName, value);
 }
 
 void LC::cb_objectfieldpush() {
 	int fieldNameId = g_lingo->readInt();
 	Common::String fieldName = g_lingo->getName(fieldNameId);
 	Datum object = g_lingo->pop();
-	warning("STUB: cb_objectfieldpush(%s, %s)", object.asString(true).c_str(), fieldName.c_str());
-	Datum result;
-	result.type = VOID;
-	g_lingo->push(result);
+	g_lingo->push(g_lingo->getObjectProp(object, fieldName));
 }
 
 void LC::cb_objectpush() {
@@ -542,7 +539,15 @@ void LC::cb_theassign() {
 	int nameId = g_lingo->readInt();
 	Common::String name = g_lingo->getName(nameId);
 	Datum value = g_lingo->pop();
-	warning("STUB: cb_theassign(%s, %s)", name.c_str(), value.asString().c_str());
+	if (g_lingo->_currentMe.type == OBJECT) {
+		if (g_lingo->_currentMe.u.obj->hasProp(name)) {
+			g_lingo->_currentMe.u.obj->getProp(name) = value;
+		} else {
+			warning("cb_theassign: me object has no property '%s'", name.c_str());
+		}
+	} else {
+		warning("cb_theassign: no me object");
+	}
 }
 
 void LC::cb_theassign2() {
@@ -555,7 +560,15 @@ void LC::cb_theassign2() {
 void LC::cb_thepush() {
 	int nameId = g_lingo->readInt();
 	Common::String name = g_lingo->getName(nameId);
-	warning("STUB: cb_thepush(%s)", name.c_str());
+	if (g_lingo->_currentMe.type == OBJECT) {
+		if (g_lingo->_currentMe.u.obj->hasProp(name)) {
+			g_lingo->push(g_lingo->_currentMe.u.obj->getProp(name));
+			return;
+		}
+		warning("cb_thepush: me object has no property '%s'", name.c_str());
+	} else {
+		warning("cb_thepush: no me object");
+	}
 	Datum result;
 	result.type = VOID;
 	g_lingo->push(result);


Commit: bb8704f7d078417f0efc2993b2e67c81f15bbff3
    https://github.com/scummvm/scummvm/commit/bb8704f7d078417f0efc2993b2e67c81f15bbff3
Author: djsrv (dservilla at gmail.com)
Date: 2020-06-23T14:14:01-04:00

Commit Message:
DIRECTOR: LINGO: Fix cb_localcall

Which symbol a handler name resolves to depends on the first argument.

Changed paths:
    engines/director/lingo/lingo-bytecode.cpp
    engines/director/lingo/lingo.h


diff --git a/engines/director/lingo/lingo-bytecode.cpp b/engines/director/lingo/lingo-bytecode.cpp
index 47b8b04d03..80fa99a80b 100644
--- a/engines/director/lingo/lingo-bytecode.cpp
+++ b/engines/director/lingo/lingo-bytecode.cpp
@@ -294,11 +294,11 @@ void LC::cb_localcall() {
 
 	Datum nargs = g_lingo->pop();
 	if ((nargs.type == ARGC) || (nargs.type == ARGCNORET)) {
-		Symbol sym = g_lingo->_currentScriptContext->_functions[functionId];
+		Common::String name = g_lingo->_currentScriptContext->_functionNames[functionId];
 		if (debugChannelSet(3, kDebugLingoExec))
-			g_lingo->printSTUBWithArglist(sym.name->c_str(), nargs.u.i, "localcall:");
+			g_lingo->printSTUBWithArglist(name.c_str(), nargs.u.i, "localcall:");
 
-		LC::call(sym, nargs.u.i);
+		LC::call(name, nargs.u.i);
 
 	} else {
 		warning("cb_localcall: first arg should be of type ARGC or ARGCNORET, not %s", nargs.type2str());
@@ -1333,7 +1333,7 @@ void Lingo::addCodeV4(Common::SeekableSubReadStreamEndian &stream, int archiveIn
 			out.writeString(Common::String::format("<end code>\n\n"));
 		}
 
-		_assemblyContext->_functions.push_back(sym);
+		_assemblyContext->_functionNames.push_back(*sym.name);
 		_currentAssembly = nullptr;
 	}
 
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 3fdb8648ec..cda2b856ad 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -219,7 +219,7 @@ class ScriptContext {
 public:
 	ScriptType _type;
 	Common::String _name;
-	Common::Array<Symbol> _functions; // used only by bytecode
+	Common::Array<Common::String> _functionNames; // used by cb_localcall
 	Common::HashMap<uint32, Symbol> _eventHandlers;
 	SymbolHash _functionHandlers;
 	Common::Array<Datum> _constants;




More information about the Scummvm-git-logs mailing list