diff options
-rw-r--r-- | engines/director/archive.cpp | 4 | ||||
-rw-r--r-- | engines/director/cast.cpp | 9 | ||||
-rw-r--r-- | engines/director/director.cpp | 4 | ||||
-rw-r--r-- | engines/director/resource.cpp | 11 | ||||
-rw-r--r-- | engines/director/score.cpp | 30 |
5 files changed, 33 insertions, 25 deletions
diff --git a/engines/director/archive.cpp b/engines/director/archive.cpp index ea25dc7847..09be707129 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 9fe84b4a9b..1772dd4442 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 70d5cf3c62..ec35022b4a 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 dc961b86eb..da3b1b2fed 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 0e9b51e64e..fd9e4022c9 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: |