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

rvanlaar noreply at scummvm.org
Thu Mar 10 22:42:55 UTC 2022


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:
95fc5560f9 Director: Implement the searchPath
6cd54ce1d0 DIRECTOR: LINGO: FPLAY: fix name


Commit: 95fc5560f97882c6ed88fb920420fc521c2410f8
    https://github.com/scummvm/scummvm/commit/95fc5560f97882c6ed88fb920420fc521c2410f8
Author: Roland van Laar (roland at rolandvanlaar.nl)
Date: 2022-03-10T23:42:37+01:00

Commit Message:
Director: Implement the searchPath

the searchPath is an array that contains paths that need to be searched
when opening a file. It's a property on the same global level in the
same way itemDelimeter is.

The searchPath is set via cb_theassign2. It's used for assigning
properties to the movie itself. `g_lingo` in the case of ScummVM.

The only known case for cb_theassign2 is in the game Louis Catorze
where it's only used for the searchPath.

Note: cb_theassign() does the same thing for script and factories

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


diff --git a/engines/director/lingo/lingo-bytecode.cpp b/engines/director/lingo/lingo-bytecode.cpp
index 1795dbac563..7603ea6a80d 100644
--- a/engines/director/lingo/lingo-bytecode.cpp
+++ b/engines/director/lingo/lingo-bytecode.cpp
@@ -578,6 +578,7 @@ void LC::cb_varrefpush() {
 }
 
 void LC::cb_theassign() {
+	// cb_theassign is for setting script/factory-level properties
 	Common::String name = g_lingo->readString();
 	Datum value = g_lingo->pop();
 	if (g_lingo->_currentMe.type == OBJECT) {
@@ -592,9 +593,16 @@ void LC::cb_theassign() {
 }
 
 void LC::cb_theassign2() {
+	// cb_theassign2 is for setting movie-level properties
+
+	// only seen in louis catorze with searchPath
 	Common::String name = g_lingo->readString();
 	Datum value = g_lingo->pop();
-	warning("STUB: cb_theassign2(%s, %s)", name.c_str(), value.asString().c_str());
+	if (name == "searchPath") {
+		g_lingo->_searchPath = value;
+	} else {
+		warning("BUILDBOT: cb_theassign2 unkown name: %s", name.c_str());
+	}
 }
 
 void LC::cb_thepush() {
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index 961baeac926..bae1bb36152 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -752,7 +752,7 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
 		getTheEntitySTUB(kTheSearchCurrentFolder);
 		break;
 	case kTheSearchPath:
-		getTheEntitySTUB(kTheSearchPath);
+		d = g_lingo->_searchPath;
 		break;
 	case kTheSelection:
 		if (movie->_currentEditableTextChannel) {
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 3453951fc96..d69e434fa9f 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -164,6 +164,9 @@ Lingo::Lingo(DirectorEngine *vm) : _vm(vm) {
 	//kTheEntities
 	_itemDelimiter = ',';
 
+	_searchPath.type = ARRAY;
+	_searchPath.u.farr = new FArray;
+	
 	// events
 	_passEvent = false;
 	_perFrameHook = Datum();
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index da1f3f9b33f..07f5b38d6af 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -379,6 +379,7 @@ public:
 
 	// global kTheEntity
 	Common::u32char_type_t _itemDelimiter;
+	Datum _searchPath;
 
 	Datum getTheEntity(int entity, Datum &id, int field);
 	void setTheEntity(int entity, Datum &id, int field, Datum &d);
diff --git a/engines/director/util.cpp b/engines/director/util.cpp
index 3bdee9a8afd..a174ceccadf 100644
--- a/engines/director/util.cpp
+++ b/engines/director/util.cpp
@@ -32,6 +32,7 @@
 
 #include "director/director.h"
 #include "director/movie.h"
+#include "director/lingo/lingo.h"
 #include "director/util.h"
 
 namespace Director {
@@ -436,10 +437,32 @@ bool testPath(Common::String &path, bool directory) {
 	return true;
 }
 
+
+Common::String pathMakeRelative(Common::String path, bool recursive, bool addexts, bool directory) {
+	//Wrap pathMakeRelative to search in extra paths defined by the game
+	Common::String foundPath;
+
+	Datum searchPath = g_director->getLingo()->_searchPath;
+	if (searchPath.type == ARRAY && searchPath.u.farr->arr.size() > 0) {
+		for (uint i = 0; i < searchPath.u.farr->arr.size(); i++) {
+			Common::String searchIn = searchPath.u.farr->arr[i].asString();
+			debug(9, "athMakeRelative(): searchPath: %s", searchIn.c_str());
+
+			foundPath = wrappedPathMakeRelative(searchIn + path, recursive, addexts, directory);
+			if (testPath(foundPath))
+				return foundPath;
+		}
+	}
+
+	return wrappedPathMakeRelative(path, recursive, addexts, directory);
+}
+
+
 // if we are finding the file path, then this func will return exactly the executable file path
 // if we are finding the directory path, then we will get the path relative to the game data dir.
 // e.g. if we have game data dir as SSwarlock, then "A:SSwarlock" -> "", "A:SSwarlock:Nav" -> "Nav"
-Common::String pathMakeRelative(Common::String path, bool recursive, bool addexts, bool directory) {
+Common::String wrappedPathMakeRelative(Common::String path, bool recursive, bool addexts, bool directory) {
+
 	Common::String initialPath(path);
 
 	if (recursive) // first level
@@ -537,7 +560,7 @@ Common::String pathMakeRelative(Common::String path, bool recursive, bool addext
 				Common::String newpath = convPath + convertMacFilename(nameWithoutExt.c_str()) + ext;
 
 				debug(9, "pathMakeRelative(): s6 %s -> try %s", initialPath.c_str(), newpath.c_str());
-				Common::String res = pathMakeRelative(newpath, false, false);
+				Common::String res = wrappedPathMakeRelative(newpath, false, false);
 
 				if (testPath(res))
 					return res;
@@ -577,7 +600,7 @@ Common::String testExtensions(Common::String component, Common::String initialPa
 		Common::String newpath = convPath + convertMacFilename(component.c_str()) + exts[i];
 
 		debug(9, "pathMakeRelative(): s6 %s -> try %s", initialPath.c_str(), newpath.c_str());
-		Common::String res = pathMakeRelative(newpath, false, false);
+		Common::String res = wrappedPathMakeRelative(newpath, false, false);
 
 		if (testPath(res))
 			return res;
diff --git a/engines/director/util.h b/engines/director/util.h
index 12342ba754b..fbe5524eabb 100644
--- a/engines/director/util.h
+++ b/engines/director/util.h
@@ -41,6 +41,8 @@ bool testPath(Common::String &path, bool directory = false);
 
 Common::String pathMakeRelative(Common::String path, bool recursive = true, bool addexts = true, bool directory = false);
 
+Common::String wrappedPathMakeRelative(Common::String path, bool recursive = true, bool addexts = true, bool directory = false);
+
 bool hasExtension(Common::String filename);
 
 Common::String testExtensions(Common::String component, Common::String initialPath, Common::String convPath);


Commit: 6cd54ce1d0b7d22896bc84f66a32bc2a0fe29065
    https://github.com/scummvm/scummvm/commit/6cd54ce1d0b7d22896bc84f66a32bc2a0fe29065
Author: Roland van Laar (roland at rolandvanlaar.nl)
Date: 2022-03-10T23:42:37+01:00

Commit Message:
DIRECTOR: LINGO: FPLAY: fix name

The FPlay XObjects internal name is FPlay.

Necessary since ScummVM uses the internal XObjects names in rsrc files.
    Commit: 930d9236

Changed paths:
    engines/director/lingo/xlibs/fplayxobj.cpp


diff --git a/engines/director/lingo/xlibs/fplayxobj.cpp b/engines/director/lingo/xlibs/fplayxobj.cpp
index 3b6ea0eda5e..08aaf4fe7a9 100644
--- a/engines/director/lingo/xlibs/fplayxobj.cpp
+++ b/engines/director/lingo/xlibs/fplayxobj.cpp
@@ -39,6 +39,7 @@ namespace Director {
 const char *FPlayXObj::xlibName = "FPlay";
 const char *FPlayXObj::fileNames[] = {
 	"FPlayXObj",
+	"FPlay",
 	nullptr
 };
 




More information about the Scummvm-git-logs mailing list