[Scummvm-git-logs] scummvm master -> bcc3fffc2d5f48adc3dc2618cba9b5fa5093ca62

stevenhoefel stevenhoefel at hotmail.com
Thu Apr 13 06:41:15 CEST 2017


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:
bcc3fffc2d DIRECTOR: D5 Shared Cast loading.


Commit: bcc3fffc2d5f48adc3dc2618cba9b5fa5093ca62
    https://github.com/scummvm/scummvm/commit/bcc3fffc2d5f48adc3dc2618cba9b5fa5093ca62
Author: stevenhoefel (stevenhoefel at hotmail.com)
Date: 2017-04-13T14:41:00+10:00

Commit Message:
DIRECTOR: D5 Shared Cast loading.

Changed paths:
    engines/director/archive.cpp
    engines/director/cast.cpp
    engines/director/director.cpp
    engines/director/resource.cpp
    engines/director/score.cpp


diff --git a/engines/director/archive.cpp b/engines/director/archive.cpp
index ea25dc7..09be707 100644
--- a/engines/director/archive.cpp
+++ b/engines/director/archive.cpp
@@ -357,7 +357,9 @@ bool RIFXArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff
 
 	uint32 rifxType = subStream.readUint32();
 
-	if (rifxType != MKTAG('M', 'V', '9', '3') && rifxType != MKTAG('A', 'P', 'P', 'L'))
+	if (rifxType != MKTAG('M', 'V', '9', '3') && 
+		rifxType != MKTAG('A', 'P', 'P', 'L') && 
+		rifxType != MKTAG('M', 'C', '9', '5'))
 		return false;
 
 	if (subStream.readUint32() != MKTAG('i', 'm', 'a', 'p'))
diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp
index 9fe84b4..1772dd4 100644
--- a/engines/director/cast.cpp
+++ b/engines/director/cast.cpp
@@ -66,15 +66,6 @@ BitmapCast::BitmapCast(Common::ReadStreamEndian &stream, uint32 castTag, uint16
 
 		warning("BitmapCast: %d bytes left", tail);
 	} else if (version == 5) {
-		// WIP!
-		uint32 unk1 = stream.readUint32();
-		uint32 unk2 = stream.readUint32();
-		uint32 unk3 = stream.readUint32();
-		uint32 unk4 = stream.readUint32();
-		uint32 unk5 = stream.readUint32();
-		uint32 unk6 = stream.readUint32();
-		uint32 unk7 = stream.readUint32();
-
 		uint16 count = stream.readUint16();
 		for (uint16 cc = 0; cc < count; cc++)
 			stream.readUint32();
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 70d5cf3..ec35022 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -152,6 +152,10 @@ Common::Error DirectorEngine::run() {
 		} else {
 			_sharedCastFile = "Shared Cast";
 		}
+	} else if (getVersion() == 5) {
+		if (getPlatform() == Common::kPlatformWindows) {
+			_sharedCastFile = "SHARED.Cxt";
+		}
 	} else {
 		_sharedCastFile = "Shared.dir";
 	}
diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp
index dc961b8..da3b1b2 100644
--- a/engines/director/resource.cpp
+++ b/engines/director/resource.cpp
@@ -40,7 +40,10 @@ Archive *DirectorEngine::createArchive() {
 		else
 			return new RIFXArchive();
 	} else {
-		return new RIFFArchive();
+		if (getVersion() < 4)
+			return new RIFFArchive();
+		else
+			return new RIFXArchive();
 	}
 }
 
