[Scummvm-git-logs] scummvm master -> 34eb65410638c7d62608f8cc05e71956aca5b6af

djsrv dservilla at gmail.com
Thu Jun 11 17:01:56 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:
34eb654106 DIRECTOR: LINGO: Keep shared cast scripts on goto


Commit: 34eb65410638c7d62608f8cc05e71956aca5b6af
    https://github.com/scummvm/scummvm/commit/34eb65410638c7d62608f8cc05e71956aca5b6af
Author: djsrv (dservilla at gmail.com)
Date: 2020-06-11T13:01:37-04:00

Commit Message:
DIRECTOR: LINGO: Keep shared cast scripts on goto

Shared casts' handlers should only be removed when switching to a movie
in a different directory.

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


diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 46ed11ac12..134fd563ea 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -258,8 +258,6 @@ Common::Error DirectorEngine::run() {
 
 		// If a loop was requested, do it
 		if (!_nextMovie.movie.empty()) {
-			_lingo->restartLingo();
-
 			// Persist screen between the movies
 			// TODO: this is a workaround until the rendering pipeline is reworked
 			if (_currentScore && _currentScore->_surface) {
@@ -273,7 +271,13 @@ Common::Error DirectorEngine::run() {
 
 			_currentPath = getPath(_nextMovie.movie, _currentPath);
 
-			loadSharedCastsFrom(_currentPath + _sharedCastFile);
+			if (_sharedScore && _sharedScore->_movieArchive
+					&& _sharedScore->_movieArchive->getFileName().equalsIgnoreCase(_currentPath + _sharedCastFile)) {
+				_lingo->restartLingo(true);
+			} else {
+				_lingo->restartLingo(false);
+				loadSharedCastsFrom(_currentPath + _sharedCastFile);
+			}
 
 			Archive *mov = openMainArchive(_currentPath + Common::lastPathComponent(_nextMovie.movie, '/'));
 
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index aa20cd3c89..971d93e083 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -617,10 +617,13 @@ void Lingo::executeHandler(Common::String name) {
 	execute(_pc);
 }
 
-void Lingo::restartLingo() {
+void Lingo::restartLingo(bool keepSharedCast) {
 	debugC(3, kDebugLingoExec, "Resetting Lingo!");
 
 	for (int a = 0; a < 2; a++) {
+		if (a == 1 && keepSharedCast)
+			continue;
+
 		LingoArchive *arch = &_archives[a];
 		for (int i = 0; i <= kMaxScriptType; i++) {
 			for (ScriptContextHash::iterator it = arch->scriptContexts[i].begin(); it != arch->scriptContexts[i].end(); ++it) {
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 15477ea2bb..0eac41da15 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -314,7 +314,7 @@ public:
 	Lingo(DirectorEngine *vm);
 	~Lingo();
 
-	void restartLingo();
+	void restartLingo(bool keepSharedCast);
 
 	void addCode(const char *code, ScriptType type, uint16 id);
 	void addCodeV4(Common::SeekableSubReadStreamEndian &stream, ScriptType type, uint16 id, Common::String &archName);
diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp
index 16d279408d..f1f7ea65d7 100644
--- a/engines/director/resource.cpp
+++ b/engines/director/resource.cpp
@@ -276,11 +276,6 @@ void DirectorEngine::clearSharedCast() {
 }
 
 void DirectorEngine::loadSharedCastsFrom(Common::String filename) {
-	if (_sharedScore && _sharedScore->_movieArchive) {
-		if (_sharedScore->_movieArchive->getFileName().equalsIgnoreCase(filename))
-			return;
-	}
-
 	clearSharedCast();
 
 	Archive *sharedCast = createArchive();




More information about the Scummvm-git-logs mailing list