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

moralrecordings code at moral.net.au
Thu Feb 6 11:45:19 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:
00a59570be DIRECTOR: LINGO: Implement c_before and c_after
e82e8f663c DIRECTOR: Load script context/names from shared archive


Commit: 00a59570beca96fbc1f34e6549bbc2343f800440
    https://github.com/scummvm/scummvm/commit/00a59570beca96fbc1f34e6549bbc2343f800440
Author: Scott Percival (code at moral.net.au)
Date: 2020-02-06T19:41:46+08:00

Commit Message:
DIRECTOR: LINGO: Implement c_before and c_after

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


diff --git a/engines/director/lingo/lingo-bytecode.cpp b/engines/director/lingo/lingo-bytecode.cpp
index e27d093..0e1b704 100644
--- a/engines/director/lingo/lingo-bytecode.cpp
+++ b/engines/director/lingo/lingo-bytecode.cpp
@@ -259,6 +259,28 @@ void LC::cb_v4assign() {
 			LC::c_assign();
 		}
 		break;
+	case 0x26:
+		// put value after field textVar
+		{
+			LB::b_field(1);
+			Datum field = g_lingo->pop();
+			g_lingo->push(field);
+			LC::c_after();
+			g_lingo->push(field);
+			LC::c_assign();
+		}
+		break;
+	case 0x36:
+		// put value before field textVar
+		{
+			LB::b_field(1);
+			Datum field = g_lingo->pop();
+			g_lingo->push(field);
+			LC::c_before();
+			g_lingo->push(field);
+			LC::c_assign();
+		}
+		break;
 	default:
 		warning("cb_v4assign: unknown operator %d", op);
 		break;
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 33b3016..50a6fdf 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -566,17 +566,7 @@ void LC::c_ampersand() {
 }
 
 void LC::c_after() {
-	Datum d2 = g_lingo->pop();
-	Datum d1 = g_lingo->pop();
-
-	d1.toString();
-	d2.toString();
-
-	warning("STUB: c_after");
-
-	delete d2.u.s;
-
-	g_lingo->push(d1);
+	LC::c_ampersand();
 }
 
 void LC::c_before() {
@@ -586,7 +576,7 @@ void LC::c_before() {
 	d1.toString();
 	d2.toString();
 
-	warning("STUB: c_before");
+	*d1.u.s = *d2.u.s + *d1.u.s;
 
 	delete d2.u.s;
 


Commit: e82e8f663c4a377d00913cb434ce6589e68b2e15
    https://github.com/scummvm/scummvm/commit/e82e8f663c4a377d00913cb434ce6589e68b2e15
Author: Scott Percival (code at moral.net.au)
Date: 2020-02-06T19:41:46+08:00

Commit Message:
DIRECTOR: Load script context/names from shared archive

Changed paths:
    engines/director/resource.cpp
    engines/director/score.h


diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp
index ad3537a..881cd08 100644
--- a/engines/director/resource.cpp
+++ b/engines/director/resource.cpp
@@ -285,17 +285,17 @@ void DirectorEngine::loadSharedCastsFrom(Common::String filename) {
 
 	clearSharedCast();
 
-	Archive *shardcst = createArchive();
+	Archive *sharedCast = createArchive();
 
 	_sharedDIB = new Common::HashMap<int, Common::SeekableSubReadStreamEndian *>;
 	_sharedSTXT = new Common::HashMap<int, Common::SeekableSubReadStreamEndian *>;
 	_sharedSound = new Common::HashMap<int, Common::SeekableSubReadStreamEndian *>;
 	_sharedBMP = new Common::HashMap<int, Common::SeekableSubReadStreamEndian *>;
 
-	if (!shardcst->openFile(filename)) {
+	if (!sharedCast->openFile(filename)) {
 		warning("No shared cast %s", filename.c_str());
 
-		delete shardcst;
+		delete sharedCast;
 
 		return;
 	}
@@ -305,76 +305,105 @@ void DirectorEngine::loadSharedCastsFrom(Common::String filename) {
 	debug(0, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
 
 	_sharedScore = new Score(this);
-	_sharedScore->setArchive(shardcst);
+	_sharedScore->setArchive(sharedCast);
 
-	if (shardcst->hasResource(MKTAG('F', 'O', 'N', 'D'), -1)) {
+	if (sharedCast->hasResource(MKTAG('F', 'O', 'N', 'D'), -1)) {
 		debug("Shared cast has fonts. Loading....");
 
 		_wm->_fontMan->loadFonts(filename);
 	}
 
-	_sharedScore->loadConfig(*shardcst->getResource(MKTAG('V','W','C','F'), 1024));
+	_sharedScore->loadConfig(*sharedCast->getResource(MKTAG('V','W','C','F'), 1024));
 
 	if (getVersion() < 4) {
-		_sharedScore->_castIDoffset = shardcst->getResourceIDList(MKTAG('V', 'W', 'C', 'R'))[0];
-		_sharedScore->loadCastDataVWCR(*shardcst->getResource(MKTAG('V','W','C','R'), _sharedScore->_castIDoffset));
+		_sharedScore->_castIDoffset = sharedCast->getResourceIDList(MKTAG('V', 'W', 'C', 'R'))[0];
+		_sharedScore->loadCastDataVWCR(*sharedCast->getResource(MKTAG('V','W','C','R'), _sharedScore->_castIDoffset));
 	}
 
-	Common::Array<uint16> cast = shardcst->getResourceIDList(MKTAG('C','A','S','t'));
-	if (cast.size() > 0) {
-		debug(0, "****** Loading %d CASt resources", cast.size());
+	// Try to load script context
+	if (getVersion() >= 4) {
+		Common::Array<uint16> lctx = sharedCast->getResourceIDList(MKTAG('L','c','t','x'));
+		if (lctx.size() > 0) {
+			debugC(2, kDebugLoading, "****** Loading %d Lctx resources", lctx.size());
 
-		for (Common::Array<uint16>::iterator iterator = cast.begin(); iterator != cast.end(); ++iterator) {
-			Resource res = shardcst->getResourceDetail(MKTAG('C', 'A', 'S', 't'), *iterator);
-			_sharedScore->loadCastData(*shardcst->getResource(MKTAG('C', 'A', 'S', 't'), *iterator), *iterator, &res);
+			for (Common::Array<uint16>::iterator iterator = lctx.begin(); iterator != lctx.end(); ++iterator) {
+				_sharedScore->loadLingoContext(*sharedCast->getResource(MKTAG('L','c','t','x'), *iterator));
+			}
+		}
+	}
+
+	// Try to load script name lists
+	if (getVersion() >= 4) {
+		Common::Array<uint16> lnam = sharedCast->getResourceIDList(MKTAG('L','n','a','m'));
+		if (lnam.size() > 0) {
+
+			int maxLnam = -1;
+			for (Common::Array<uint16>::iterator iterator = lnam.begin(); iterator != lnam.end(); ++iterator) {
+				maxLnam = MAX(maxLnam, (int)*iterator);
+			}
+			debugC(2, kDebugLoading, "****** Loading Lnam resource with highest ID (%d)", maxLnam);
+			_sharedScore->loadLingoNames(*sharedCast->getResource(MKTAG('L','n','a','m'), maxLnam));
 		}
 	}
 
-	Common::Array<uint16> vwci = shardcst->getResourceIDList(MKTAG('V', 'W', 'C', 'I'));
+	Common::Array<uint16> vwci = sharedCast->getResourceIDList(MKTAG('V', 'W', 'C', 'I'));
 	if (vwci.size() > 0) {
 		debug(0, "****** Loading %d CastInfo resources", vwci.size());
 
 		for (Common::Array<uint16>::iterator iterator = vwci.begin(); iterator != vwci.end(); ++iterator)
-			_sharedScore->loadCastInfo(*shardcst->getResource(MKTAG('V', 'W', 'C', 'I'), *iterator), *iterator);
+			_sharedScore->loadCastInfo(*sharedCast->getResource(MKTAG('V', 'W', 'C', 'I'), *iterator), *iterator);
+	}
+
+	Common::Array<uint16> cast = sharedCast->getResourceIDList(MKTAG('C','A','S','t'));
+	if (!_sharedScore->_loadedCast)
+		_sharedScore->_loadedCast = new Common::HashMap<int, Cast *>();
+
+	if (cast.size() > 0) {
+		debug(0, "****** Loading %d CASt resources", cast.size());
+
+		for (Common::Array<uint16>::iterator iterator = cast.begin(); iterator != cast.end(); ++iterator) {
+			Resource res = sharedCast->getResourceDetail(MKTAG('C', 'A', 'S', 't'), *iterator);
+			_sharedScore->loadCastData(*sharedCast->getResource(MKTAG('C', 'A', 'S', 't'), *iterator), *iterator, &res);
+		}
 	}
 
 	_sharedScore->setSpriteCasts();
 
-	Common::Array<uint16> dib = shardcst->getResourceIDList(MKTAG('D','I','B',' '));
+	Common::Array<uint16> dib = sharedCast->getResourceIDList(MKTAG('D','I','B',' '));
 	if (dib.size() != 0) {
 		debugC(3, kDebugLoading, "****** Loading %d DIBs", dib.size());
 
 		for (Common::Array<uint16>::iterator iterator = dib.begin(); iterator != dib.end(); ++iterator) {
 			debugC(3, kDebugLoading, "Shared DIB %d", *iterator);
-			_sharedDIB->setVal(*iterator, shardcst->getResource(MKTAG('D','I','B',' '), *iterator));
+			_sharedDIB->setVal(*iterator, sharedCast->getResource(MKTAG('D','I','B',' '), *iterator));
 		}
 	}
 
-	Common::Array<uint16> stxt = shardcst->getResourceIDList(MKTAG('S','T','X','T'));
+	Common::Array<uint16> stxt = sharedCast->getResourceIDList(MKTAG('S','T','X','T'));
 	if (stxt.size() != 0) {
 		debugC(3, kDebugLoading, "****** Loading %d STXTs", stxt.size());
 
 		for (Common::Array<uint16>::iterator iterator = stxt.begin(); iterator != stxt.end(); ++iterator) {
 			debugC(3, kDebugLoading, "Shared STXT %d", *iterator);
-			_sharedSTXT->setVal(*iterator, shardcst->getResource(MKTAG('S','T','X','T'), *iterator));
+			_sharedSTXT->setVal(*iterator, sharedCast->getResource(MKTAG('S','T','X','T'), *iterator));
 		}
 	}
 
-	Common::Array<uint16> bmp = shardcst->getResourceIDList(MKTAG('B','I','T','D'));
+	Common::Array<uint16> bmp = sharedCast->getResourceIDList(MKTAG('B','I','T','D'));
 	if (bmp.size() != 0) {
 		debugC(3, kDebugLoading, "****** Loading %d BITDs", bmp.size());
 		for (Common::Array<uint16>::iterator iterator = bmp.begin(); iterator != bmp.end(); ++iterator) {
 			debugC(3, kDebugLoading, "Shared BITD %d (%s)", *iterator, numToCastNum(*iterator - 1024));
-			_sharedBMP->setVal(*iterator, shardcst->getResource(MKTAG('B','I','T','D'), *iterator));
+			_sharedBMP->setVal(*iterator, sharedCast->getResource(MKTAG('B','I','T','D'), *iterator));
 		}
 	}
 
-	Common::Array<uint16> sound = shardcst->getResourceIDList(MKTAG('S','N','D',' '));
+	Common::Array<uint16> sound = sharedCast->getResourceIDList(MKTAG('S','N','D',' '));
 	if (sound.size() != 0) {
 		debugC(3, kDebugLoading, "****** Loading %d SNDs", sound.size());
 		for (Common::Array<uint16>::iterator iterator = sound.begin(); iterator != sound.end(); ++iterator) {
 			debugC(3, kDebugLoading, "Shared SND  %d", *iterator);
-			_sharedSound->setVal(*iterator, shardcst->getResource(MKTAG('S','N','D',' '), *iterator));
+			_sharedSound->setVal(*iterator, sharedCast->getResource(MKTAG('S','N','D',' '), *iterator));
 		}
 	}
 
diff --git a/engines/director/score.h b/engines/director/score.h
index d4d402b..f8b7bf3 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -81,6 +81,8 @@ public:
 	void loadCastDataVWCR(Common::SeekableSubReadStreamEndian &stream);
 	void loadCastData(Common::SeekableSubReadStreamEndian &stream, uint16 id, Resource *res);
 	void loadCastInfo(Common::SeekableSubReadStreamEndian &stream, uint16 id);
+	void loadLingoNames(Common::SeekableSubReadStreamEndian &stream);
+	void loadLingoContext(Common::SeekableSubReadStreamEndian &stream);
 	void setCurrentFrame(uint16 frameId) { _nextFrame = frameId; }
 	uint16 getCurrentFrame() { return _currentFrame; }
 	Common::String getMacName() const { return _macName; }
@@ -109,8 +111,6 @@ private:
 	void loadFrames(Common::SeekableSubReadStreamEndian &stream);
 	void loadLabels(Common::SeekableSubReadStreamEndian &stream);
 	void loadActions(Common::SeekableSubReadStreamEndian &stream);
-	void loadLingoNames(Common::SeekableSubReadStreamEndian &stream);
-	void loadLingoContext(Common::SeekableSubReadStreamEndian &stream);
 	void loadScriptText(Common::SeekableSubReadStreamEndian &stream);
 	void loadFileInfo(Common::SeekableSubReadStreamEndian &stream);
 	void loadFontMap(Common::SeekableSubReadStreamEndian &stream);




More information about the Scummvm-git-logs mailing list