[Scummvm-git-logs] scummvm master -> 7b7d351a54788e13f7bacd7ba0e3d83daa6c3ce0

djsrv dservilla at gmail.com
Sat Jul 24 05:45:51 UTC 2021


This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
0aec46b269 DIRECTOR: Skip Windows drive letter in filename
5add8e86c5 DIRECTOR: Better handle D4 Windows filenames
d8310a0181 DIRECTOR: Don't add file extensons to video names
f1a7d94f2d DIRECTOR: Don't use renderFrame for video updates
7b7d351a54 DIRECTOR: Use updateVideo instead of renderFrame in b_updateStage


Commit: 0aec46b269fd104724e65ee8f607e2dc9917ff42
    https://github.com/scummvm/scummvm/commit/0aec46b269fd104724e65ee8f607e2dc9917ff42
Author: djsrv (dservilla at gmail.com)
Date: 2021-07-24T01:44:27-04:00

Commit Message:
DIRECTOR: Skip Windows drive letter in filename

Changed paths:
    engines/director/util.cpp


diff --git a/engines/director/util.cpp b/engines/director/util.cpp
index 3187037b87..ef6362e72a 100644
--- a/engines/director/util.cpp
+++ b/engines/director/util.cpp
@@ -233,6 +233,11 @@ Common::String convertPath(Common::String &path) {
 	} else if (path.hasPrefix("@:")) { // Root of the game
 		res = ".\\";
 		idx = 2;
+	} else if (path.size() >= 3
+					&& Common::isAlpha(path[0])
+					&& path[1] == ':'
+					&& path[2] == '\\') { // Windows drive letter
+		idx = 3;
 	} else {
 		res = ".\\";
 


Commit: 5add8e86c55a15c2d129c00407b6cad28292e7fa
    https://github.com/scummvm/scummvm/commit/5add8e86c55a15c2d129c00407b6cad28292e7fa
Author: djsrv (dservilla at gmail.com)
Date: 2021-07-24T01:44:27-04:00

Commit Message:
DIRECTOR: Better handle D4 Windows filenames

We need to truncate Windows filenames to a valid 8.3 filename but using
a different algorithm than D3.

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


diff --git a/engines/director/util.cpp b/engines/director/util.cpp
index ef6362e72a..20b2bf61ca 100644
--- a/engines/director/util.cpp
+++ b/engines/director/util.cpp
@@ -418,6 +418,18 @@ Common::String pathMakeRelative(Common::String path, bool recursive, bool addext
 				ptr++;
 			}
 
+			if (hasExtension(component)) {
+				Common::String nameWithoutExt = component.substr(0, component.size() - 4);
+				Common::String ext = component.substr(component.size() - 4);
+				Common::String newpath = convPath + convertMacFilename(nameWithoutExt.c_str()) + ext;
+
+				debug(2, "pathMakeRelative(): s6 %s -> try %s", initialPath.c_str(), newpath.c_str());
+				Common::String res = pathMakeRelative(newpath, false, false);
+
+				if (testPath(res))
+					return res;
+			}
+
 			if (addexts)
 				addedexts = testExtensions(component, initialPath, convPath);
 		} else {
@@ -438,10 +450,21 @@ Common::String pathMakeRelative(Common::String path, bool recursive, bool addext
 		return initialPath;
 }
 
+bool hasExtension(Common::String filename) {
+	uint len = filename.size();
+	return len >= 4 && filename[len - 4] == '.'
+					&& Common::isAlpha(filename[len - 3])
+					&& Common::isAlpha(filename[len - 2])
+					&& Common::isAlpha(filename[len - 1]);
+}
+
 Common::String testExtensions(Common::String component, Common::String initialPath, Common::String convPath) {
-	const char *exts[] = { ".MMM", ".DIR", ".DXR", 0 };
+	const char *extsD3[] = { ".MMM", 0 };
+	const char *extsD4[] = { ".DIR", ".DXR", 0 };
+
+	const char **exts = (g_director->getVersion() >= 400) ? extsD4 : extsD3;
 	for (int i = 0; exts[i]; ++i) {
-		Common::String newpath = convPath + (strcmp(exts[i], ".MMM") == 0 ?  convertMacFilename(component.c_str()) : component.c_str()) + exts[i];
+		Common::String newpath = convPath + convertMacFilename(component.c_str()) + exts[i];
 
 		debug(2, "pathMakeRelative(): s6 %s -> try %s", initialPath.c_str(), newpath.c_str());
 		Common::String res = pathMakeRelative(newpath, false, false);
@@ -515,60 +538,74 @@ Common::String convertMacFilename(const char *name) {
 
 	int origlen = strlen(name);
 
-	// Remove trailing spaces
-	const char *ptr = &name[origlen - 1];
-	while (myIsSpace(*ptr))
-		ptr--;
+	if (g_director->getVersion() < 400) {
+		// Remove trailing spaces
+		const char *ptr = &name[origlen - 1];
+		while (myIsSpace(*ptr))
+			ptr--;
 
-	int numDigits = 0;
-	char digits[10];
+		int numDigits = 0;
+		char digits[10];
 
-	// Count trailing digits, but leave front letter
-	while (myIsDigit(*ptr) && (numDigits < (8 - 1)))
-		digits[++numDigits] = *ptr--;
+		// Count trailing digits, but leave front letter
+		while (myIsDigit(*ptr) && (numDigits < (8 - 1)))
+			digits[++numDigits] = *ptr--;
 
-	// Count file name without vowels, spaces and digits in-between
-	ptr = name;
-	int cnt = 0;
-	while (cnt < (8 - numDigits) && ptr < &name[origlen]) {
-		char c = toupper(*ptr++);
+		// Count file name without vowels, spaces and digits in-between
+		ptr = name;
+		int cnt = 0;
+		while (cnt < (8 - numDigits) && ptr < &name[origlen]) {
+			char c = toupper(*ptr++);
 
-		if ((myIsVowel(c) && (cnt != 0)) || myIsSpace(c) || myIsDigit(c))
-			continue;
+			if ((myIsVowel(c) && (cnt != 0)) || myIsSpace(c) || myIsDigit(c))
+				continue;
 
-		if ((c != '_') && !myIsAlnum(c))
-			continue;
+			if ((c != '_') && !myIsAlnum(c))
+				continue;
 
-		cnt++;
-	}
+			cnt++;
+		}
+
+		// Make sure all trailing digits fit
+		int numVowels = 8 - (numDigits + cnt);
+		ptr = name;
 
-	// Make sure all trailing digits fit
-	int numVowels = 8 - (numDigits + cnt);
-	ptr = name;
+		// Put enough characters from beginning
+		for (cnt = 0; cnt < (8 - numDigits) && ptr < &name[origlen];) {
+			char c = toupper(*ptr++);
 
-	// Put enough characters from beginning
-	for (cnt = 0; cnt < (8 - numDigits) && ptr < &name[origlen];) {
-		char c = toupper(*ptr++);
+			if (myIsVowel(c) && (cnt != 0)) {
+				if (numVowels > 0)
+					numVowels--;
+				else
+					continue;
+			}
 
-		if (myIsVowel(c) && (cnt != 0)) {
-			if (numVowels > 0)
-				numVowels--;
-			else
+			if (myIsSpace(c) || myIsDigit(c) || ((c != '_') && !myIsAlnum(c)))
 				continue;
+
+			res += c;
+
+			cnt++;
 		}
 
-		if (myIsSpace(c) || myIsDigit(c) || ((c != '_') && !myIsAlnum(c)))
-			continue;
+		// Now attach all digits
+		while (numDigits)
+			res += digits[numDigits--];
+	} else {
+		const char *ptr = name;
+		for (int cnt = 0; cnt < 8 && ptr < &name[origlen];) {
+			char c = toupper(*ptr++);
+
+			if (myIsSpace(c) || (!myIsAlnum(c) && !myIsFATChar(c)))
+				continue;
 
-		res += c;
+			res += c;
 
-		cnt++;
+			cnt++;
+		}
 	}
 
-	// Now attach all digits
-	while (numDigits)
-		res += digits[numDigits--];
-
 	return res;
 }
 
diff --git a/engines/director/util.h b/engines/director/util.h
index 85b246f09f..049fe13651 100644
--- a/engines/director/util.h
+++ b/engines/director/util.h
@@ -42,6 +42,8 @@ bool testPath(Common::String &path, bool directory = false);
 
 Common::String pathMakeRelative(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);
 
 Common::String getFileName(Common::String path);


Commit: d8310a01814b54285e8ecd4b6f38ef81d7c4b928
    https://github.com/scummvm/scummvm/commit/d8310a01814b54285e8ecd4b6f38ef81d7c4b928
Author: djsrv (dservilla at gmail.com)
Date: 2021-07-24T01:44:27-04:00

Commit Message:
DIRECTOR: Don't add file extensons to video names

Changed paths:
    engines/director/channel.cpp


diff --git a/engines/director/channel.cpp b/engines/director/channel.cpp
index d62a6dda73..5966622172 100644
--- a/engines/director/channel.cpp
+++ b/engines/director/channel.cpp
@@ -318,7 +318,7 @@ void Channel::setClean(Sprite *nextSprite, int spriteId, bool partial) {
 				Common::String path = nextSprite->_cast->getCast()->getVideoPath(nextSprite->_castId.member);
 
 				if (!path.empty()) {
-					((DigitalVideoCastMember *)nextSprite->_cast)->loadVideo(pathMakeRelative(path));
+					((DigitalVideoCastMember *)nextSprite->_cast)->loadVideo(pathMakeRelative(path, true, false));
 					((DigitalVideoCastMember *)nextSprite->_cast)->startVideo(this);
 				}
 			}


Commit: f1a7d94f2d5c003e1016c0ef4388cfca6be7ba3b
    https://github.com/scummvm/scummvm/commit/f1a7d94f2d5c003e1016c0ef4388cfca6be7ba3b
Author: djsrv (dservilla at gmail.com)
Date: 2021-07-24T01:44:27-04:00

Commit Message:
DIRECTOR: Don't use renderFrame for video updates

This adds a renderVideo function which updates a frame's digital video
and nothing else. renderFrame resets all sprites to what's stored in the
score which is an unwanted side effect.

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


diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index f4a0d9b7e7..6ed78942e0 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -336,7 +336,8 @@ void Score::update() {
 
 		if (keepWaiting) {
 			if (_movie->_videoPlayback) {
-				renderFrame(_currentFrame);
+				renderVideo();
+				_window->render();
 			}
 			return;
 		}
@@ -601,6 +602,17 @@ void Score::renderCursor(Common::Point pos) {
 	}
 }
 
+void Score::renderVideo() {
+	for (uint16 i = 0; i < _channels.size(); i++) {
+		Channel *channel = _channels[i];
+		CastMember *cast = channel->_sprite->_cast;
+		if (cast && cast->_type == kCastDigitalVideo && cast->isModified()) {
+			channel->replaceWidget();
+			_window->addDirtyRect(channel->getBbox());
+		}
+	}
+}
+
 void Score::screenShot() {
 	Graphics::Surface rawSurface = _window->getSurface()->rawSurface();
 	const Graphics::PixelFormat requiredFormat_4byte(4, 8, 8, 8, 8, 0, 8, 16, 24);
diff --git a/engines/director/score.h b/engines/director/score.h
index 025060bd1b..75897ef0f9 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -111,6 +111,7 @@ public:
 	bool renderFrame(uint16 frameId, RenderMode mode = kRenderModeNormal);
 	void renderSprites(uint16 frameId, RenderMode mode = kRenderModeNormal);
 	void renderCursor(Common::Point pos);
+	void renderVideo();
 
 private:
 	void update();


Commit: 7b7d351a54788e13f7bacd7ba0e3d83daa6c3ce0
    https://github.com/scummvm/scummvm/commit/7b7d351a54788e13f7bacd7ba0e3d83daa6c3ce0
Author: djsrv (dservilla at gmail.com)
Date: 2021-07-24T01:44:27-04:00

Commit Message:
DIRECTOR: Use updateVideo instead of renderFrame in b_updateStage

This partially reverts
30f0b3995a8c40908f9f80a14cfe199257b3001d.
I mistakenly stated that we need to re-render the entire frame in
b_updateStage in that commit, but that was incorrect.
This fixes a regression in Chop Suey's cursors.

Changed paths:
    engines/director/lingo/lingo-builtins.cpp
    engines/director/score.cpp
    engines/director/score.h


diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index 7f00d8eea8..10febc8b52 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -2068,7 +2068,11 @@ void LB::b_updateStage(int nargs) {
 	}
 
 	Score *score = movie->getScore();
-	if (score->renderFrame(score->getCurrentFrame()))
+
+	if (movie->_videoPlayback)
+		score->renderVideo();
+
+	if (movie->getWindow()->render())
 		g_director->draw();
 
 	if (debugChannelSet(-1, kDebugFewFramesOnly)) {
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 6ed78942e0..650aef57ed 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -484,9 +484,7 @@ void Score::update() {
 		_nextFrameTime += 1000;
 }
 
-bool Score::renderFrame(uint16 frameId, RenderMode mode) {
-	bool updated = false;
-
+void Score::renderFrame(uint16 frameId, RenderMode mode) {
 	if (!renderTransition(frameId))
 		renderSprites(frameId, mode);
 
@@ -496,8 +494,7 @@ bool Score::renderFrame(uint16 frameId, RenderMode mode) {
 		g_director->setPalette(resolvePaletteId(currentPalette));
 	}
 
-	if (_window->render())
-		updated = true;
+	_window->render();
 
 	// sound stuff
 	if (_frames[frameId]->_sound1.member || _frames[frameId]->_sound2.member)
@@ -508,10 +505,7 @@ bool Score::renderFrame(uint16 frameId, RenderMode mode) {
 	if (_cursorDirty) {
 		renderCursor(_movie->getWindow()->getMousePos());
 		_cursorDirty = false;
-		updated = true;
 	}
-
-	return updated;
 }
 
 bool Score::renderTransition(uint16 frameId) {
diff --git a/engines/director/score.h b/engines/director/score.h
index 75897ef0f9..a1d707a991 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -108,7 +108,7 @@ public:
 	uint16 getSpriteIdByMemberId(CastMemberID id);
 
 	bool renderTransition(uint16 frameId);
-	bool renderFrame(uint16 frameId, RenderMode mode = kRenderModeNormal);
+	void renderFrame(uint16 frameId, RenderMode mode = kRenderModeNormal);
 	void renderSprites(uint16 frameId, RenderMode mode = kRenderModeNormal);
 	void renderCursor(Common::Point pos);
 	void renderVideo();




More information about the Scummvm-git-logs mailing list