[Scummvm-git-logs] scummvm master -> 77b963b8085b5a1e59874762408e80debaa0cae0

djsrv dservilla at gmail.com
Wed Jul 7 01:30:45 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:
745c56f0b5 DIRECTOR: Improve handling different versions in Cast::loadConfig
ce3a1ac2cd DIRECTOR: Create platformFromID function
258318c0b1 DIRECTOR: Read movie creation platform from config
01c2e2004f DIRECTOR: Skip Lingo-style comments in FXmp
77b963b808 DIRECTOR: Add BUILDBOT to FXmp warnings


Commit: 745c56f0b5f9444a83f78c095f759cd90fddecc0
    https://github.com/scummvm/scummvm/commit/745c56f0b5f9444a83f78c095f759cd90fddecc0
Author: djsrv (dservilla at gmail.com)
Date: 2021-07-06T21:30:30-04:00

Commit Message:
DIRECTOR: Improve handling different versions in Cast::loadConfig

Changed paths:
    engines/director/cast.cpp


diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp
index 2fbf7e63a8..4a6db2779b 100644
--- a/engines/director/cast.cpp
+++ b/engines/director/cast.cpp
@@ -260,27 +260,37 @@ bool Cast::loadConfig() {
 	// uint16 stageColorG = stream.readUint16();
 	// uint16 stageColorB = stream.readUint16();
 
+	debugC(1, kDebugLoading, "Cast::loadConfig(): len: %d, fileVersion: %d, framerate: %d, light: %d, unk: %d, font: %d, size: %d"
+			", style: %d", len, fileVersion, currentFrameRate, lightswitch, unk1, commentFont, commentSize, commentStyle);
+	debugC(1, kDebugLoading, "Cast::loadConfig(): stagecolor: %d, depth: %d",
+			_stageColor, bitdepth);
+	if (debugChannelSet(1, kDebugLoading))
+		_movieRect.debugPrint(1, "Cast::loadConfig(): Movie rect: ");
+
 	_version = fileVersion;
-	if (_version >= kFileVer300) {
+
+	// D3 fields - Macromedia did not increment the fileVersion from D2 to D3
+	// so we just have to check if there are more bytes to read.
+	if (stream->pos() < stream->size()) {
 		for (int i = 0; i < 0x06; i++) {
 			stream->readByte();
 		}
-
 		_version = stream->readUint16();
-
 		for (int i = 0; i < 0x0a; i++) {
 			stream->readByte();
 		}
+		debugC(1, kDebugLoading, "Cast::loadConfig(): directorVersion: %d", _version);
+	}
 
-		if (_version >= kFileVer400) {
-			for (int i = 0; i < 0x16; i++)
-				stream->readByte();
-
-			_defaultPalette = (int16)stream->readUint16();
-
-			for (int i = 0; i < 0x08; i++)
-				stream->readByte();
+	if (_version >= kFileVer400) {
+		for (int i = 0; i < 0x16; i++) {
+			stream->readByte();
+		}
+		_defaultPalette = (int16)stream->readUint16();
+		for (int i = 0; i < 0x08; i++) {
+			stream->readByte();
 		}
+		debugC(1, kDebugLoading, "Cast::loadConfig(): defaultPalette: %d", _defaultPalette);
 	}
 
 	uint16 humanVer = humanVersion(_version);
@@ -290,13 +300,6 @@ bool Cast::loadConfig() {
 		_vm->setVersion(humanVer);
 	}
 
-	debugC(1, kDebugLoading, "Cast::loadConfig(): len: %d, ver: %d, framerate: %d, light: %d, unk: %d, font: %d, size: %d"
-			", style: %d", len, fileVersion, currentFrameRate, lightswitch, unk1, commentFont, commentSize, commentStyle);
-	debugC(1, kDebugLoading, "Cast::loadConfig(): stagecolor: %d, depth: %d, directorVer: %d",
-			_stageColor, bitdepth, _version);
-	if (debugChannelSet(1, kDebugLoading))
-		_movieRect.debugPrint(1, "Cast::loadConfig(): Movie rect: ");
-
 	delete stream;
 	return true;
 }


Commit: ce3a1ac2cdb0faef57dbcc257f274b46319efaac
    https://github.com/scummvm/scummvm/commit/ce3a1ac2cdb0faef57dbcc257f274b46319efaac
Author: djsrv (dservilla at gmail.com)
Date: 2021-07-06T21:30:30-04:00

Commit Message:
DIRECTOR: Create platformFromID function

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


diff --git a/engines/director/fonts.cpp b/engines/director/fonts.cpp
index bc92b789ed..f8efaea034 100644
--- a/engines/director/fonts.cpp
+++ b/engines/director/fonts.cpp
@@ -27,6 +27,7 @@
 
 #include "director/director.h"
 #include "director/cast.h"
+#include "director/util.h"
 
 namespace Director {
 
@@ -89,26 +90,12 @@ void Cast::loadFontMapV4(Common::SeekableReadStreamEndian &stream) {
 		Common::String name = stream.readString(0, nameLength);
 		stream.seek(returnPos);
 
-		uint16 platform = stream.readUint16();
+		Common::Platform platform = platformFromID(stream.readUint16());
 		uint16 id = stream.readUint16();
 
-		Common::String platformName;
-		switch (platform) {
-		case 1:
-			platformName = "Mac";
-			break;
-		case 2:
-			platformName = "Win";
-			break;
-		default:
-			warning("Cast::loadFontMap: Unknown platform ID %d", platform);
-			platformName = "UNK";
-			break;
-		}
-
 		// Map cast font ID to window manager font ID
 		FontInfo *info = new FontInfo;
-		if (platform == 2 && _fontXPlatformMap.contains(name)) {
+		if (platform == Common::kPlatformWindows && _fontXPlatformMap.contains(name)) {
 			FontXPlatformInfo *xinfo = _fontXPlatformMap[name];
 			info->toFont = _vm->_wm->_fontMan->registerFontName(xinfo->toFont);
 			info->remapChars = xinfo->remapChars;
@@ -118,7 +105,7 @@ void Cast::loadFontMapV4(Common::SeekableReadStreamEndian &stream) {
 		}
 		_fontMap[id] = info;
 
-		debugC(3, kDebugLoading, "Cast::loadFontMapV4: Mapping %s font %d (%s) to %d", platformName.c_str(), id, name.c_str(), _fontMap[id]->toFont);
+		debugC(3, kDebugLoading, "Cast::loadFontMapV4: Mapping %s font %d (%s) to %d", getPlatformAbbrev(platform), id, name.c_str(), _fontMap[id]->toFont);
 	}
 }
 
diff --git a/engines/director/util.cpp b/engines/director/util.cpp
index 07667a8f3c..8bacce0781 100644
--- a/engines/director/util.cpp
+++ b/engines/director/util.cpp
@@ -737,4 +737,17 @@ uint16 humanVersion(uint16 ver) {
 	return 200;
 }
 
+Common::Platform platformFromID(uint16 id) {
+	switch (id) {
+	case 1:
+		return Common::kPlatformMacintosh;
+	case 2:
+		return Common::kPlatformWindows;
+	default:
+		warning("platformFromID: Unknown platform ID %d", id);
+		break;
+	}
+	return Common::kPlatformUnknown;
+}
+
 } // End of namespace Director
diff --git a/engines/director/util.h b/engines/director/util.h
index 8351ae53e2..ae823d987c 100644
--- a/engines/director/util.h
+++ b/engines/director/util.h
@@ -82,6 +82,8 @@ Common::SeekableReadStreamEndian *readZlibData(Common::SeekableReadStream &strea
 
 uint16 humanVersion(uint16 ver);
 
+Common::Platform platformFromID(uint16 id);
+
 } // End of namespace Director
 
 #endif


Commit: 258318c0b1e717d905d9264f81d13af522a192fd
    https://github.com/scummvm/scummvm/commit/258318c0b1e717d905d9264f81d13af522a192fd
Author: djsrv (dservilla at gmail.com)
Date: 2021-07-06T21:30:30-04:00

Commit Message:
DIRECTOR: Read movie creation platform from config

Changed paths:
    engines/director/cast.cpp
    engines/director/cast.h
    engines/director/movie.cpp
    engines/director/movie.h


diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp
index 4a6db2779b..a394a09d31 100644
--- a/engines/director/cast.cpp
+++ b/engines/director/cast.cpp
@@ -77,6 +77,7 @@ Cast::Cast(Movie *movie, uint16 castLibID, bool isShared) {
 
 	_castArchive = nullptr;
 	_version = 0;
+	_platform = g_director->getPlatform();
 
 	_loadedStxts = nullptr;
 	_loadedCast = nullptr;
@@ -283,14 +284,18 @@ bool Cast::loadConfig() {
 	}
 
 	if (_version >= kFileVer400) {
-		for (int i = 0; i < 0x16; i++) {
+		for (int i = 0; i < 0x08; i++) {
+			stream->readByte();
+		}
+		_platform = platformFromID(stream->readUint16());
+		for (int i = 0; i < 0x0c; i++) {
 			stream->readByte();
 		}
 		_defaultPalette = (int16)stream->readUint16();
 		for (int i = 0; i < 0x08; i++) {
 			stream->readByte();
 		}
-		debugC(1, kDebugLoading, "Cast::loadConfig(): defaultPalette: %d", _defaultPalette);
+		debugC(1, kDebugLoading, "Cast::loadConfig(): platform: %s, defaultPalette: %d", getPlatformAbbrev(_platform), _defaultPalette);
 	}
 
 	uint16 humanVer = humanVersion(_version);
diff --git a/engines/director/cast.h b/engines/director/cast.h
index 37c3e014fb..90e6cbd691 100644
--- a/engines/director/cast.h
+++ b/engines/director/cast.h
@@ -110,6 +110,7 @@ private:
 public:
 	Archive *_castArchive;
 	uint16 _version;
+	Common::Platform _platform;
 	uint16 _castLibID;
 
 	CharMap _charMap;
diff --git a/engines/director/movie.cpp b/engines/director/movie.cpp
index 24edca75b8..7d40e1639f 100644
--- a/engines/director/movie.cpp
+++ b/engines/director/movie.cpp
@@ -114,6 +114,7 @@ bool Movie::loadArchive() {
 		return false;
 
 	_version = _cast->_version;
+	_platform = _cast->_platform;
 	_movieRect = _cast->_movieRect;
 	// Wait to handle _stageColor until palette is loaded in loadCast...
 
diff --git a/engines/director/movie.h b/engines/director/movie.h
index 59ac8b6723..5eecc95c1e 100644
--- a/engines/director/movie.h
+++ b/engines/director/movie.h
@@ -146,6 +146,7 @@ private:
 public:
 	Archive *_movieArchive;
 	uint16 _version;
+	Common::Platform _platform;
 	Common::Rect _movieRect;
 	uint16 _currentClickOnSpriteId;
 	uint16 _currentEditableTextChannel;


Commit: 01c2e2004fb9b6d6444e19506cc0e8e1f9aa62a1
    https://github.com/scummvm/scummvm/commit/01c2e2004fb9b6d6444e19506cc0e8e1f9aa62a1
Author: djsrv (dservilla at gmail.com)
Date: 2021-07-06T21:30:30-04:00

Commit Message:
DIRECTOR: Skip Lingo-style comments in FXmp

Changed paths:
    engines/director/fonts.cpp


diff --git a/engines/director/fonts.cpp b/engines/director/fonts.cpp
index f8efaea034..c8fe9f03aa 100644
--- a/engines/director/fonts.cpp
+++ b/engines/director/fonts.cpp
@@ -153,14 +153,31 @@ FXmpToken readFXmpToken(Common::SeekableReadStreamEndian &stream) {
 	}
 
 	// skip comment
+	bool foundComment = false;
 	if (ch == ';') {
+		foundComment = true;
+	} else if (ch == '-') {
+		ch = stream.readByte();
+		if (stream.eos()) {
+			res.type = FXMP_TOKEN_ERROR;
+			warning("readFXmpToken: Expected '-' but got EOF");
+			return res;
+		}
+		if (ch != '-') {
+			res.type = FXMP_TOKEN_ERROR;
+			warning("readFXmpToken: Expected '-' but got '%c'", ch);
+			return res;
+		}
+		foundComment = true;
+	}
+	if (foundComment) {
 		while (!stream.eos() && ch != '\r') {
 			ch = stream.readByte();
 		}
-	}
-	if (stream.eos()) {
-		res.type = FXMP_TOKEN_EOF;
-		return res;
+		if (stream.eos()) {
+			res.type = FXMP_TOKEN_EOF;
+			return res;
+		}
 	}
 
 	if (Common::isAlpha(ch)) {


Commit: 77b963b8085b5a1e59874762408e80debaa0cae0
    https://github.com/scummvm/scummvm/commit/77b963b8085b5a1e59874762408e80debaa0cae0
Author: djsrv (dservilla at gmail.com)
Date: 2021-07-06T21:30:30-04:00

Commit Message:
DIRECTOR: Add BUILDBOT to FXmp warnings

Changed paths:
    engines/director/fonts.cpp


diff --git a/engines/director/fonts.cpp b/engines/director/fonts.cpp
index c8fe9f03aa..f56654ed19 100644
--- a/engines/director/fonts.cpp
+++ b/engines/director/fonts.cpp
@@ -160,12 +160,12 @@ FXmpToken readFXmpToken(Common::SeekableReadStreamEndian &stream) {
 		ch = stream.readByte();
 		if (stream.eos()) {
 			res.type = FXMP_TOKEN_ERROR;
-			warning("readFXmpToken: Expected '-' but got EOF");
+			warning("BUILDBOT: readFXmpToken: Expected '-' but got EOF");
 			return res;
 		}
 		if (ch != '-') {
 			res.type = FXMP_TOKEN_ERROR;
-			warning("readFXmpToken: Expected '-' but got '%c'", ch);
+			warning("BUILDBOT: readFXmpToken: Expected '-' but got '%c'", ch);
 			return res;
 		}
 		foundComment = true;
@@ -207,7 +207,7 @@ FXmpToken readFXmpToken(Common::SeekableReadStreamEndian &stream) {
 		} while (!stream.eos() && ch != '"');
 		if (stream.eos()) {
 			res.type = FXMP_TOKEN_ERROR;
-			warning("readFXmpToken: Expected '\"' but got EOF");
+			warning("BUILDBOT: readFXmpToken: Expected '\"' but got EOF");
 		}
 	} else if (ch == ':') {
 		res.type = FXMP_TOKEN_COLON;
@@ -217,14 +217,14 @@ FXmpToken readFXmpToken(Common::SeekableReadStreamEndian &stream) {
 		ch = stream.readByte();
 		if (stream.eos()) {
 			res.type = FXMP_TOKEN_ERROR;
-			warning("readFXmpToken: Expected '>' but got EOF");
+			warning("BUILDBOT: readFXmpToken: Expected '>' but got EOF");
 		} else {
 			res.str += ch;
 			if (ch == '>') {
 				res.type = FXMP_TOKEN_ARROW;
 			} else {
 				res.type = FXMP_TOKEN_ERROR;
-				warning("readFXmpToken: Expected '>' but got '%c'", ch);
+				warning("BUILDBOT: readFXmpToken: Expected '>' but got '%c'", ch);
 			}
 		}
 	} else if (ch == '\r') {
@@ -240,7 +240,7 @@ FXmpToken readFXmpToken(Common::SeekableReadStreamEndian &stream) {
 		}
 	} else {
 		res.type = FXMP_TOKEN_ERROR;
-		warning("readFXmpToken: Unexpected '%c'", ch);
+		warning("BUILDBOT: readFXmpToken: Unexpected '%c'", ch);
 	}
 
 	return res;
@@ -265,7 +265,7 @@ bool Cast::readFXmpLine(Common::SeekableReadStreamEndian &stream) {
 	// from
 	Common::Platform fromPlatform;
 	if (tok.type != FXMP_TOKEN_WORD) {
-		warning("Cast::readFXmpLine: Expected WORD, got %s", FXmpTokenTypeStrings[tok.type]);
+		warning("BUILDBOT: Cast::readFXmpLine: Expected WORD, got %s", FXmpTokenTypeStrings[tok.type]);
 		return false;
 	}
 	if (tok.str.equalsIgnoreCase("Mac")) {
@@ -273,13 +273,13 @@ bool Cast::readFXmpLine(Common::SeekableReadStreamEndian &stream) {
 	} else if (tok.str.equalsIgnoreCase("Win")) {
 		fromPlatform = Common::kPlatformWindows;
 	} else {
-		warning("Cast::readFXmpLine: Expected 'Mac' or 'Win', got '%s'", tok.str.c_str());
+		warning("BUILDBOT: Cast::readFXmpLine: Expected 'Mac' or 'Win', got '%s'", tok.str.c_str());
 		return false;
 	}
 
 	tok = readFXmpToken(stream);
 	if (tok.type != FXMP_TOKEN_COLON) {
-		warning("Cast::readFXmpLine: Expected COLON, got %s", FXmpTokenTypeStrings[tok.type]);
+		warning("BUILDBOT: Cast::readFXmpLine: Expected COLON, got %s", FXmpTokenTypeStrings[tok.type]);
 		return false;
 	}
 
@@ -292,28 +292,28 @@ bool Cast::readFXmpLine(Common::SeekableReadStreamEndian &stream) {
 
 	// arrow
 	if (tok.type != FXMP_TOKEN_ARROW) {
-		warning("Cast::readFXmpLine: Expected ARROW, got %s", FXmpTokenTypeStrings[tok.type]);
+		warning("BUILDBOT: Cast::readFXmpLine: Expected ARROW, got %s", FXmpTokenTypeStrings[tok.type]);
 		return false;
 	}
 
 	// to
 	tok = readFXmpToken(stream);
 	if (tok.type != FXMP_TOKEN_WORD) {
-		warning("Cast::readFXmpLine: Expected WORD, got %s", FXmpTokenTypeStrings[tok.type]);
+		warning("BUILDBOT: Cast::readFXmpLine: Expected WORD, got %s", FXmpTokenTypeStrings[tok.type]);
 		return false;
 	}
 	if (fromPlatform == Common::kPlatformMacintosh && !tok.str.equalsIgnoreCase("Win")) {
-		warning("Cast::readFXmpLine: Expected 'Win', got '%s'", tok.str.c_str());
+		warning("BUILDBOT: Cast::readFXmpLine: Expected 'Win', got '%s'", tok.str.c_str());
 		return false;
 	}
 	if (fromPlatform == Common::kPlatformWindows && !tok.str.equalsIgnoreCase("Mac")) {
-		warning("Cast::readFXmpLine: Expected 'Mac', got '%s'", tok.str.c_str());
+		warning("BUILDBOT: Cast::readFXmpLine: Expected 'Mac', got '%s'", tok.str.c_str());
 		return false;
 	}
 
 	tok = readFXmpToken(stream);
 	if (tok.type != FXMP_TOKEN_COLON) {
-		warning("Cast::readFXmpLine: Expected COLON, got %s", FXmpTokenTypeStrings[tok.type]);
+		warning("BUILDBOT: Cast::readFXmpLine: Expected COLON, got %s", FXmpTokenTypeStrings[tok.type]);
 		return false;
 	}
 
@@ -322,20 +322,20 @@ bool Cast::readFXmpLine(Common::SeekableReadStreamEndian &stream) {
 		tok = readFXmpToken(stream);
 		while (tok.type != FXMP_TOKEN_NEWLINE && tok.type != FXMP_TOKEN_EOF) {
 			if (tok.type != FXMP_TOKEN_INT) {
-				warning("Cast::readFXmpLine: Expected INT, got %s", FXmpTokenTypeStrings[tok.type]);
+				warning("BUILDBOT: Cast::readFXmpLine: Expected INT, got %s", FXmpTokenTypeStrings[tok.type]);
 				return false;
 			}
 			byte fromChar = atoi(tok.str.c_str());
 
 			tok = readFXmpToken(stream);
 			if (tok.type != FXMP_TOKEN_ARROW) {
-				warning("Cast::readFXmpLine: Expected ARROW, got %s", FXmpTokenTypeStrings[tok.type]);
+				warning("BUILDBOT: Cast::readFXmpLine: Expected ARROW, got %s", FXmpTokenTypeStrings[tok.type]);
 				return false;
 			}
 
 			tok = readFXmpToken(stream);
 			if (tok.type != FXMP_TOKEN_INT) {
-				warning("Cast::readFXmpLine: Expected INT, got %s", FXmpTokenTypeStrings[tok.type]);
+				warning("BUILDBOT: Cast::readFXmpLine: Expected INT, got %s", FXmpTokenTypeStrings[tok.type]);
 				return false;
 			}
 			byte toChar = atoi(tok.str.c_str());
@@ -356,7 +356,7 @@ bool Cast::readFXmpLine(Common::SeekableReadStreamEndian &stream) {
 		// to font
 		tok = readFXmpToken(stream);
 		if (tok.type != FXMP_TOKEN_WORD && tok.type != FXMP_TOKEN_STRING) {
-			warning("Cast::readFXmpLine: Expected WORD or STRING, got %s", FXmpTokenTypeStrings[tok.type]);
+			warning("BUILDBOT: Cast::readFXmpLine: Expected WORD or STRING, got %s", FXmpTokenTypeStrings[tok.type]);
 			delete info;
 			return false;
 		}
@@ -368,7 +368,7 @@ bool Cast::readFXmpLine(Common::SeekableReadStreamEndian &stream) {
 		info->remapChars = true;
 		if (tok.type == FXMP_TOKEN_WORD) {
 			if (!tok.str.equalsIgnoreCase("Map")) {
-				warning("Cast::readFXmpLine: Expected 'Map', got '%s'", tok.str.c_str());
+				warning("BUILDBOT: Cast::readFXmpLine: Expected 'Map', got '%s'", tok.str.c_str());
 				delete info;
 				return false;
 			}
@@ -379,7 +379,7 @@ bool Cast::readFXmpLine(Common::SeekableReadStreamEndian &stream) {
 			} else if (tok.str.equalsIgnoreCase("None")) {
 				info->remapChars = false;
 			} else {
-				warning("Cast::readFXmpLine: Expected 'All' or 'None', got '%s'", tok.str.c_str());
+				warning("BUILDBOT: Cast::readFXmpLine: Expected 'All' or 'None', got '%s'", tok.str.c_str());
 				delete info;
 				return false;
 			}
@@ -390,7 +390,7 @@ bool Cast::readFXmpLine(Common::SeekableReadStreamEndian &stream) {
 		// size mappings
 		while (tok.type != FXMP_TOKEN_NEWLINE && tok.type != FXMP_TOKEN_EOF) {
 			if (tok.type != FXMP_TOKEN_INT) {
-				warning("Cast::readFXmpLine: Expected INT, got %s", FXmpTokenTypeStrings[tok.type]);
+				warning("BUILDBOT: Cast::readFXmpLine: Expected INT, got %s", FXmpTokenTypeStrings[tok.type]);
 				delete info;
 				return false;
 			}
@@ -398,14 +398,14 @@ bool Cast::readFXmpLine(Common::SeekableReadStreamEndian &stream) {
 
 			tok = readFXmpToken(stream);
 			if (tok.type != FXMP_TOKEN_ARROW) {
-				warning("Cast::readFXmpLine: Expected ARROW, got %s", FXmpTokenTypeStrings[tok.type]);
+				warning("BUILDBOT: Cast::readFXmpLine: Expected ARROW, got %s", FXmpTokenTypeStrings[tok.type]);
 				delete info;
 				return false;
 			}
 
 			tok = readFXmpToken(stream);
 			if (tok.type != FXMP_TOKEN_INT) {
-				warning("Cast::readFXmpLine: Expected INT, got %s", FXmpTokenTypeStrings[tok.type]);
+				warning("BUILDBOT: Cast::readFXmpLine: Expected INT, got %s", FXmpTokenTypeStrings[tok.type]);
 				delete info;
 				return false;
 			}




More information about the Scummvm-git-logs mailing list