[Scummvm-git-logs] scummvm master -> 357550820f576b8ab235cd93c779a4485c941072

moralrecordings code at moral.net.au
Fri Jun 19 16:22:21 UTC 2020


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
be2f5815a9 DIRECTOR: LINGO: Fix stack after failed cb_objectcall
8135a3a1cc DIRECTOR: LINGO: Tweak cb_objectcall to substitute variables
357550820f DIRECTOR: LINGO: Fix LUT codes for text entities


Commit: be2f5815a94bc12bb2965c4a13d3d756ac7830d0
    https://github.com/scummvm/scummvm/commit/be2f5815a94bc12bb2965c4a13d3d756ac7830d0
Author: Scott Percival (code at moral.net.au)
Date: 2020-06-20T00:22:03+08:00

Commit Message:
DIRECTOR: LINGO: Fix stack after failed cb_objectcall

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 eb500d411b..63369b0253 100644
--- a/engines/director/lingo/lingo-bytecode.cpp
+++ b/engines/director/lingo/lingo-bytecode.cpp
@@ -345,6 +345,13 @@ void LC::cb_objectcall() {
 			LC::call(func, nargs.u.i);
 		} else {
 			warning("cb_objectcall: could not find object or function with name %s", object.u.s->c_str());
+			for (int i = 0; i < nargs.u.i; i++) {
+				g_lingo->pop();
+			}
+			// Push a VOID to the stack if function is supposed to return
+			if (nargs.type == ARGC)
+				g_lingo->push(Datum());
+
 		}
 	}
 }


Commit: 8135a3a1cc7d8705f67141a1384452632a805ea0
    https://github.com/scummvm/scummvm/commit/8135a3a1cc7d8705f67141a1384452632a805ea0
Author: Scott Percival (code at moral.net.au)
Date: 2020-06-20T00:22:03+08:00

Commit Message:
DIRECTOR: LINGO: Tweak cb_objectcall to substitute variables

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 63369b0253..4b91685ca6 100644
--- a/engines/director/lingo/lingo-bytecode.cpp
+++ b/engines/director/lingo/lingo-bytecode.cpp
@@ -320,19 +320,35 @@ void LC::cb_objectcall() {
 		object.type = VAR;
 		Datum target = g_lingo->varFetch(object);
 
+		StackData args;
 		if (target.type == OBJECT) {
-			StackData args;
-			for (int i = 0; i < nargs.u.i - 1; i++) {
-				args.push_back(g_lingo->pop());
+			// last arg on the stack is the method name
+			nargs.u.i -= 1;
+		}
+
+		for (int i = 0; i < nargs.u.i; i++) {
+			Datum arg = g_lingo->pop();
+			// for some reason, strings that are sent to here are actually variable names???
+			// other constants (e.g. ints) are fine.
+			if (arg.type == STRING) {
+				Datum varTest(arg);
+				varTest.type = VAR;
+				varTest = g_lingo->varFetch(varTest);
+				if (varTest.type != VOID)
+					arg = varTest;
 			}
+			args.push_back(arg);
+		}
+
+		if (target.type == OBJECT) {
 			Datum methodName = g_lingo->pop();
 			Symbol method = target.u.obj->getMethod(methodName.asString());
 			if (method.type != VOID) {
-				for (int i = 0; i < nargs.u.i - 1; i++) {
+				for (int i = 0; i < nargs.u.i; i++) {
 					g_lingo->push(args.back());
 					args.pop_back();
 				}
-				LC::call(method, nargs.u.i - 1);
+				LC::call(method, nargs.u.i);
 			} else {
 				warning("cb_objectcall: object %s has no method named %s", object.u.s->c_str(), methodName.asString().c_str());
 			}
@@ -342,12 +358,14 @@ void LC::cb_objectcall() {
 		// if there's nothing, try calling a function with that name
 		Symbol func = g_lingo->getHandler(*object.u.s);
 		if (func.type != VOID) {
+			for (int i = 0; i < nargs.u.i; i++) {
+				g_lingo->push(args.back());
+				args.pop_back();
+			}
+
 			LC::call(func, nargs.u.i);
 		} else {
 			warning("cb_objectcall: could not find object or function with name %s", object.u.s->c_str());
-			for (int i = 0; i < nargs.u.i; i++) {
-				g_lingo->pop();
-			}
 			// Push a VOID to the stack if function is supposed to return
 			if (nargs.type == ARGC)
 				g_lingo->push(Datum());


Commit: 357550820f576b8ab235cd93c779a4485c941072
    https://github.com/scummvm/scummvm/commit/357550820f576b8ab235cd93c779a4485c941072
Author: Scott Percival (code at moral.net.au)
Date: 2020-06-20T00:22:03+08:00

Commit Message:
DIRECTOR: LINGO: Fix LUT codes for text entities

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 4b91685ca6..5603361486 100644
--- a/engines/director/lingo/lingo-bytecode.cpp
+++ b/engines/director/lingo/lingo-bytecode.cpp
@@ -217,11 +217,11 @@ static LingoV4TheEntity lingoV4TheEntity[] = {
 	{ 0x09, 0x0b, kTheCast,				kTheSize,			true, kTEAItemId },
 	{ 0x09, 0x11, kTheCast,				kTheForeColor,		true, kTEAItemId },
 	{ 0x09, 0x12, kTheCast,				kTheBackColor,		true, kTEAItemId },
-	{ 0x0c, 0x03, kTheField,			kTheTextStyle,		true, kTEAItemId },
-	{ 0x0c, 0x04, kTheField,			kTheTextFont,		true, kTEAItemId },
-	{ 0x0c, 0x05, kTheField,			kTheTextHeight,		true, kTEAItemId },
-	{ 0x0c, 0x06, kTheField,			kTheTextAlign,		true, kTEAItemId },
-	{ 0x0c, 0x07, kTheField,			kTheTextSize,		true, kTEAItemId },
+	{ 0x0b, 0x03, kTheField,			kTheTextStyle,		true, kTEAItemId },
+	{ 0x0b, 0x04, kTheField,			kTheTextFont,		true, kTEAItemId },
+	{ 0x0b, 0x05, kTheField,			kTheTextHeight,		true, kTEAItemId },
+	{ 0x0b, 0x06, kTheField,			kTheTextAlign,		true, kTEAItemId },
+	{ 0x0b, 0x07, kTheField,			kTheTextSize,		true, kTEAItemId },
 	{ 0x0d, 0x0f, kTheCast,				kTheDirectToStage,	true, kTEAItemId },
 	{ 0x0d, 0x10, kTheCast,				kTheSound,			true, kTEAItemId },
 	{ 0xff, 0, 0, 0, false, kTEANOArgs }




More information about the Scummvm-git-logs mailing list