DIRECTOR: Add version cutoff for cast member loaders

This commit is contained in:
Scott Percival 2023-05-02 20:03:20 +08:00 committed by Eugene Sandulenko
parent a439d0c790
commit b26a6f304f
7 changed files with 38 additions and 18 deletions

View File

@ -133,6 +133,8 @@ BitmapCastMember::BitmapCastMember(Cast *cast, uint16 castId, Common::SeekableRe
debug("BitmapCastMember: tail");
Common::hexdump(buf, tail);
}
} else {
warning("STUB: BitmapCastMember::BitmapCastMember(): Bitmaps not yet supported for version %d", version);
}
_tag = castTag;

View File

@ -422,7 +422,7 @@ void FilmLoopCastMember::load() {
warning("FilmLoopCastMember::load(): Expected 1 child for film loop cast, got %d", _children.size());
}
} else {
warning("STUB: FilmLoopCastMember::load(): Film loops not supported for version %d", _cast->_version);
warning("STUB: FilmLoopCastMember::load(): Film loops not yet supported for version %d", _cast->_version);
}
_loaded = true;

View File

@ -48,13 +48,17 @@ void PaletteCastMember::load() {
// TODO: Verify how palettes work in >D4 versions
int paletteId = 0;
if (_cast->_version >= kFileVer400 && _cast->_version < kFileVer500 && _children.size() == 1) {
paletteId = _children[0].index;
} else if (_cast->_version < kFileVer400) {
if (_cast->_version < kFileVer400) {
// For D3 and below, palette IDs are stored in the CLUT resource as cast ID + 1024
paletteId = _castId + _cast->_castIDoffset;
} else if (_cast->_version >= kFileVer400 && _cast->_version < kFileVer600) {
if (_children.size() == 1) {
paletteId = _children[0].index;
} else {
warning("PaletteCastMember::load(): Expected 1 child for palette cast, got %d", _children.size());
}
} else {
warning("PaletteCastMember::load(): Expected 1 child for palette cast, got %d", _children.size());
warning("STUB: PaletteCastMember::load(): Palettes not yet supported for version %d", _cast->_version);
}
if (paletteId) {
debugC(2, kDebugImages, "PaletteCastMember::load(): linking palette id %d to cast index %d", paletteId, _castId);

View File

@ -55,6 +55,8 @@ ScriptCastMember::ScriptCastMember(Cast *cast, uint16 castId, Common::SeekableRe
stream.readByte(); // There should be no more data
assert(stream.eos());
} else {
warning("STUB: ScriptCastMember::ScriptCastMember(): Scripts not yet supported for version %d", version);
}
}

View File

@ -33,6 +33,11 @@ ShapeCastMember::ShapeCastMember(Cast *cast, uint16 castId, Common::SeekableRead
_ink = kInkTypeCopy;
if (debugChannelSet(5, kDebugLoading)) {
debugC(5, kDebugLoading, "ShapeCastMember::ShapeCastMember(): Shape data");
stream.hexdump(stream.size());
}
if (version < kFileVer400) {
unk1 = stream.readByte();
_shapeType = static_cast<ShapeType>(stream.readByte());
@ -45,7 +50,7 @@ ShapeCastMember::ShapeCastMember(Cast *cast, uint16 castId, Common::SeekableRead
_ink = static_cast<InkType>(_fillType & 0x3f);
_lineThickness = stream.readByte();
_lineDirection = stream.readByte();
} else if (version >= kFileVer400 && version < kFileVer500) {
} else if (version >= kFileVer400 && version < kFileVer600) {
unk1 = stream.readByte();
_shapeType = static_cast<ShapeType>(stream.readByte());
_initialRect = Movie::readRect(stream);
@ -57,12 +62,8 @@ ShapeCastMember::ShapeCastMember(Cast *cast, uint16 castId, Common::SeekableRead
_lineThickness = stream.readByte();
_lineDirection = stream.readByte();
} else {
stream.readByte(); // FIXME: Was this copied from D4 by mistake?
unk1 = stream.readByte();
_initialRect = Movie::readRect(stream);
_boundingRect = Movie::readRect(stream);
warning("STUB: ShapeCastMember::ShapeCastMember(): not yet implemented");
unk1 = 0;
_shapeType = kShapeRectangle;
_pattern = 0;
_fgCol = _bgCol = 0;

View File

@ -48,12 +48,23 @@ void SoundCastMember::load() {
if (_loaded)
return;
uint32 tag = MKTAG('S', 'N', 'D', ' ');
uint16 sndId = (uint16)(_castId + _cast->_castIDoffset);
uint32 tag = 0;
uint16 sndId = 0;
if (_cast->_version >= kFileVer400 && _children.size() > 0) {
sndId = _children[0].index;
tag = _children[0].tag;
if (_cast->_version < kFileVer400) {
tag = MKTAG('S', 'N', 'D', ' ');
sndId = (uint16)(_castId + _cast->_castIDoffset);
} else if (_cast->_version >= kFileVer400 && _cast->_version < kFileVer500) {
if (_children.size() > 0) {
sndId = _children[0].index;
tag = _children[0].tag;
} else {
warning("SoundCastMember::load(): could not find child reference, falling back to D3");
tag = MKTAG('S', 'N', 'D', ' ');
sndId = (uint16)(_castId + _cast->_castIDoffset);
}
} else {
warning("STUB: SoundCastMember::SoundCastMember(): Sounds not yet supported for version %d", _cast->_version);
}
Common::SeekableReadStreamEndian *sndData = _cast->getResource(tag, sndId);

View File

@ -321,7 +321,7 @@ void Lingo::printSTUBWithArglist(const char *funcname, int nargs, const char *pr
s += ")";
debug(5, "%s %s", prefix, s.c_str());
debug(3, "%s %s", prefix, s.c_str());
}
void Lingo::convertVOIDtoString(int arg, int nargs) {