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

stevenhoefel stevenhoefel at hotmail.com
Tue Apr 4 12:10:11 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:
d52d58d3dd DIRECTOR: Initial work to load D5 assets.


Commit: d52d58d3dd79bfc0a656732c63b3b31bd89e09c6
    https://github.com/scummvm/scummvm/commit/d52d58d3dd79bfc0a656732c63b3b31bd89e09c6
Author: stevenhoefel (stevenhoefel at hotmail.com)
Date: 2017-04-04T20:09:57+10:00

Commit Message:
DIRECTOR: Initial work to load D5 assets.

Changed paths:
    engines/director/cast.cpp
    engines/director/detection_tables.h
    engines/director/events.cpp
    engines/director/score.cpp


diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp
index 0f63a96..1bd554f 100644
--- a/engines/director/cast.cpp
+++ b/engines/director/cast.cpp
@@ -40,7 +40,7 @@ BitmapCast::BitmapCast(Common::ReadStreamEndian &stream, uint16 version) {
 			unk1 = stream.readUint16();
 			unk2 = stream.readUint16();
 		}
-	} else {
+	} else if (version == 4) {
 		stream.readByte();
 		stream.readByte();
 
@@ -65,6 +65,39 @@ BitmapCast::BitmapCast(Common::ReadStreamEndian &stream, uint16 version) {
 		}
 
 		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();
+
+		uint16 count = stream.readUint16();
+		for (uint16 cc = 0; cc < count; cc++)
+			stream.readUint32();
+
+		stream.readUint32();
+		byte stringLength = stream.readByte();
+		char* string = new char[stringLength];
+		stream.read(string, stringLength);
+
+		stream.readUint16();
+		/*node.x1 = stream.readUint16();
+		if (node.x1 > 2048) node.x1 = -(0xffff - node.x1);
+		node.y1 = ReadWordAsInt(ref start, true);
+		if (node.y1 > 2048) node.y1 = -(0xffff - node.y1);
+		node.x2 = ReadWordAsInt(ref start, true);
+		node.y2 = ReadWordAsInt(ref start, true);*/
+
+		initialRect = Score::readRect(stream);
+
+		//node.h = (node.x2 - node.x1);
+		//node.w = (node.y2 - node.y1);
+
+		stream.readUint16(); 
+		stream.readUint16();
+
+		bitsPerPixel = stream.readUint16();
 	}
 	modified = 0;
 }
diff --git a/engines/director/detection_tables.h b/engines/director/detection_tables.h
index 798326b..1ee5d76 100644
--- a/engines/director/detection_tables.h
+++ b/engines/director/detection_tables.h
@@ -221,6 +221,20 @@ static const DirectorGameDescription gameDescriptions[] = {
 		5
 	},
 
+	{
+		{
+			"gadget",
+			"Gadget: Past as Future",
+			AD_ENTRY1s("GADGET.EXE", "d62438566e44826960fc16c5c23dbe43", 2212541),
+			Common::EN_ANY,
+			Common::kPlatformWindows,
+			ADGF_NO_FLAGS, //ADGF_HICOLOR,
+			GUIO1(GUIO_NOASPECT)
+		},
+		GID_GENERIC,
+		5
+	},
+
 	{ AD_TABLE_END_MARKER, GID_GENERIC, 0 }
 };
 
