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

moralrecordings code at moral.net.au
Sat Jan 18 06:15:16 UTC 2020


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

Summary:
c07ff2e5f0 DIRECTOR: LINGO: Add more bytecode stubs


Commit: c07ff2e5f06359e1532ebef17a71ad130adb1bd1
    https://github.com/scummvm/scummvm/commit/c07ff2e5f06359e1532ebef17a71ad130adb1bd1
Author: Scott Percival (code at moral.net.au)
Date: 2020-01-18T14:12:56+08:00

Commit Message:
DIRECTOR: LINGO: Add more bytecode stubs

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


diff --git a/engines/director/lingo/lingo-bytecode.cpp b/engines/director/lingo/lingo-bytecode.cpp
index cbd2d72..4654ed3 100644
--- a/engines/director/lingo/lingo-bytecode.cpp
+++ b/engines/director/lingo/lingo-bytecode.cpp
@@ -60,24 +60,33 @@ static LingoV4Bytecode lingoV4[] = {
 	{ 0x1b, LC::cb_field,		"" },
 	{ 0x1c, LC::c_tell,			"" },
 	{ 0x1d, LC::c_telldone,		"" },
+	{ 0x1e, LC::cb_array,		"" },
 	{ 0x41, LC::c_intpush,		"b" },
-	{ 0x42, LC::c_argcpush,		"b" },
-	{ 0x43, LC::c_argcnoretpush,"b" },
+	{ 0x42, LC::c_argcnoretpush,"b" },
+	{ 0x43, LC::c_argcpush,		"b" },
 	// 0x44, push a constant
 	{ 0x45, LC::c_namepush,		"b" },
+	{ 0x49, LC::cb_globalpush,	"b" },
+	{ 0x4c, LC::cb_varpush,		"b" },
+	{ 0x4f, LC::cb_globalassign,"b" },
+	{ 0x52, LC::cb_varassign,	"b" },
 	{ 0x53, LC::c_jump,			"jb" },
 	{ 0x54, LC::c_jump,			"jbn" },
 	{ 0x55, LC::c_jumpifz,		"jb" },
 	{ 0x56, LC::cb_localcall,	"b" },
 	{ 0x57, LC::cb_call,		"b" },
-	{ 0x59, LC::cb_v4putvalue,	"b" },
+	{ 0x59, LC::cb_v4assign,	"b" },
 	{ 0x5c, LC::cb_v4theentitypush, "b" },
 	{ 0x5d, LC::cb_v4theentityassign, "b" },
 	{ 0x66, LC::cb_v4theentitynamepush, "b" },
 	{ 0x81, LC::c_intpush,		"w" },
-	{ 0x82, LC::c_argcpush,		"w" },
-	{ 0x83, LC::c_argcnoretpush,"w" },
+	{ 0x82, LC::c_argcnoretpush,"w" },
+	{ 0x83, LC::c_argcpush,		"w" },
 	// 0x84, push a constant
+	{ 0x89, LC::cb_globalpush,	"w" },
+	{ 0x8c, LC::cb_varpush,		"w" },
+	{ 0x8f, LC::cb_globalassign,"w" },
+	{ 0x92, LC::cb_varassign,	"w" },
 	{ 0x93, LC::c_jump,			"jw" },
 	{ 0x94, LC::c_jump,			"jwn" },
 	{ 0x95, LC::c_jumpifz,		"jw" },
@@ -111,7 +120,7 @@ static LingoV4TheEntity lingoV4TheEntity[] = {
 	{ 0x03, 0x02, kTheMenuItem,			kTheCheckMark,		true, kTEAMenuIdItemId },
 	{ 0x03, 0x03, kTheMenuItem,			kTheEnabled,		true, kTEAMenuIdItemId },
 	{ 0x03, 0x04, kTheMenuItem,			kTheScript,			true, kTEAMenuIdItemId },
-	{ 0x04, 0x01, kTheSound,			kTheVolume,			true, kTEAItemId },
+	{ 0x04, 0x01, kTheSoundEntity,		kTheVolume,			true, kTEAItemId },
 	{ 0x06, 0x01, kTheSprite,			kTheCursor,			true, kTEAItemId },
 	{ 0x06, 0x02, kTheSprite,			kTheBackColor,		true, kTEAItemId },
 	{ 0x06, 0x03, kTheSprite,			kTheBottom,			true, kTEAItemId },
@@ -221,7 +230,7 @@ void LC::cb_localcall() {
 	if ((nargs.type == ARGC) || (nargs.type == ARGCNORET)) {
 		Symbol *sym = g_lingo->_currentScriptContext->functions[functionId];
 		if (debugChannelSet(3, kDebugLingoExec))
-			g_lingo->printSTUBWithArglist(sym->name.c_str(), nargs.u.i, "call:");
+			g_lingo->printSTUBWithArglist(sym->name.c_str(), nargs.u.i, "localcall:");
 
 		LC::call(sym, nargs.u.i);
 
@@ -232,7 +241,7 @@ void LC::cb_localcall() {
 }
 
 
-void LC::cb_v4putvalue() {
+void LC::cb_v4assign() {
 	int op = g_lingo->readInt();
 
 	switch (op) {
@@ -250,6 +259,23 @@ void LC::cb_v4putvalue() {
 }
 
 
+void LC::cb_array() {
+	Datum nargs = g_lingo->pop();
+	if ((nargs.type == ARGC) || (nargs.type == ARGCNORET)) {
+		Datum result;
+		warning("STUB: cb_array()");
+
+		for (int i = 0; i < nargs.u.i; i++)
+			g_lingo->pop();
+
+		result.type = VOID;
+		g_lingo->push(result);
+	} else {
+		warning("cb_array: first arg should be of type ARGC or ARGCNORET, not %s", nargs.type2str());
+	}
+}
+
+
 void LC::cb_call() {
 	int nameId = g_lingo->readInt();
 	Common::String name = g_lingo->_namelist[nameId];
@@ -265,6 +291,74 @@ void LC::cb_call() {
 }
 
 
+void LC::cb_globalpush() {
+	int nameId = g_lingo->readInt();
+	Common::String name = g_lingo->_namelist[nameId];
+
+	Symbol *s = g_lingo->lookupVar(name.c_str(), false);
+	if (!s) {
+		warning("Global %s not found", name.c_str());
+	} else if (s && !s->global) {
+		warning("Variable %s is local, not global", name.c_str());
+	}
+
+	Datum result;
+	result.type = VOID;
+	warning("STUB: cb_globalpush %s", name.c_str());
+	g_lingo->push(result);
+}
+
+
+void LC::cb_globalassign() {
+	int nameId = g_lingo->readInt();
+	Common::String name = g_lingo->_namelist[nameId];
+
+	Symbol *s = g_lingo->lookupVar(name.c_str(), false);
+	if (!s) {
+		warning("Global %s not found", name.c_str());
+	} else if (s && !s->global) {
+		warning("Variable %s is local, not global", name.c_str());
+	}
+
+	warning("STUB: cb_globalassign %s", name.c_str());
+	g_lingo->pop();
+}
+
+
+void LC::cb_varpush() {
+	int nameId = g_lingo->readInt();
+	Common::String name = g_lingo->_namelist[nameId];
+
+	Symbol *s = g_lingo->lookupVar(name.c_str(), false);
+	if (!s) {
+		warning("Variable %s not found", name.c_str());
+	} else if (s && s->global) {
+		warning("Variable %s is global, not local", name.c_str());
+	}
+
+	Datum result;
+	result.type = VOID;
+	warning("STUB: cb_varpush %s", name.c_str());
+	g_lingo->push(result);
+}
+
+
+void LC::cb_varassign() {
+	int nameId = g_lingo->readInt();
+	Common::String name = g_lingo->_namelist[nameId];
+
+	Symbol *s = g_lingo->lookupVar(name.c_str(), false);
+	if (!s) {
+		warning("Variable %s not found", name.c_str());
+	} else if (s && s->global) {
+		warning("Variable %s is global, not local", name.c_str());
+	}
+
+	warning("STUB: cb_varassign %s", name.c_str());
+	g_lingo->pop();
+}
+
+
 void LC::cb_v4theentitypush() {
 	int bank = g_lingo->readInt();
 
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 84046d4..0cd0c56 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -136,13 +136,18 @@ static struct FuncDescr {
 	{ LC::c_wordOf,			"c_wordOf",			"" },	// D3
 	{ LC::c_wordToOf,		"c_wordToOf",		"" },	// D3
 	{ LC::c_xpop,			"c_xpop",			""  },
+	{ LC::cb_array,			"cb_array",			"" },
 	{ LC::cb_call,			"cb_call",			"i" },
 	{ LC::cb_field,			"cb_field",			"" },
+	{ LC::cb_globalassign,	"cb_globalassign",	"i" },
+	{ LC::cb_globalpush,	"cb_globalpush",	"i" },
 	{ LC::cb_localcall,		"cb_localcall",		"i" },
 	{ LC::cb_unk,			"cb_unk",			"i" },
 	{ LC::cb_unk1,			"cb_unk1",			"ii" },
 	{ LC::cb_unk2,			"cb_unk2",			"iii" },
-	{ LC::cb_v4putvalue,	"cb_putvalue",		"i" },
+	{ LC::cb_varassign,		"cb_varassign",		"i" },
+	{ LC::cb_varpush,		"cb_varpush",		"i" },
+	{ LC::cb_v4assign,		"cb_v4assign",		"i" },
 	{ LC::cb_v4theentitypush,"cb_v4theentitypush","i" },
 	{ LC::cb_v4theentitynamepush,"cb_v4theentitynamepush","i" },
 	{ LC::cb_v4theentityassign,"cb_v4theentityassign","i" },
diff --git a/engines/director/lingo/lingo-code.h b/engines/director/lingo/lingo-code.h
index 329145b..654f7bd 100644
--- a/engines/director/lingo/lingo-code.h
+++ b/engines/director/lingo/lingo-code.h
@@ -129,10 +129,15 @@ namespace LC {
 	void cb_unk2();
 
 	// bytecode-related instructions
-	void cb_localcall();
+	void cb_array();
 	void cb_call();
 	void cb_field();
-	void cb_v4putvalue();
+	void cb_globalassign();
+	void cb_globalpush();
+	void cb_localcall();
+	void cb_varassign();
+	void cb_varpush();
+	void cb_v4assign();
 	void cb_v4theentitypush();
 	void cb_v4theentitynamepush();
 	void cb_v4theentityassign();




More information about the Scummvm-git-logs mailing list