From b0f30906df2e96342f976f09a376b5b5022e37d5 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 8 Nov 2016 10:28:53 +0100 Subject: DIRECTOR: More debug output to CASt resource loading --- engines/director/archive.cpp | 2 +- engines/director/score.cpp | 54 +++++++++++++++++++++++++++++++++++--------- engines/director/score.h | 20 ++++++++-------- 3 files changed, 54 insertions(+), 22 deletions(-) (limited to 'engines') diff --git a/engines/director/archive.cpp b/engines/director/archive.cpp index 5102b7f71d..6e1da0c8b7 100644 --- a/engines/director/archive.cpp +++ b/engines/director/archive.cpp @@ -421,7 +421,7 @@ bool RIFXArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff uint32 index = casStream.readUint32(); const Resource &res = resources[index]; - _types[MKTAG('C', 'A', 'S', 't')][index] = res; + _types[MKTAG('C', 'A', 'S', 't')][i + 1] = res; debugCN(2, kDebugLoading, "%d ", index); } diff --git a/engines/director/score.cpp b/engines/director/score.cpp index c1b55897bd..181ed9a80f 100644 --- a/engines/director/score.cpp +++ b/engines/director/score.cpp @@ -392,17 +392,20 @@ void Score::loadCastDataD2(Common::SeekableSubReadStreamEndian &stream) { } } -void Score::loadCastData(Common::SeekableSubReadStreamEndian &stream, uint16 id) { +void Score::loadCastData(Common::SeekableSubReadStreamEndian &stream, uint16 castId) { // d4+ variant if (stream.size() == 0) return; if (stream.size() < 26) { - warning("CAST data id %d is too small", id); + warning("CAST data id %d is too small", castId); return; } - uint castId = id - 1024; + debugC(3, kDebugLoading, "CASt: id: %d", castId); + + if (debugChannelSet(5, kDebugLoading)) + stream.hexdump(stream.size()); uint32 size1, size2, size3, castType; byte blob[3]; @@ -424,7 +427,32 @@ void Score::loadCastData(Common::SeekableSubReadStreamEndian &stream, uint16 id) blob[0] = blob[1] = blob[2] = 0; } - warning("type: %x", castType); + debugC(3, kDebugLoading, "CASt: id: %d type: %x size1: %d size2: %d (%x) size3: %d", castId, castType, size1, size2, size2, size3); + +#if 0 + switch (castType) { + case kCastBitmap: + _casts[id] = new BitmapCast(stream); + _casts[id]->type = kCastBitmap; + break; + case kCastText: + _casts[id] = new TextCast(stream); + _casts[id]->type = kCastText; + break; + case kCastShape: + _casts[id] = new ShapeCast(stream); + _casts[id]->type = kCastShape; + break; + case kCastButton: + _casts[id] = new ButtonCast(stream); + _casts[id]->type = kCastButton; + break; + default: + warning("Unhandled cast type: %d", castType); + stream.skip(size - 1); + break; + } +#endif Score::readRect(stream); Score::readRect(stream); @@ -434,14 +462,18 @@ void Score::loadCastData(Common::SeekableSubReadStreamEndian &stream, uint16 id) //member.regX = 0 // FIXME: HACK //member.regY = 0 // FIXME: HACK - byte *data = (byte *)calloc(size1, 1); - stream.read(data, size1); - Common::hexdump(data, size1); - free(data); - if (size2) { uint32 entryType = 0; - Common::Array castStrings = loadStrings(stream, entryType); + Common::Array castStrings = loadStrings(stream, entryType, false); + + debugCN(4, kDebugLoading, "str(%d): '", castStrings.size()); + + for (uint i = 0; i < castStrings.size(); i++) { + debugCN(4, kDebugLoading, "%s'", castStrings[i].c_str()); + if (i != castStrings.size() - 1) + debugCN(4, kDebugLoading, ", '"); + } + debugC(4, kDebugLoading, "'"); CastInfo *ci = new CastInfo(); @@ -451,7 +483,7 @@ void Score::loadCastData(Common::SeekableSubReadStreamEndian &stream, uint16 id) ci->fileName = castStrings[3]; ci->type = castStrings[4]; - _castsInfo[id] = ci; + _castsInfo[castId] = ci; } if (size3) diff --git a/engines/director/score.h b/engines/director/score.h index 5721532d58..a60f2d7c5a 100644 --- a/engines/director/score.h +++ b/engines/director/score.h @@ -42,16 +42,16 @@ class Sprite; enum CastType { kCastBitmap = 1, - kCastFilmLoop, - kCastText, - kCastPalette, - kCastPicture, - kCastSound, - kCastButton, - kCastShape, - kCastMovie, - kCastDigitalVideo, - kCastScript + kCastFilmLoop = 2, + kCastText = 3, + kCastPalette = 4, + kCastPicture = 5, + kCastSound = 6, + kCastButton = 7, + kCastShape = 8, + kCastMovie = 9, + kCastDigitalVideo = 10, + kCastScript = 11 }; enum ScriptType { -- cgit v1.2.3