[Scummvm-git-logs] scummvm master -> 6f79a39f04ddbd9544d49f2fe625a904c11911db

moralrecordings code at moral.net.au
Tue May 5 18:04:11 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:
f5eff07e21 DIRECTOR: LINGO: Implement cb_proplist
48c9251209 DIRECTOR: LINGO: Implement kTheMouseCast
6f79a39f04 DIRECTOR: LINGO: Fix kTheName and kTheScriptText memory management


Commit: f5eff07e218a7c2f295047beb106ff0facf2c419
    https://github.com/scummvm/scummvm/commit/f5eff07e218a7c2f295047beb106ff0facf2c419
Author: Scott Percival (code at moral.net.au)
Date: 2020-05-06T01:16:41+08:00

Commit Message:
DIRECTOR: LINGO: Implement cb_proplist

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


diff --git a/engines/director/lingo/lingo-bytecode.cpp b/engines/director/lingo/lingo-bytecode.cpp
index 843534074f..d85820b9ee 100644
--- a/engines/director/lingo/lingo-bytecode.cpp
+++ b/engines/director/lingo/lingo-bytecode.cpp
@@ -61,6 +61,7 @@ static LingoV4Bytecode lingoV4[] = {
 	{ 0x1c, LC::c_tell,			"" },
 	{ 0x1d, LC::c_telldone,		"" },
 	{ 0x1e, LC::cb_list,		"" },
+	{ 0x1f, LC::cb_proplist,	"" },
 	{ 0x41, LC::c_intpush,		"b" },
 	{ 0x42, LC::c_argcnoretpush,"b" },
 	{ 0x43, LC::c_argcpush,		"b" },
@@ -321,11 +322,36 @@ void LC::cb_v4assign() {
 
 void LC::cb_list() {
 	Datum nargs = g_lingo->pop();
-	if ((nargs.type == ARGC) || (nargs.type == ARGCNORET)) {
-		LB::b_list(nargs.u.i);
-	} else {
-		warning("cb_list: first arg should be of type ARGC or ARGCNORET, not %s", nargs.type2str());
+	if ((nargs.type != ARGC) && (nargs.type != ARGCNORET)) {
+		error("cb_list: first arg should be of type ARGC or ARGCNORET, not %s", nargs.type2str());
+	}
+	LB::b_list(nargs.u.i);
+}
+
+
+void LC::cb_proplist() {
+	Datum list = g_lingo->pop();
+	if (list.type != ARRAY) {
+		error("cb_proplist: first arg should be of type ARRAY, not %s", list.type2str());
 	}
+	Datum result;
+	result.type = PARRAY;
+	result.u.parr = new PropertyArray;
+	uint arraySize = list.u.farr->size();
+	if (arraySize % 2) {
+		warning("cb_proplist: list should have an even number of entries, ignoring the last one");
+	}
+	arraySize /= 2;
+
+	for (uint i = 0; i < arraySize; i += 1) {
+		Datum p = list.u.farr->operator[](i);
+		Datum v = list.u.farr->operator[](i + 1);
+
+		PCell cell = PCell(p, v);
+		result.u.parr->insert_at(0, cell);
+	};
+
+	g_lingo->push(result);
 }
 
 
diff --git a/engines/director/lingo/lingo-code.h b/engines/director/lingo/lingo-code.h
index a87846d6b1..6a5789e51d 100644
--- a/engines/director/lingo/lingo-code.h
+++ b/engines/director/lingo/lingo-code.h
@@ -153,6 +153,7 @@ namespace LC {
 	void cb_localcall();
 	void cb_methodcall();
 	void cb_objectpush();
+	void cb_proplist();
 	void cb_stackpeek();
 	void cb_stackdrop();
 	void cb_varassign();


Commit: 48c925120981015fa797852ebc78a0e18f0d97cd
    https://github.com/scummvm/scummvm/commit/48c925120981015fa797852ebc78a0e18f0d97cd
Author: Scott Percival (code at moral.net.au)
Date: 2020-05-06T01:32:17+08:00

Commit Message:
DIRECTOR: LINGO: Implement kTheMouseCast

Changed paths:
    engines/director/lingo/lingo-the.cpp


diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index ebc292b842..cc884c10f8 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -25,6 +25,7 @@
 
 #include "director/director.h"
 #include "director/cast.h"
+#include "director/frame.h"
 #include "director/sprite.h"
 #include "director/score.h"
 #include "director/lingo/lingo.h"
@@ -407,6 +408,16 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
 		d.type = INT;
 		d.u.i = g_system->getEventManager()->getMousePos().y;
 		break;
+	case kTheMouseCast:
+		{
+			Common::Point pos = g_system->getEventManager()->getMousePos();
+			Score *sc = _vm->getCurrentScore();
+			Frame *currentFrame = sc->_frames[sc->getCurrentFrame()];
+			uint16 spriteId = currentFrame->getSpriteIDFromPos(pos);
+			d.type = INT;
+			d.u.i = currentFrame->_sprites[spriteId]->_castId;
+		}
+		break;
 	case kThePerFrameHook:
 		warning("STUB: Lingo::getTheEntity(): getting the perframehook");
 		break;
@@ -425,7 +436,7 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
 	case kTheStillDown:
 		d.type = INT;
 		d.u.i = _vm->getCurrentScore()->_mouseIsDown;
-    break;
+		break;
 	case kTheLastFrame:
 		d.type = INT;
 		d.u.i = _vm->getCurrentScore()->_frames.size() - 1;
@@ -684,8 +695,8 @@ void Lingo::setTheSprite(Datum &id1, int field, Datum &d) {
 		break;
 	case kTheMoveableSprite:
 		sprite->_moveable = d.u.i;
-    if (!d.u.i)
-      sprite->_currentPoint = sprite->_startPoint;
+		if (!d.u.i)
+			sprite->_currentPoint = sprite->_startPoint;
 		break;
 	case kTheMovieRate:
 		sprite->_movieRate = d.u.i;


Commit: 6f79a39f04ddbd9544d49f2fe625a904c11911db
    https://github.com/scummvm/scummvm/commit/6f79a39f04ddbd9544d49f2fe625a904c11911db
Author: Scott Percival (code at moral.net.au)
Date: 2020-05-06T02:02:20+08:00

Commit Message:
DIRECTOR: LINGO: Fix kTheName and kTheScriptText memory management

Changed paths:
    engines/director/lingo/lingo-the.cpp


diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index cc884c10f8..b55910787b 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -818,12 +818,12 @@ Datum Lingo::getTheCast(Datum &id1, int field) {
 		d.u.i = 1; //Not loaded handled above
 		break;
 	case kTheName:
-		d.makeString();
-		d.u.s = &castInfo->name;
+		d.type = STRING;
+		d.u.s = new Common::String(castInfo->name.c_str());
 		break;
 	case kTheScriptText:
-		d.makeString();
-		d.u.s = &castInfo->script;
+		d.type = STRING;
+		d.u.s = new Common::String(castInfo->script.c_str());
 		break;
 	case kTheText:
 		d.makeString();




More information about the Scummvm-git-logs mailing list