diff --git a/engines/director/events.cpp b/engines/director/events.cpp
index f4806f3..f55a7c8 100644
--- a/engines/director/events.cpp
+++ b/engines/director/events.cpp
@@ -92,8 +92,8 @@ void DirectorEngine::processEvents() {
 
 				if (getVersion() > 3) {
 					// TODO: check that this is the order of script execution!
-					_lingo->processEvent(kEventNone, kCastScript, currentFrame->_sprites[spriteId]->_castId);
-					_lingo->processEvent(kEventNone, kSpriteScript, currentFrame->_sprites[spriteId]->_scriptId);
+					_lingo->processEvent(kEventMouseUp, kCastScript, currentFrame->_sprites[spriteId]->_castId);
+					_lingo->processEvent(kEventMouseUp, kSpriteScript, currentFrame->_sprites[spriteId]->_scriptId);
 				} else {
 					// Frame script overrides sprite script
 					if (!currentFrame->_sprites[spriteId]->_scriptId)
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 5f9b916..9861e1e 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -130,13 +130,14 @@ void Score::loadArchive() {
 	}
 
 	assert(_movieArchive->hasResource(MKTAG('V', 'W', 'S', 'C'), 1024));
-	assert(_movieArchive->hasResource(MKTAG('V', 'W', 'C', 'F'), 1024));
-
 	loadFrames(*_movieArchive->getResource(MKTAG('V', 'W', 'S', 'C'), 1024));
-	loadConfig(*_movieArchive->getResource(MKTAG('V', 'W', 'C', 'F'), 1024));
+	
+
+	if (_movieArchive->hasResource(MKTAG('V', 'W', 'C', 'F'), -1)) {
+		loadConfig(*_movieArchive->getResource(MKTAG('V', 'W', 'C', 'F'), 1024));
+	}
 
-	if (_vm->getVersion() < 4) {
-		assert(_movieArchive->hasResource(MKTAG('V', 'W', 'C', 'R'), 1024));
+	if (_movieArchive->hasResource(MKTAG('V', 'W', 'C', 'R'), -1)) {
 		loadCastDataVWCR(*_movieArchive->getResource(MKTAG('V', 'W', 'C', 'R'), 1024));
 	}
 
@@ -291,7 +292,7 @@ void Score::loadFrames(Common::SeekableSubReadStreamEndian &stream) {
 	uint32 size = stream.readUint32();
 	size -= 4;
 
-	if (_vm->getVersion() > 3) {
+	if (_vm->getVersion() == 4) {
 		uint32 unk1 = stream.readUint32();
 		uint32 unk2 = stream.readUint32();
 		uint16 unk3 = stream.readUint16();
@@ -302,6 +303,26 @@ void Score::loadFrames(Common::SeekableSubReadStreamEndian &stream) {
 
 		warning("STUB: Score::loadFrames. unk1: %x unk2: %x unk3: %x unk4: %x unk5: %x unk6: %x", unk1, unk2, unk3, unk4, unk5, unk6);
 		// Unknown, some bytes - constant (refer to contuinity).
+	} else if (_vm->getVersion() > 4) {
+		//what data is up the top of D5 VWSC?
+		stream.readUint32();
+		stream.readUint32();
+		uint32 blockSize = stream.readUint32() - 1;
+		stream.readUint32();
+		stream.readUint32();
+		stream.readUint32();
+		stream.readUint32();
+		for (int skip = 0; skip <  blockSize * 4; skip++)
+			stream.readByte();
+
+		//header number two... this is our actual score entry point.
+		uint32 unk1 = stream.readUint32();
+		uint32 unk2 = stream.readUint32();
+		stream.readUint32();
+		uint16 unk3 = stream.readUint16();
+		uint16 unk4 = stream.readUint16();
+		uint16 unk5 = stream.readUint16();
+		uint16 unk6 = stream.readUint16();
 	}
 
 	uint16 channelSize;
@@ -320,36 +341,39 @@ void Score::loadFrames(Common::SeekableSubReadStreamEndian &stream) {
 	while (size != 0 && !stream.eos()) {
 		uint16 frameSize = stream.readUint16();
 		debugC(kDebugLoading, 8, "++++ score frame %d (frameSize %d) size %d", _frames.size(), frameSize, size);
-		size -= frameSize;
-		frameSize -= 2;
 
-		Frame *frame = new Frame(_vm);
-
-		while (frameSize != 0) {
-			if (_vm->getVersion() < 4) {
-				channelSize = stream.readByte() * 2;
-				channelOffset = stream.readByte() * 2;
-				frameSize -= channelSize + 2;
-			} else {
-				channelSize = stream.readUint16();
-				channelOffset = stream.readUint16();
-				frameSize -= channelSize + 4;
-			}
+		if (frameSize > 0) {
+			Frame *frame = new Frame(_vm);
+			size -= frameSize;
+			frameSize -= 2;
 
-			assert(channelOffset + channelSize < kChannelDataSize);
+			while (frameSize != 0) {
 
-			stream.read(&channelData[channelOffset], channelSize);
-		}
+				if (_vm->getVersion() < 4) {
+					channelSize = stream.readByte() * 2;
+					channelOffset = stream.readByte() * 2;
+					frameSize -= channelSize + 2;
+				} else {
+					channelSize = stream.readUint16();
+					channelOffset = stream.readUint16();
+					frameSize -= channelSize + 4;
+				}
 
-		Common::MemoryReadStreamEndian *str = new Common::MemoryReadStreamEndian(channelData, ARRAYSIZE(channelData), stream.isBE());
-		//Common::hexdump(channelData, ARRAYSIZE(channelData));
-		frame->readChannels(str);
+				assert(channelOffset + channelSize < kChannelDataSize);
+				stream.read(&channelData[channelOffset], channelSize);
+			}
 
-		debugC(3, kDebugLoading, "Frame %d actionId: %d", _frames.size(), frame->_actionId);
+			Common::MemoryReadStreamEndian *str = new Common::MemoryReadStreamEndian(channelData, ARRAYSIZE(channelData), stream.isBE());
+			frame->readChannels(str);
+			delete str;
 
-		delete str;
+			debugC(3, kDebugLoading, "Frame %d actionId: %d", _frames.size(), frame->_actionId);
 
-		_frames.push_back(frame);
+			_frames.push_back(frame);
+		} else {
+			warning("zero sized frame!? exiting loop until we know what to do with the tags that follow.");
+			size = 0;
+		}
 	}
 }
 
@@ -409,7 +433,7 @@ void Score::loadCastDataVWCR(Common::SeekableSubReadStreamEndian &stream) {
 			_castTypes[id] = kCastButton;
 			break;
 		default:
-			warning("Score::loadCastDataVWCR(): Unhandled cast type: %d", castType);
+			warning("Score::loadCastDataVWCR(): Unhandled cast type: %d [%s]", castType, tag2str(castType));
 			stream.skip(size - 1);
 			break;
 		}
@@ -479,7 +503,7 @@ void Score::loadCastData(Common::SeekableSubReadStreamEndian &stream, uint16 id,
 	byte unk1 = 0, unk2 = 0, unk3 = 0;
 
 	if (_vm->getVersion() <= 3) {
-		size1 = stream.readUint16();
+		size1 = stream.readUint16() + 16;
 		size2 = stream.readUint32();
 		size3 = 0;
 		castType = stream.readByte();
@@ -487,28 +511,29 @@ void Score::loadCastData(Common::SeekableSubReadStreamEndian &stream, uint16 id,
 		unk2 = stream.readByte();
 		unk3 = stream.readByte();
 	} else if (_vm->getVersion() == 4) {
-		size1 = stream.readUint16() + 2;
+		size1 = stream.readUint16() + 2 + 16;
 		size2 = stream.readUint32();
 		size3 = 0;
 		castType = stream.readByte();
 		unk1 = stream.readByte();
-	} else {
+	} else if (_vm->getVersion() == 5) {
 		// FIXME: only the cast type and the strings are good
 		castType = stream.readUint32();
-		size2 = stream.readUint32();
+
 		size3 = stream.readUint32();
-		size1 = stream.readUint32();
-		assert(size1 == 0x14);
-		size1 = 0;
+		size2 = stream.readUint32();
+		size1 = stream.readUint32() - 4;
+		// assert(size1 == 0x14);
+		// size1 = 0;
 	}
 
 	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 + 16, 1); // 16 is for bounding rects
-	stream.read(data, size1 + 16);
+	byte *data = (byte *)calloc(size1, 1); // 16 is for bounding rects
+	stream.read(data, size1);
 
-	Common::MemoryReadStreamEndian castStream(data, size1 + 16, stream.isBE());
+	Common::MemoryReadStreamEndian castStream(data, size1, stream.isBE());
 
 	switch (castType) {
 	case kCastBitmap:
@@ -540,7 +565,7 @@ void Score::loadCastData(Common::SeekableSubReadStreamEndian &stream, uint16 id,
 		_castTypes[id] = kCastLingoScript;
 		break;
 	default:
-		warning("Score::loadCastData(): Unhandled cast type: %d", castType);
+		warning("Score::loadCastData(): Unhandled cast type: %d [%s]", castType, tag2str(castType));
 		break;
 	}
 





More information about the Scummvm-git-logs mailing list