@@ -269,8 +272,10 @@ void DirectorEngine::loadSharedCastsFrom(Common::String filename) {
 	if (cast.size() > 0) {
 		debug(0, "****** Loading %d CASt resources", cast.size());
 
-		for (Common::Array<uint16>::iterator iterator = cast.begin(); iterator != cast.end(); ++iterator)
-			_sharedScore->loadCastData(*shardcst->getResource(MKTAG('C','A','S','t'), *iterator), *iterator, NULL);
+		for (Common::Array<uint16>::iterator iterator = cast.begin(); iterator != cast.end(); ++iterator) {
+			Resource res = shardcst->getResourceDetail(MKTAG('C', 'A', 'S', 't'), *iterator);
+			_sharedScore->loadCastData(*shardcst->getResource(MKTAG('C', 'A', 'S', 't'), *iterator), *iterator, &res);
+		}
 	}
 
 	Common::Array<uint16> vwci = shardcst->getResourceIDList(MKTAG('V', 'W', 'C', 'I'));
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 0e9b51e..fd9e402 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -138,6 +138,7 @@ void Score::loadArchive() {
 	} else {
 		// TODO: Source this from somewhere!
 		_movieRect = Common::Rect(0, 0, 640, 480);
+		_stageColor = 1;
 	}
 
 	if (_movieArchive->hasResource(MKTAG('V', 'W', 'C', 'R'), -1)) {
@@ -242,7 +243,7 @@ void Score::loadSpriteImages(bool isSharedCast) {
 			debugC(4, kDebugImages, "id: %d, w: %d, h: %d, flags: %x, some: %x, unk1: %d, unk2: %d",
 				imgId, w, h, bitmapCast->flags, bitmapCast->someFlaggyThing, bitmapCast->unk1, bitmapCast->unk2);
 
-			if (pic != NULL && bitmapCast != NULL) {
+			if (pic != NULL && bitmapCast != NULL && w > 0 && h > 0) {
 				if (_vm->getVersion() < 4) {
 					img = new BITDDecoder(w, h);
 				} else if (_vm->getVersion() < 6) {
@@ -377,6 +378,7 @@ void Score::loadFrames(Common::SeekableSubReadStreamEndian &stream) {
 			}
 
 			Common::MemoryReadStreamEndian *str = new Common::MemoryReadStreamEndian(channelData, ARRAYSIZE(channelData), stream.isBE());
+			// str->hexdump(str->size(), 32);
 			frame->readChannels(str);
 			delete str;
 
@@ -513,11 +515,12 @@ void Score::loadCastData(Common::SeekableSubReadStreamEndian &stream, uint16 id,
 	if (debugChannelSet(5, kDebugLoading) && stream.size() < 2048)
 		stream.hexdump(stream.size());
 
-	uint32 size1, size2, size3, castType;
+	uint32 size1, size2, size3, castType, sizeToRead;
 	byte unk1 = 0, unk2 = 0, unk3 = 0;
 
 	if (_vm->getVersion() <= 3) {
-		size1 = stream.readUint16() + 16; // 16 is for bounding rects
+		size1 = stream.readUint16();
+		sizeToRead = size1 +16; // 16 is for bounding rects
 		size2 = stream.readUint32();
 		size3 = 0;
 		castType = stream.readByte();
@@ -525,22 +528,25 @@ void Score::loadCastData(Common::SeekableSubReadStreamEndian &stream, uint16 id,
 		unk2 = stream.readByte();
 		unk3 = stream.readByte();
 	} else if (_vm->getVersion() == 4) {
-		size1 = stream.readUint16() + 2 + 16; // 16 is for bounding rects
+		size1 = stream.readUint16();
+		sizeToRead = size1 + 2 + 16; // 16 is for bounding rects
 		size2 = stream.readUint32();
 		size3 = 0;
 		castType = stream.readByte();
 		unk1 = stream.readByte();
 	} else if (_vm->getVersion() == 5) {
-		// FIXME: only the cast type and the strings are good
 		castType = stream.readUint32();
-
 		size3 = stream.readUint32();
 		size2 = stream.readUint32();
 		size1 = stream.readUint32();
-		// assert(size1 == 0x14);
+		if (castType == 1) {
+			if (size3 == 0) 
+				return;
+			for (int skip = 0; skip < (size1 - 4) / 4; skip++)
+				stream.readUint32();
+		}
 
-		// don't read the strings later, the full cast data is needed to be parsed.
-		size1 = stream.size();
+		sizeToRead = stream.size();
 	} else {
 		error("Score::loadCastData: unsupported Director version (%d)", _vm->getVersion());
 	}
@@ -548,10 +554,10 @@ void Score::loadCastData(Common::SeekableSubReadStreamEndian &stream, uint16 id,
 	debugC(3, kDebugLoading, "CASt: id: %d type: %x size1: %d size2: %d (%x) size3: %d unk1: %d unk2: %d unk3: %d",
 		id, castType, size1, size2, size2, size3, unk1, unk2, unk3);
 
-	byte *data = (byte *)calloc(size1, 1);
-	stream.read(data, size1);
+	byte *data = (byte *)calloc(sizeToRead, 1);
+	stream.read(data, sizeToRead);
 
-	Common::MemoryReadStreamEndian castStream(data, size1, stream.isBE());
+	Common::MemoryReadStreamEndian castStream(data, sizeToRead, stream.isBE());
 
 	switch (castType) {
 	case kCastBitmap:





More information about the Scummvm-git-logs mailing list