[Scummvm-git-logs] scummvm master -> 70de3d384eefa70e34ef5e8adf9e3529dc2ea006

sev- noreply at scummvm.org
Wed Dec 20 16:58:02 UTC 2023


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:
70de3d384e DIRECTOR: Make Window filename as a separate variable


Commit: 70de3d384eefa70e34ef5e8adf9e3529dc2ea006
    https://github.com/scummvm/scummvm/commit/70de3d384eefa70e34ef5e8adf9e3529dc2ea006
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-12-20T17:57:52+01:00

Commit Message:
DIRECTOR: Make Window filename as a separate variable

It was incorrectly implemented as matching the Window name, because
of short-sighted implementation.

This fixes startup in jewels1, where it creates a separate window
named "puzzle", assigns a filename to it but still continues referring
to the window as "puzzle".

Changed paths:
    engines/director/window.cpp
    engines/director/window.h


diff --git a/engines/director/window.cpp b/engines/director/window.cpp
index edc231648f6..2ec12b6e37f 100644
--- a/engines/director/window.cpp
+++ b/engines/director/window.cpp
@@ -324,8 +324,10 @@ Common::Point Window::getMousePos() {
 void Window::setVisible(bool visible, bool silent) {
 	// setting visible triggers movie load
 	if (!_currentMovie && !silent) {
-		Common::String movieName = getName();
-		setNextMovie(movieName);
+		if (_fileName.empty()) {
+			Common::String movieName = getName();
+			setNextMovie(movieName);
+		}
 	}
 
 	BaseMacWindow::setVisible(visible);
@@ -335,23 +337,25 @@ void Window::setVisible(bool visible, bool silent) {
 }
 
 bool Window::setNextMovie(Common::String &movieFilenameRaw) {
-	Common::Path movieFilename = findMoviePath(movieFilenameRaw);
+	_fileName = findMoviePath(movieFilenameRaw);
 
 	bool fileExists = false;
 	Common::File file;
-	if (!movieFilename.empty() && file.open(movieFilename)) {
+	if (!_fileName.empty() && file.open(_fileName)) {
 		fileExists = true;
 		file.close();
 	}
 
-	debug(1, "Window::setNextMovie: '%s' -> '%s' -> '%s'", movieFilenameRaw.c_str(), convertPath(movieFilenameRaw).c_str(), movieFilename.toString().c_str());
+	debug(1, "Window::setNextMovie: '%s' -> '%s' -> '%s'", movieFilenameRaw.c_str(), convertPath(movieFilenameRaw).c_str(), _fileName.toString().c_str());
 
 	if (!fileExists) {
-		warning("Movie %s does not exist", movieFilename.toString().c_str());
+		warning("Movie %s does not exist", _fileName.toString().c_str());
+		_fileName.set("");
 		return false;
 	}
 
-	_nextMovie.movie = movieFilename.toString(g_director->_dirSeparator);
+	_nextMovie.movie = _fileName.toString(g_director->_dirSeparator);
+
 	return true;
 }
 
diff --git a/engines/director/window.h b/engines/director/window.h
index 2e6a7179d03..6368e99eb53 100644
--- a/engines/director/window.h
+++ b/engines/director/window.h
@@ -145,7 +145,7 @@ public:
 	void setModal(bool modal);
 	bool getModal() { return _isModal; };
 	void setFileName(Common::String filename);
-	Common::String getFileName() { return getName(); }
+	Common::String getFileName() { return _fileName.toString(g_director->_dirSeparator); }
 
 	void updateBorderType();
 
@@ -187,6 +187,8 @@ public:
 	Datum getField(int field) override;
 	bool setField(int field, const Datum &value) override;
 
+	Common::Path _fileName;
+
 public:
 	Common::List<Channel *> _dirtyChannels;
 	TransParams *_puppetTransition;




More information about the Scummvm-git-logs mailing list