DIRECTOR: More debug output to CASt resource loading

This commit is contained in:
Eugene Sandulenko 2016-11-08 10:28:53 +01:00
parent f11033df65
commit b0f30906df
3 changed files with 54 additions and 22 deletions

View File

@ -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);
}

View File

@ -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<Common::String> castStrings = loadStrings(stream, entryType);
Common::Array<Common::String> 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)

View File

@ -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 {