[Scummvm-git-logs] scummvm master -> ed8ca876e39a60ca687e51bf25507cdd3806532d
djsrv
dservilla at gmail.com
Mon Jun 7 18:50:48 UTC 2021
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
d6b6cc6f18 DIRECTOR: Create FileVersion enum
d91e3d5148 DIRECTOR: Move humanVersion to util.cpp
ed8ca876e3 DIRECTOR: Use version from VWCF for loading
Commit: d6b6cc6f18875cb6fb3020f1cedf06b76c4e193b
https://github.com/scummvm/scummvm/commit/d6b6cc6f18875cb6fb3020f1cedf06b76c4e193b
Author: djsrv (dservilla at gmail.com)
Date: 2021-06-07T14:48:48-04:00
Commit Message:
DIRECTOR: Create FileVersion enum
Changed paths:
engines/director/cast.cpp
engines/director/types.h
diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp
index 4c8e040c41..55eba6c43b 100644
--- a/engines/director/cast.cpp
+++ b/engines/director/cast.cpp
@@ -364,33 +364,33 @@ bool Cast::loadArchive() {
}
uint16 humanVersion(uint16 ver) {
- if (ver >= 0x79F)
+ if (ver >= kFileVer1201)
return 1201;
- if (ver >= 0x783)
+ if (ver >= kFileVer1200)
return 1200;
- if (ver >= 0x782)
+ if (ver >= kFileVer1150)
return 1150;
- if (ver >= 0x781)
+ if (ver >= kFileVer1100)
return 1100;
- if (ver >= 0x73B)
+ if (ver >= kFileVer1000)
return 1000;
- if (ver >= 0x6A4)
+ if (ver >= kFileVer850)
return 850;
- if (ver >= 0x582)
+ if (ver >= kFileVer800)
return 800;
- if (ver >= 0x4C8)
+ if (ver >= kFileVer700)
return 700;
- if (ver >= 0x4C2)
+ if (ver >= kFileVer600)
return 600;
- if (ver >= 0x4B1)
+ if (ver >= kFileVer500)
return 500;
- if (ver >= 0x45D)
+ if (ver >= kFileVer404)
return 404;
- if (ver >= 0x45B)
+ if (ver >= kFileVer400)
return 400;
- if (ver >= 0x405)
+ if (ver >= kFileVer310)
return 310;
- if (ver >= 0x404)
+ if (ver >= kFileVer300)
return 300;
return 200;
}
diff --git a/engines/director/types.h b/engines/director/types.h
index 6114b3e8b4..a3ac33e517 100644
--- a/engines/director/types.h
+++ b/engines/director/types.h
@@ -314,6 +314,23 @@ enum ChunkType {
kChunkLine
};
+enum FileVersion {
+ kFileVer300 = 0x404,
+ kFileVer310 = 0x405,
+ kFileVer400 = 0x45B,
+ kFileVer404 = 0x45D,
+ kFileVer500 = 0x4B1,
+ kFileVer600 = 0x4C2,
+ kFileVer700 = 0x4C8,
+ kFileVer800 = 0x582,
+ kFileVer850 = 0x6A4,
+ kFileVer1000 = 0x73B,
+ kFileVer1100 = 0x781,
+ kFileVer1150 = 0x782,
+ kFileVer1200 = 0x783,
+ kFileVer1201 = 0x79F
+};
+
struct Datum;
struct PCell;
typedef Common::Array<Datum> DatumArray;
Commit: d91e3d51486b1416e93ac6f01063a7abd0b51e6e
https://github.com/scummvm/scummvm/commit/d91e3d51486b1416e93ac6f01063a7abd0b51e6e
Author: djsrv (dservilla at gmail.com)
Date: 2021-06-07T14:48:48-04:00
Commit Message:
DIRECTOR: Move humanVersion to util.cpp
Changed paths:
engines/director/cast.cpp
engines/director/util.cpp
engines/director/util.h
diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp
index 55eba6c43b..052b557ccc 100644
--- a/engines/director/cast.cpp
+++ b/engines/director/cast.cpp
@@ -363,38 +363,6 @@ bool Cast::loadArchive() {
return true;
}
-uint16 humanVersion(uint16 ver) {
- if (ver >= kFileVer1201)
- return 1201;
- if (ver >= kFileVer1200)
- return 1200;
- if (ver >= kFileVer1150)
- return 1150;
- if (ver >= kFileVer1100)
- return 1100;
- if (ver >= kFileVer1000)
- return 1000;
- if (ver >= kFileVer850)
- return 850;
- if (ver >= kFileVer800)
- return 800;
- if (ver >= kFileVer700)
- return 700;
- if (ver >= kFileVer600)
- return 600;
- if (ver >= kFileVer500)
- return 500;
- if (ver >= kFileVer404)
- return 404;
- if (ver >= kFileVer400)
- return 400;
- if (ver >= kFileVer310)
- return 310;
- if (ver >= kFileVer300)
- return 300;
- return 200;
-}
-
void Cast::loadConfig(Common::SeekableReadStreamEndian &stream) {
debugC(1, kDebugLoading, "****** Loading Config VWCF");
diff --git a/engines/director/util.cpp b/engines/director/util.cpp
index 656cea5dfa..30ac00238f 100644
--- a/engines/director/util.cpp
+++ b/engines/director/util.cpp
@@ -693,4 +693,36 @@ Common::SeekableReadStreamEndian *readZlibData(Common::SeekableReadStream &strea
# endif
}
+uint16 humanVersion(uint16 ver) {
+ if (ver >= kFileVer1201)
+ return 1201;
+ if (ver >= kFileVer1200)
+ return 1200;
+ if (ver >= kFileVer1150)
+ return 1150;
+ if (ver >= kFileVer1100)
+ return 1100;
+ if (ver >= kFileVer1000)
+ return 1000;
+ if (ver >= kFileVer850)
+ return 850;
+ if (ver >= kFileVer800)
+ return 800;
+ if (ver >= kFileVer700)
+ return 700;
+ if (ver >= kFileVer600)
+ return 600;
+ if (ver >= kFileVer500)
+ return 500;
+ if (ver >= kFileVer404)
+ return 404;
+ if (ver >= kFileVer400)
+ return 400;
+ if (ver >= kFileVer310)
+ return 310;
+ if (ver >= kFileVer300)
+ return 300;
+ return 200;
+}
+
} // End of namespace Director
diff --git a/engines/director/util.h b/engines/director/util.h
index 3918b3fb65..8351ae53e2 100644
--- a/engines/director/util.h
+++ b/engines/director/util.h
@@ -80,6 +80,8 @@ uint32 readVarInt(Common::SeekableReadStream &stream);
Common::SeekableReadStreamEndian *readZlibData(Common::SeekableReadStream &stream, unsigned long len, unsigned long *outLen, bool bigEndian);
+uint16 humanVersion(uint16 ver);
+
} // End of namespace Director
#endif
Commit: ed8ca876e39a60ca687e51bf25507cdd3806532d
https://github.com/scummvm/scummvm/commit/ed8ca876e39a60ca687e51bf25507cdd3806532d
Author: djsrv (dservilla at gmail.com)
Date: 2021-06-07T14:48:48-04:00
Commit Message:
DIRECTOR: Use version from VWCF for loading
Changed paths:
engines/director/cast.cpp
engines/director/cast.h
engines/director/castmember.cpp
engines/director/frame.cpp
engines/director/frame.h
engines/director/lingo/lingo-bytecode.cpp
engines/director/lingo/lingo.h
engines/director/movie.cpp
engines/director/movie.h
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp
index 052b557ccc..7a3096f681 100644
--- a/engines/director/cast.cpp
+++ b/engines/director/cast.cpp
@@ -182,7 +182,7 @@ Common::String Cast::getString(Common::String str) {
}
//TODO: check if all versions need to cut off the first character.
- if (_vm->getVersion() >= 400) {
+ if (_version >= kFileVer400) {
str.deleteChar(0);
}
@@ -203,7 +203,95 @@ void Cast::setArchive(Archive *archive) {
}
}
-bool Cast::loadArchive() {
+void Cast::loadArchive() {
+ loadConfig();
+ loadCast();
+}
+
+void Cast::loadConfig() {
+ if (!_castArchive->hasResource(MKTAG('V', 'W', 'C', 'F'), -1)) {
+ error("Cast::loadConfig(): no VWCF");
+ }
+
+ Common::SeekableReadStreamEndian *stream = _castArchive->getFirstResource(MKTAG('V', 'W', 'C', 'F'));
+
+ debugC(1, kDebugLoading, "****** Loading Config VWCF");
+
+ if (debugChannelSet(5, kDebugLoading))
+ stream->hexdump(stream->size());
+
+ uint16 len = stream->readUint16();
+ uint16 fileVersion = stream->readUint16(); // TODO: very high fileVersion means protected
+ _movieRect = Movie::readRect(*stream);
+ if (!_isShared)
+ _movie->_movieRect = _movieRect;
+
+ _castArrayStart = stream->readUint16();
+ _castArrayEnd = stream->readUint16();
+ byte currentFrameRate = stream->readByte();
+ if (!_isShared) {
+ _movie->getScore()->_currentFrameRate = currentFrameRate;
+ if (_movie->getScore()->_currentFrameRate == 0)
+ _movie->getScore()->_currentFrameRate = 20;
+ }
+
+ byte lightswitch = stream->readByte();
+ uint16 unk1 = stream->readUint16();
+ uint16 commentFont = stream->readUint16();
+ uint16 commentSize = stream->readUint16();
+ uint16 commentStyle = stream->readUint16();
+ _stageColor = stream->readUint16();
+ if (!_isShared)
+ _movie->_stageColor = _vm->transformColor(_stageColor);
+
+ uint16 bitdepth = stream->readUint16();
+
+ // byte color = stream.readByte(); // boolean, color = 1, B/W = 0
+ // uint16 stageColorR = stream.readUint16();
+ // uint16 stageColorG = stream.readUint16();
+ // uint16 stageColorB = stream.readUint16();
+
+ _version = fileVersion;
+ if (_version >= kFileVer300) {
+ for (int i = 0; i < 0x06; i++) {
+ stream->readByte();
+ }
+
+ _version = stream->readUint16();
+
+ for (int i = 0; i < 0x0a; i++) {
+ stream->readByte();
+ }
+
+ if (_version >= kFileVer400) {
+ for (int i = 0; i < 0x16; i++)
+ stream->readByte();
+
+ _defaultPalette = (int16)stream->readUint16();
+
+ for (int i = 0; i < 0x08; i++)
+ stream->readByte();
+ }
+ }
+
+ uint16 humanVer = humanVersion(_version);
+ if (humanVer > _vm->getVersion()) {
+ if (_vm->getVersion() > 0)
+ warning("Movie is from later version v%d", humanVer);
+ _vm->setVersion(humanVer);
+ }
+
+ debugC(1, kDebugLoading, "Cast::loadConfig(): len: %d, ver: %d, framerate: %d, light: %d, unk: %d, font: %d, size: %d"
+ ", style: %d", len, fileVersion, currentFrameRate, lightswitch, unk1, commentFont, commentSize, commentStyle);
+ debugC(1, kDebugLoading, "Cast::loadConfig(): stagecolor: %d, depth: %d, directorVer: %d",
+ _stageColor, bitdepth, _version);
+ if (debugChannelSet(1, kDebugLoading))
+ _movieRect.debugPrint(1, "Cast::loadConfig(): Movie rect: ");
+
+ delete stream;
+}
+
+void Cast::loadCast() {
// Palette Information
Common::Array<uint16> clutList = _castArchive->getResourceIDList(MKTAG('C', 'L', 'U', 'T'));
if (clutList.size() == 0) {
@@ -219,16 +307,7 @@ bool Cast::loadArchive() {
}
}
- // Configuration Information
Common::SeekableReadStreamEndian *r = nullptr;
- if (_castArchive->hasResource(MKTAG('V', 'W', 'C', 'F'), -1)) {
- loadConfig(*(r = _castArchive->getFirstResource(MKTAG('V', 'W', 'C', 'F'))));
- delete r;
- } else if (!_isShared) {
- // TODO: Source this from somewhere!
- _movie->_movieRect = Common::Rect(0, 0, 639, 479);
- _movie->_stageColor = 1;
- }
// Font Directory
if (_castArchive->hasResource(MKTAG('F', 'O', 'N', 'D'), -1)) {
@@ -300,7 +379,7 @@ bool Cast::loadArchive() {
}
// For D4+ we may request to force Lingo scripts and skip precompiled bytecode
- if (_vm->getVersion() >= 400 && !debugChannelSet(-1, kDebugNoBytecode)) {
+ if (_version >= kFileVer400 && !debugChannelSet(-1, kDebugNoBytecode)) {
// Try to load script context
Common::Array<uint16> lctx = _castArchive->getResourceIDList(MKTAG('L','c','t','x'));
if (lctx.size() > 0) {
@@ -346,7 +425,7 @@ bool Cast::loadArchive() {
delete r;
// Try to load movie script, it starts with a comment
- if (_vm->getVersion() <= 300) {
+ if (_version <= kFileVer300) {
if (debugChannelSet(-1, kDebugFewFramesOnly))
warning("Compiling STXT %d", *iterator);
@@ -359,92 +438,6 @@ bool Cast::loadArchive() {
loadCastChildren();
loadSoundCasts();
-
- return true;
-}
-
-void Cast::loadConfig(Common::SeekableReadStreamEndian &stream) {
- debugC(1, kDebugLoading, "****** Loading Config VWCF");
-
- if (debugChannelSet(5, kDebugLoading))
- stream.hexdump(stream.size());
-
- uint16 len = stream.readUint16();
- uint16 fileVersion = stream.readUint16(); // TODO: very high fileVersion means protected
- uint16 humanFileVersion = humanVersion(fileVersion);
- Common::Rect movieRect = Movie::readRect(stream);
- if (!_isShared)
- _movie->_movieRect = movieRect;
-
- _castArrayStart = stream.readUint16();
- _castArrayEnd = stream.readUint16();
- byte currentFrameRate = stream.readByte();
- if (!_isShared) {
- _movie->getScore()->_currentFrameRate = currentFrameRate;
- if (_movie->getScore()->_currentFrameRate == 0)
- _movie->getScore()->_currentFrameRate = 20;
- }
-
- byte lightswitch = stream.readByte();
- uint16 unk1 = stream.readUint16();
- uint16 commentFont = stream.readUint16();
- uint16 commentSize = stream.readUint16();
- uint16 commentStyle = stream.readUint16();
- uint32 stageColor = _vm->transformColor(stream.readUint16());
-
- if (!_isShared)
- _movie->_stageColor = stageColor;
-
- uint16 bitdepth = stream.readUint16();
-
- // byte color = stream.readByte(); // boolean, color = 1, B/W = 0
- // uint16 stageColorR = stream.readUint16();
- // uint16 stageColorG = stream.readUint16();
- // uint16 stageColorB = stream.readUint16();
-
- uint16 directorVersion = fileVersion;
- uint16 humanDirectorVersion = humanFileVersion;
- if (humanFileVersion >= 300) {
- for (int i = 0; i < 0x06; i++) {
- stream.readByte();
- }
-
- directorVersion = stream.readUint16();
- humanDirectorVersion = humanVersion(directorVersion);
-
- for (int i = 0; i < 0x0a; i++) {
- stream.readByte();
- }
-
- if (humanDirectorVersion >= 400) {
- for (int i = 0; i < 0x16; i++)
- stream.readByte();
-
- _defaultPalette = (int16)stream.readUint16();
-
- for (int i = 0; i < 0x08; i++)
- stream.readByte();
- }
- }
-
- // FIXME: We should avoid screwing with the global VM version since
- // there can be movies in other windows or external casts from different versions.
- // Each movie/cast should probably have its own version field.
- if (humanDirectorVersion > _vm->getVersion()) {
- if (_vm->getVersion() > 0)
- warning("Movie is from later version v%d", humanDirectorVersion);
- _vm->setVersion(humanDirectorVersion);
- } else if (humanDirectorVersion < _vm->getVersion()) {
- warning("Movie is from earlier version v%d", humanDirectorVersion);
- _vm->setVersion(humanDirectorVersion);
- }
-
- debugC(1, kDebugLoading, "Cast::loadConfig(): len: %d, ver: %d, framerate: %d, light: %d, unk: %d, font: %d, size: %d"
- ", style: %d", len, fileVersion, currentFrameRate, lightswitch, unk1, commentFont, commentSize, commentStyle);
- debugC(1, kDebugLoading, "Cast::loadConfig(): stagecolor: %d, depth: %d, directorVer: %d",
- stageColor, bitdepth, directorVersion);
- if (debugChannelSet(1, kDebugLoading))
- movieRect.debugPrint(1, "Cast::loadConfig(): Movie rect: ");
}
void Cast::copyCastStxts() {
@@ -453,7 +446,7 @@ void Cast::copyCastStxts() {
continue;
uint stxtid;
- if (_vm->getVersion() >= 400 && c->_value->_children.size() > 0)
+ if (_version >= kFileVer400 && c->_value->_children.size() > 0)
stxtid = c->_value->_children[0].index;
else
stxtid = c->_key;
@@ -483,9 +476,9 @@ void Cast::loadCastChildren() {
PaletteCastMember *member = ((PaletteCastMember *)c->_value);
// TODO: Verify how palettes work in >D4 versions
- if (_vm->getVersion() >= 400 && _vm->getVersion() < 500 && member->_children.size() == 1) {
+ if (_version >= kFileVer400 && _version < kFileVer500 && member->_children.size() == 1) {
member->_palette = g_director->getPalette(member->_children[0].index);
- } else if (_vm->getVersion() < 400) {
+ } else if (_version < kFileVer400) {
// D3 palettes are always kept in this ascending order
member->_palette = g_director->getPalette((++p)->_value.id);
} else {
@@ -506,7 +499,7 @@ void Cast::loadCastChildren() {
Image::ImageDecoder *img = NULL;
Common::SeekableReadStream *pic = NULL;
- if (_vm->getVersion() >= 400) {
+ if (_version >= kFileVer400) {
if (bitmapCast->_children.size() > 0) {
imgId = bitmapCast->_children[0].index;
tag = bitmapCast->_children[0].tag;
@@ -546,7 +539,7 @@ void Cast::loadCastChildren() {
debugC(2, kDebugLoading, "****** Loading 'BITD' id: %d (%d), %d bytes", imgId, realId, pic->size());
if (w > 0 && h > 0) {
- if (_vm->getVersion() < 600) {
+ if (_version < kFileVer600) {
img = new BITDDecoder(w, h, bitmapCast->_bitsPerPixel, bitmapCast->_pitch, _vm->getPalette());
} else {
img = new Image::BitmapDecoder();
@@ -591,7 +584,7 @@ void Cast::loadSoundCasts() {
uint32 tag = MKTAG('S', 'N', 'D', ' ');
uint16 sndId = (uint16)(c->_key + _castIDoffset);
- if (_vm->getVersion() >= 400 && soundCast->_children.size() > 0) {
+ if (_version >= kFileVer400 && soundCast->_children.size() > 0) {
sndId = soundCast->_children[0].index;
tag = soundCast->_children[0].tag;
}
@@ -635,7 +628,7 @@ Common::String Cast::getVideoPath(int castId) {
uint32 tag = MKTAG('M', 'o', 'o', 'V');
uint16 videoId = (uint16)(castId + _castIDoffset);
- if (_vm->getVersion() >= 400 && digitalVideoCast->_children.size() > 0) {
+ if (_version >= kFileVer400 && digitalVideoCast->_children.size() > 0) {
videoId = digitalVideoCast->_children[0].index;
tag = digitalVideoCast->_children[0].tag;
}
@@ -728,31 +721,31 @@ void Cast::loadCastDataVWCR(Common::SeekableReadStreamEndian &stream) {
else
error("Cast::loadCastDataVWCR(): non-existent reference to BitmapCastMember");
- _loadedCast->setVal(id, new BitmapCastMember(this, id, stream, tag, _vm->getVersion(), flags1));
+ _loadedCast->setVal(id, new BitmapCastMember(this, id, stream, tag, _version, flags1));
break;
case kCastText:
debugC(3, kDebugLoading, "Cast::loadCastDataVWCR(): CastTypes id: %d(%s) TextCastMember", id, numToCastNum(id));
- _loadedCast->setVal(id, new TextCastMember(this, id, stream, _vm->getVersion(), flags1));
+ _loadedCast->setVal(id, new TextCastMember(this, id, stream, _version, flags1));
break;
case kCastShape:
debugC(3, kDebugLoading, "Cast::loadCastDataVWCR(): CastTypes id: %d(%s) ShapeCastMember", id, numToCastNum(id));
- _loadedCast->setVal(id, new ShapeCastMember(this, id, stream, _vm->getVersion()));
+ _loadedCast->setVal(id, new ShapeCastMember(this, id, stream, _version));
break;
case kCastButton:
debugC(3, kDebugLoading, "Cast::loadCastDataVWCR(): CastTypes id: %d(%s) ButtonCast", id, numToCastNum(id));
- _loadedCast->setVal(id, new TextCastMember(this, id, stream, _vm->getVersion(), flags1, true));
+ _loadedCast->setVal(id, new TextCastMember(this, id, stream, _version, flags1, true));
break;
case kCastSound:
debugC(3, kDebugLoading, "Cast::loadCastDataVWCR(): CastTypes id: %d(%s) SoundCastMember", id, numToCastNum(id));
- _loadedCast->setVal(id, new SoundCastMember(this, id, stream, _vm->getVersion()));
+ _loadedCast->setVal(id, new SoundCastMember(this, id, stream, _version));
break;
case kCastDigitalVideo:
debugC(3, kDebugLoading, "Cast::loadCastDataVWCR(): CastTypes id: %d(%s) DigitalVideoCastMember", id, numToCastNum(id));
- _loadedCast->setVal(id, new DigitalVideoCastMember(this, id, stream, _vm->getVersion()));
+ _loadedCast->setVal(id, new DigitalVideoCastMember(this, id, stream, _version));
break;
case kCastPalette:
debugC(3, kDebugLoading, "Cast::loadCastDataVWCR(): CastTypes id: %d(%s) PaletteCastMember", id, numToCastNum(id));
- _loadedCast->setVal(id, new PaletteCastMember(this, id, stream, _vm->getVersion()));
+ _loadedCast->setVal(id, new PaletteCastMember(this, id, stream, _version));
break;
default:
warning("Cast::loadCastDataVWCR(): Unhandled cast id: %d(%s), type: %d, %d bytes", id, numToCastNum(id), castType, size);
@@ -800,7 +793,7 @@ void Cast::loadCastData(Common::SeekableReadStreamEndian &stream, uint16 id, Res
// D2-3 cast members should be loaded in loadCastDataVWCR
#if 0
- if (_vm->getVersion() < 400) {
+ if (_version < kFileVer400) {
size1 = stream.readUint16();
sizeToRead = size1 +16; // 16 is for bounding rects
size2 = stream.readUint32();
@@ -812,7 +805,7 @@ void Cast::loadCastData(Common::SeekableReadStreamEndian &stream, uint16 id, Res
}
#endif
- if (_vm->getVersion() >= 400 && _vm->getVersion() < 500) {
+ if (_version >= kFileVer400 && _version < kFileVer500) {
castSize = stream.readUint16();
castSizeToRead = castSize;
castInfoSize = stream.readUint32();
@@ -825,7 +818,7 @@ void Cast::loadCastData(Common::SeekableReadStreamEndian &stream, uint16 id, Res
flags1 = stream.readByte();
castSizeToRead -= 1;
}
- } else if (_vm->getVersion() >= 500 && _vm->getVersion() < 600) {
+ } else if (_version >= kFileVer500 && _version < kFileVer600) {
castType = stream.readUint32();
size3 = stream.readUint32();
castInfoSize = stream.readUint32();
@@ -839,7 +832,7 @@ void Cast::loadCastData(Common::SeekableReadStreamEndian &stream, uint16 id, Res
castSizeToRead = stream.size();
} else {
- error("Cast::loadCastData: unsupported Director version (%d)", _vm->getVersion());
+ error("Cast::loadCastData: unsupported Director version (%d)", _version);
}
debugC(3, kDebugLoading, "Cast::loadCastData(): CASt: id: %d type: %x castSize: %d castInfoSize: %d (%x) size3: %d unk1: %d unk2: %d unk3: %d",
@@ -855,35 +848,35 @@ void Cast::loadCastData(Common::SeekableReadStreamEndian &stream, uint16 id, Res
switch (castType) {
case kCastBitmap:
debugC(3, kDebugLoading, "Cast::loadCastData(): loading kCastBitmap (%d children)", res->children.size());
- _loadedCast->setVal(id, new BitmapCastMember(this, id, castStream, res->tag, _vm->getVersion(), flags1));
+ _loadedCast->setVal(id, new BitmapCastMember(this, id, castStream, res->tag, _version, flags1));
break;
case kCastSound:
debugC(3, kDebugLoading, "Cast::loadCastData(): loading kCastSound (%d children)", res->children.size());
- _loadedCast->setVal(id, new SoundCastMember(this, id, castStream, _vm->getVersion()));
+ _loadedCast->setVal(id, new SoundCastMember(this, id, castStream, _version));
break;
case kCastText:
debugC(3, kDebugLoading, "Cast::loadCastData(): loading kCastText (%d children)", res->children.size());
- _loadedCast->setVal(id, new TextCastMember(this, id, castStream, _vm->getVersion(), flags1));
+ _loadedCast->setVal(id, new TextCastMember(this, id, castStream, _version, flags1));
break;
case kCastShape:
debugC(3, kDebugLoading, "Cast::loadCastData(): loading kCastShape (%d children)", res->children.size());
- _loadedCast->setVal(id, new ShapeCastMember(this, id, castStream, _vm->getVersion()));
+ _loadedCast->setVal(id, new ShapeCastMember(this, id, castStream, _version));
break;
case kCastButton:
debugC(3, kDebugLoading, "Cast::loadCastData(): loading kCastButton (%d children)", res->children.size());
- _loadedCast->setVal(id, new TextCastMember(this, id, castStream, _vm->getVersion(), flags1, true));
+ _loadedCast->setVal(id, new TextCastMember(this, id, castStream, _version, flags1, true));
break;
case kCastLingoScript:
debugC(3, kDebugLoading, "Cast::loadCastData(): loading kCastLingoScript");
- _loadedCast->setVal(id, new ScriptCastMember(this, id, castStream, _vm->getVersion()));
+ _loadedCast->setVal(id, new ScriptCastMember(this, id, castStream, _version));
break;
case kCastRTE:
debugC(3, kDebugLoading, "Cast::loadCastData(): loading kCastRTE (%d children)", res->children.size());
- _loadedCast->setVal(id, new RTECastMember(this, id, castStream, _vm->getVersion()));
+ _loadedCast->setVal(id, new RTECastMember(this, id, castStream, _version));
break;
case kCastDigitalVideo:
debugC(3, kDebugLoading, "Cast::loadCastData(): loading kCastDigitalVideo (%d children)", res->children.size());
- _loadedCast->setVal(id, new DigitalVideoCastMember(this, id, castStream, _vm->getVersion()));
+ _loadedCast->setVal(id, new DigitalVideoCastMember(this, id, castStream, _version));
break;
case kCastFilmLoop:
warning("STUB: Cast::loadCastData(): kCastFilmLoop (%d children)", res->children.size());
@@ -891,7 +884,7 @@ void Cast::loadCastData(Common::SeekableReadStreamEndian &stream, uint16 id, Res
break;
case kCastPalette:
debugC(3, kDebugLoading, "Cast::loadCastData(): loading kCastPalette (%d children)", res->children.size());
- _loadedCast->setVal(id, new PaletteCastMember(this, id, castStream, _vm->getVersion()));
+ _loadedCast->setVal(id, new PaletteCastMember(this, id, castStream, _version));
break;
case kCastPicture:
warning("BUILDBOT: STUB: Cast::loadCastData(): kCastPicture (%d children)", res->children.size());
@@ -921,7 +914,7 @@ void Cast::loadCastData(Common::SeekableReadStreamEndian &stream, uint16 id, Res
// read the cast member info
- if (castInfoSize && _vm->getVersion() < 500) {
+ if (castInfoSize && _version < kFileVer500) {
loadCastInfo(stream, id);
}
@@ -941,7 +934,7 @@ LingoContextEntry::LingoContextEntry(int32 i, int16 n)
: index(i), nextUnused(n), unused(false) {}
void Cast::loadLingoContext(Common::SeekableReadStreamEndian &stream) {
- if (_vm->getVersion() >= 400) {
+ if (_version >= kFileVer400) {
debugC(1, kDebugCompile, "Add V4 script context");
if (debugChannelSet(5, kDebugLoading)) {
@@ -1008,7 +1001,7 @@ void Cast::loadLingoContext(Common::SeekableReadStreamEndian &stream) {
debugC(1, kDebugCompile, "Cast::loadLingoContext: Script %d is used but empty", i);
continue;
}
- _lingoArchive->addCodeV4(*(r = _castArchive->getResource(MKTAG('L', 's', 'c', 'r'), entry.index)), i, _macName);
+ _lingoArchive->addCodeV4(*(r = _castArchive->getResource(MKTAG('L', 's', 'c', 'r'), entry.index)), i, _macName, _version);
delete r;
}
@@ -1023,7 +1016,7 @@ void Cast::loadLingoContext(Common::SeekableReadStreamEndian &stream) {
}
}
} else {
- error("Cast::loadLingoContext: unsuported Director version (%d)", _vm->getVersion());
+ error("Cast::loadLingoContext: unsuported Director version (%d)", _version);
}
}
@@ -1078,7 +1071,7 @@ void Cast::loadCastInfo(Common::SeekableReadStreamEndian &stream, uint16 id) {
if (!_loadedCast->contains(id))
return;
- InfoEntries castInfo = Movie::loadInfoEntries(stream);
+ InfoEntries castInfo = Movie::loadInfoEntries(stream, _version);
debugCN(4, kDebugLoading, "Cast::loadCastInfo(): str(%d): '", castInfo.strings.size());
@@ -1148,7 +1141,7 @@ void Cast::loadCastInfo(Common::SeekableReadStreamEndian &stream, uint16 id) {
CastMember *member = _loadedCast->getVal(id);
// For D4+ we may force Lingo scripts
- if (_vm->getVersion() < 400 || debugChannelSet(-1, kDebugNoBytecode)) {
+ if (_version < kFileVer400 || debugChannelSet(-1, kDebugNoBytecode)) {
if (!ci->script.empty()) {
ScriptType scriptType = kCastScript;
// the script type here could be wrong!
@@ -1164,7 +1157,7 @@ void Cast::loadCastInfo(Common::SeekableReadStreamEndian &stream, uint16 id) {
}
// For SoundCastMember, read the flags in the CastInfo
- if (_vm->getVersion() >= 400 && _vm->getVersion() < 500 && member->_type == kCastSound) {
+ if (_version >= kFileVer400 && _version < kFileVer500 && member->_type == kCastSound) {
((SoundCastMember *)member)->_looping = castInfo.flags & 16 ? 0 : 1;
}
diff --git a/engines/director/cast.h b/engines/director/cast.h
index 95ba8f576c..e9639ebfc7 100644
--- a/engines/director/cast.h
+++ b/engines/director/cast.h
@@ -51,12 +51,13 @@ public:
Cast(Movie *movie, bool shared = false);
~Cast();
- bool loadArchive();
+ void loadArchive();
void setArchive(Archive *archive);
Archive *getArchive() const { return _castArchive; };
Common::String getMacName() const { return _macName; }
- void loadConfig(Common::SeekableReadStreamEndian &stream);
+ void loadConfig();
+ void loadCast();
void loadCastDataVWCR(Common::SeekableReadStreamEndian &stream);
void loadCastData(Common::SeekableReadStreamEndian &stream, uint16 id, Resource *res);
void loadCastInfo(Common::SeekableReadStreamEndian &stream, uint16 id);
@@ -85,6 +86,8 @@ private:
public:
Archive *_castArchive;
+ uint16 _version;
+
Common::HashMap<uint16, Common::String> _fontMap;
Common::HashMap<int, CastMember *> *_loadedCast;
@@ -93,6 +96,8 @@ public:
uint16 _castArrayStart;
uint16 _castArrayEnd;
+ Common::Rect _movieRect;
+ uint16 _stageColor;
int _defaultPalette;
uint16 _movieScriptCount;
diff --git a/engines/director/castmember.cpp b/engines/director/castmember.cpp
index bfa6c02c06..cc0c6f663f 100644
--- a/engines/director/castmember.cpp
+++ b/engines/director/castmember.cpp
@@ -72,7 +72,7 @@ BitmapCastMember::BitmapCastMember(Cast *cast, uint16 castId, Common::SeekableRe
_clut = kClutSystemMac;
_bitsPerPixel = 0;
- if (version < 400) {
+ if (version < kFileVer400) {
_flags1 = flags1; // region: 0 - auto, 1 - matte, 2 - disabled, 8 - no auto
_bytes = stream.readUint16();
@@ -93,7 +93,7 @@ BitmapCastMember::BitmapCastMember(Cast *cast, uint16 castId, Common::SeekableRe
if (_pitch % 16)
_pitch += 16 - (_initialRect.width() % 16);
- } else if (version >= 400 && version < 500) {
+ } else if (version >= kFileVer400 && version < kFileVer500) {
_flags1 = flags1;
_pitch = stream.readUint16();
_pitch &= 0x0fff;
@@ -142,7 +142,7 @@ BitmapCastMember::BitmapCastMember(Cast *cast, uint16 castId, Common::SeekableRe
debug("BitmapCastMember: tail");
Common::hexdump(buf, tail);
}
- } else if (version >= 500) {
+ } else if (version >= kFileVer500) {
uint16 count = stream.readUint16();
for (uint16 cc = 0; cc < count; cc++)
stream.readUint32();
@@ -542,7 +542,7 @@ TextCastMember::TextCastMember(Cast *cast, uint16 castId, Common::SeekableReadSt
_bgpalinfo1 = _bgpalinfo2 = _bgpalinfo3 = 0;
_fgpalinfo1 = _fgpalinfo2 = _fgpalinfo3 = 0xff;
- if (version < 400) {
+ if (version < kFileVer400) {
_flags1 = flags1; // region: 0 - auto, 1 - matte, 2 - disabled
_borderSize = static_cast<SizeType>(stream.readByte());
_gutterSize = static_cast<SizeType>(stream.readByte());
@@ -558,7 +558,7 @@ TextCastMember::TextCastMember(Cast *cast, uint16 castId, Common::SeekableReadSt
uint16 pad4 = 0;
uint16 totalTextHeight;
- if (version >= 200 && version < 300) {
+ if (version < kFileVer300) {
pad2 = stream.readUint16();
if (pad2 != 0) { // In D2 there are values
warning("TextCastMember: pad2: %x", pad2);
@@ -588,7 +588,7 @@ TextCastMember::TextCastMember(Cast *cast, uint16 castId, Common::SeekableReadSt
if (debugChannelSet(2, kDebugLoading)) {
_initialRect.debugPrint(2, "TextCastMember(): rect:");
}
- } else if (version >= 400 && version < 500) {
+ } else if (version >= kFileVer400 && version < kFileVer500) {
_flags1 = flags1;
_borderSize = static_cast<SizeType>(stream.readByte());
_gutterSize = static_cast<SizeType>(stream.readByte());
@@ -638,7 +638,7 @@ TextCastMember::TextCastMember(Cast *cast, uint16 castId, Common::SeekableReadSt
if (asButton) {
_type = kCastButton;
- if (version < 500) {
+ if (version < kFileVer500) {
_buttonType = static_cast<ButtonType>(stream.readUint16BE() - 1);
} else {
warning("TextCastMember(): Attempting to initialize >D4 button castmember");
@@ -765,7 +765,7 @@ ShapeCastMember::ShapeCastMember(Cast *cast, uint16 castId, Common::SeekableRead
_ink = kInkTypeCopy;
- if (version < 400) {
+ if (version < kFileVer400) {
unk1 = stream.readByte();
_shapeType = static_cast<ShapeType>(stream.readByte());
_initialRect = Movie::readRect(stream);
@@ -777,7 +777,7 @@ ShapeCastMember::ShapeCastMember(Cast *cast, uint16 castId, Common::SeekableRead
_ink = static_cast<InkType>(_fillType & 0x3f);
_lineThickness = stream.readByte();
_lineDirection = stream.readByte();
- } else if (version >= 400 && version < 500) {
+ } else if (version >= kFileVer400 && version < kFileVer500) {
unk1 = stream.readByte();
_shapeType = static_cast<ShapeType>(stream.readByte());
_initialRect = Movie::readRect(stream);
@@ -821,9 +821,9 @@ ScriptCastMember::ScriptCastMember(Cast *cast, uint16 castId, Common::SeekableRe
_type = kCastLingoScript;
_scriptType = kNoneScript;
- if (version < 400) {
+ if (version < kFileVer400) {
error("Unhandled Script cast");
- } else if (version >= 400 && version < 500) {
+ } else if (version >= kFileVer400 && version < kFileVer500) {
byte unk1 = stream.readByte();
byte type = stream.readByte();
@@ -842,7 +842,7 @@ ScriptCastMember::ScriptCastMember(Cast *cast, uint16 castId, Common::SeekableRe
stream.readByte(); // There should be no more data
assert(stream.eos());
- } else if (version >= 500) {
+ } else if (version >= kFileVer500) {
stream.readByte();
stream.readByte();
diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index c152132f27..df4fac284f 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -126,10 +126,10 @@ void Frame::readChannel(Common::SeekableReadStreamEndian &stream, uint16 offset,
}
}
-void Frame::readChannels(Common::ReadStreamEndian *stream) {
+void Frame::readChannels(Common::ReadStreamEndian *stream, uint16 version) {
byte unk[48];
- if (_vm->getVersion() < 400) {
+ if (version < kFileVer400) {
// Sound/Tempo/Transition
_actionId = stream->readByte();
_soundType1 = stream->readByte(); // type: 0x17 for sounds (sound is cast id), 0x16 for MIDI (sound is cmd id)
@@ -192,7 +192,7 @@ void Frame::readChannels(Common::ReadStreamEndian *stream) {
if (_vm->getPlatform() == Common::kPlatformMacintosh)
stream->read(unk, 3);
- } else if (_vm->getVersion() >= 400 && _vm->getVersion() < 500) {
+ } else if (version >= kFileVer400 && version < kFileVer500) {
// Sound/Tempo/Transition
int unk1 = stream->readByte();
if (unk1) {
@@ -248,7 +248,7 @@ void Frame::readChannels(Common::ReadStreamEndian *stream) {
stream->readByte();
debugC(8, kDebugLoading, "Frame::readChannels(): %d %d %d %d %d %d %d %d %d %d %d", _actionId, _soundType1, _transDuration, _transChunkSize, _tempo, _transType, _sound1, _skipFrameFlag, _blend, _sound2, _soundType2);
- } else if (_vm->getVersion() >= 500 && _vm->getVersion() < 600) {
+ } else if (version >= kFileVer500 && version < kFileVer600) {
// Sound/Tempo/Transition channel
stream->read(unk, 24);
@@ -268,11 +268,11 @@ void Frame::readChannels(Common::ReadStreamEndian *stream) {
for (int i = 0; i < _numChannels; i++) {
Sprite &sprite = *_sprites[i + 1];
- if (_vm->getVersion() < 500) {
+ if (version < kFileVer500) {
sprite._scriptId = stream->readByte();
sprite._spriteType = (SpriteType)stream->readByte();
sprite._enabled = sprite._spriteType != kInactiveSprite;
- if (_vm->getVersion() >= 400) {
+ if (version >= kFileVer400) {
sprite._foreColor = _vm->transformColor((uint8)stream->readByte());
sprite._backColor = _vm->transformColor((uint8)stream->readByte());
} else {
@@ -296,7 +296,7 @@ void Frame::readChannels(Common::ReadStreamEndian *stream) {
sprite._height = (int16)stream->readUint16();
sprite._width = (int16)stream->readUint16();
- if (_vm->getVersion() >= 400) {
+ if (version >= kFileVer400) {
sprite._scriptId = stream->readUint16();
// & 0x0f scorecolor
// 0x10 forecolor is rgb
@@ -306,7 +306,7 @@ void Frame::readChannels(Common::ReadStreamEndian *stream) {
sprite._colorcode = stream->readByte();
sprite._blendAmount = stream->readByte();
}
- } else if (_vm->getVersion() >= 500 && _vm->getVersion() < 600) {
+ } else if (version >= kFileVer500 && version < kFileVer600) {
sprite._spriteType = (SpriteType)stream->readByte();
sprite._inkData = stream->readByte();
@@ -329,7 +329,7 @@ void Frame::readChannels(Common::ReadStreamEndian *stream) {
sprite._blendAmount = stream->readByte();
sprite._thickness = stream->readByte();
stream->readByte(); // unused
- } else if (_vm->getVersion() >= 600 && _vm->getVersion() < 700) {
+ } else if (version >= kFileVer600 && version < kFileVer700) {
sprite._spriteType = (SpriteType)stream->readByte();
sprite._inkData = stream->readByte();
diff --git a/engines/director/frame.h b/engines/director/frame.h
index 0fc999f08e..e123b54fe3 100644
--- a/engines/director/frame.h
+++ b/engines/director/frame.h
@@ -84,7 +84,7 @@ public:
Score *getScore() const { return _score; }
- void readChannels(Common::ReadStreamEndian *stream);
+ void readChannels(Common::ReadStreamEndian *stream, uint16 version);
void readChannel(Common::SeekableReadStreamEndian &stream, uint16 offset, uint16 size);
void executeImmediateScripts();
diff --git a/engines/director/lingo/lingo-bytecode.cpp b/engines/director/lingo/lingo-bytecode.cpp
index 0420ed6e8a..17a1dd7590 100644
--- a/engines/director/lingo/lingo-bytecode.cpp
+++ b/engines/director/lingo/lingo-bytecode.cpp
@@ -801,7 +801,7 @@ void LC::cb_zeropush() {
g_lingo->push(d);
}
-ScriptContext *Lingo::compileLingoV4(Common::SeekableReadStreamEndian &stream, LingoArchive *archive, const Common::String &archName) {
+ScriptContext *Lingo::compileLingoV4(Common::SeekableReadStreamEndian &stream, LingoArchive *archive, const Common::String &archName, uint16 version) {
if (stream.size() < 0x5c) {
warning("Lscr header too small");
return nullptr;
@@ -990,7 +990,7 @@ ScriptContext *Lingo::compileLingoV4(Common::SeekableReadStreamEndian &stream, L
for (uint16 i = 0; i < constsCount; i++) {
Datum constant;
uint32 constType = 0;
- if (_vm->getVersion() >= 500) {
+ if (version >= kFileVer500) {
constType = stream.readUint32();
} else {
constType = (uint32)stream.readUint16();
@@ -1454,8 +1454,8 @@ ScriptContext *Lingo::compileLingoV4(Common::SeekableReadStreamEndian &stream, L
return sc;
}
-void LingoArchive::addCodeV4(Common::SeekableReadStreamEndian &stream, uint16 lctxIndex, const Common::String &archName) {
- ScriptContext *ctx = g_lingo->compileLingoV4(stream, this, archName);
+void LingoArchive::addCodeV4(Common::SeekableReadStreamEndian &stream, uint16 lctxIndex, const Common::String &archName, uint16 version) {
+ ScriptContext *ctx = g_lingo->compileLingoV4(stream, this, archName, version);
if (ctx) {
lctxContexts[lctxIndex] = ctx;
*ctx->_refCount += 1;
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index f2f0009db5..1f9a5c6406 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -228,7 +228,7 @@ struct LingoArchive {
Common::String getName(uint16 id);
void addCode(const char *code, ScriptType type, uint16 id, const char *scriptName = nullptr);
- void addCodeV4(Common::SeekableReadStreamEndian &stream, uint16 lctxIndex, const Common::String &archName);
+ void addCodeV4(Common::SeekableReadStreamEndian &stream, uint16 lctxIndex, const Common::String &archName, uint16 version);
void addNamesV4(Common::SeekableReadStreamEndian &stream);
};
@@ -247,7 +247,7 @@ public:
ScriptContext *compileAnonymous(const char *code);
ScriptContext *compileLingo(const char *code, LingoArchive *archive, ScriptType type, uint16 id, const Common::String &scriptName, bool anonyomous = false);
- ScriptContext *compileLingoV4(Common::SeekableReadStreamEndian &stream, LingoArchive *archive, const Common::String &archName);
+ ScriptContext *compileLingoV4(Common::SeekableReadStreamEndian &stream, LingoArchive *archive, const Common::String &archName, uint16 version);
void executeHandler(const Common::String &name);
void executeScript(ScriptType type, uint16 id);
void printStack(const char *s, uint pc);
diff --git a/engines/director/movie.cpp b/engines/director/movie.cpp
index 02d337804c..69126dd1e1 100644
--- a/engines/director/movie.cpp
+++ b/engines/director/movie.cpp
@@ -101,6 +101,12 @@ void Movie::setArchive(Archive *archive) {
bool Movie::loadArchive() {
Common::SeekableReadStreamEndian *r = nullptr;
+ // Config
+ _cast->loadConfig();
+ _version = _cast->_version;
+ _movieRect = _cast->_movieRect;
+ // Wait to handle _stageColor until palette is loaded in loadCast...
+
// File Info
if (_movieArchive->hasResource(MKTAG('V', 'W', 'F', 'I'), -1)) {
loadFileInfo(*(r = _movieArchive->getFirstResource(MKTAG('V', 'W', 'F', 'I'))));
@@ -108,9 +114,8 @@ bool Movie::loadArchive() {
}
// Cast
- _cast->loadArchive();
-
- // _movieRect and _stageColor are in VWCF, which the cast handles
+ _cast->loadCast();
+ _stageColor = _vm->transformColor(_cast->_stageColor);
bool recenter = false;
// If the stage dimensions are different, delete it and start again.
@@ -142,7 +147,7 @@ bool Movie::loadArchive() {
warning("Movie::loadArchive(): Wrong movie format. VWSC resource missing");
return false;
}
- _score->loadFrames(*(r = _movieArchive->getFirstResource(MKTAG('V', 'W', 'S', 'C'))));
+ _score->loadFrames(*(r = _movieArchive->getFirstResource(MKTAG('V', 'W', 'S', 'C'))), _version);
delete r;
// Action list
@@ -166,7 +171,7 @@ Common::Rect Movie::readRect(Common::ReadStreamEndian &stream) {
return rect;
}
-InfoEntries Movie::loadInfoEntries(Common::SeekableReadStreamEndian &stream) {
+InfoEntries Movie::loadInfoEntries(Common::SeekableReadStreamEndian &stream, uint16 version) {
uint32 offset = stream.pos();
offset += stream.readUint32();
@@ -175,7 +180,7 @@ InfoEntries Movie::loadInfoEntries(Common::SeekableReadStreamEndian &stream) {
res.unk2 = stream.readUint32();
res.flags = stream.readUint32();
- if (g_director->getVersion() >= 400)
+ if (version >= kFileVer400)
res.scriptId = stream.readUint32();
stream.seek(offset);
@@ -209,7 +214,7 @@ InfoEntries Movie::loadInfoEntries(Common::SeekableReadStreamEndian &stream) {
void Movie::loadFileInfo(Common::SeekableReadStreamEndian &stream) {
debugC(2, kDebugLoading, "****** Loading FileInfo VWFI");
- InfoEntries fileInfo = Movie::loadInfoEntries(stream);
+ InfoEntries fileInfo = Movie::loadInfoEntries(stream, _version);
_allowOutdatedLingo = (fileInfo.flags & kMovieFlagAllowOutdatedLingo) != 0;
diff --git a/engines/director/movie.h b/engines/director/movie.h
index ec2d45c797..de5393338b 100644
--- a/engines/director/movie.h
+++ b/engines/director/movie.h
@@ -102,7 +102,7 @@ public:
~Movie();
static Common::Rect readRect(Common::ReadStreamEndian &stream);
- static InfoEntries loadInfoEntries(Common::SeekableReadStreamEndian &stream);
+ static InfoEntries loadInfoEntries(Common::SeekableReadStreamEndian &stream, uint16 version);
bool loadArchive();
void setArchive(Archive *archive);
@@ -146,6 +146,7 @@ private:
public:
Archive *_movieArchive;
+ uint16 _version;
Common::Rect _movieRect;
uint16 _currentClickOnSpriteId;
uint16 _currentEditableTextChannel;
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index bb1021049c..d718be4ec2 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -640,7 +640,7 @@ void Score::playSoundChannel(uint16 frameId) {
sound->playCastMember(frame->_sound2, 2, false);
}
-void Score::loadFrames(Common::SeekableReadStreamEndian &stream) {
+void Score::loadFrames(Common::SeekableReadStreamEndian &stream, uint16 version) {
debugC(1, kDebugLoading, "****** Loading frames VWSC");
//stream.hexdump(stream.size());
@@ -648,20 +648,20 @@ void Score::loadFrames(Common::SeekableReadStreamEndian &stream) {
uint32 size = stream.readUint32();
size -= 4;
- if (_vm->getVersion() < 400) {
+ if (version < kFileVer400) {
_numChannelsDisplayed = 30;
- } else if (_vm->getVersion() >= 400 && _vm->getVersion() < 500) {
+ } else if (version >= kFileVer400 && version < kFileVer500) {
uint32 frame1Offset = stream.readUint32();
uint32 numFrames = stream.readUint32();
- uint16 version = stream.readUint16();
+ uint16 framesVersion = stream.readUint16();
uint16 spriteRecordSize = stream.readUint16();
uint16 numChannels = stream.readUint16();
size -= 14;
- if (version > 13) {
+ if (framesVersion > 13) {
_numChannelsDisplayed = stream.readUint16();
} else {
- if (version <= 7) // Director5
+ if (framesVersion <= 7) // Director5
_numChannelsDisplayed = 48;
else
_numChannelsDisplayed = 120; // D6
@@ -672,9 +672,9 @@ void Score::loadFrames(Common::SeekableReadStreamEndian &stream) {
size -= 2;
warning("STUB: Score::loadFrames. frame1Offset: %x numFrames: %x version: %x spriteRecordSize: %x numChannels: %x numChannelsDisplayed: %x",
- frame1Offset, numFrames, version, spriteRecordSize, numChannels, _numChannelsDisplayed);
+ frame1Offset, numFrames, framesVersion, spriteRecordSize, numChannels, _numChannelsDisplayed);
// Unknown, some bytes - constant (refer to contuinity).
- } else if (_vm->getVersion() >= 500) {
+ } else if (version >= kFileVer500) {
//what data is up the top of D5 VWSC?
uint32 unk1 = stream.readUint32();
uint32 unk2 = stream.readUint32();
@@ -750,7 +750,7 @@ void Score::loadFrames(Common::SeekableReadStreamEndian &stream) {
Common::MemoryReadStreamEndian *str = new Common::MemoryReadStreamEndian(channelData, ARRAYSIZE(channelData), stream.isBE());
// str->hexdump(str->size(), 32);
- frame->readChannels(str);
+ frame->readChannels(str, version);
delete str;
debugC(8, kDebugLoading, "Score::loadFrames(): Frame %d actionId: %d", _frames.size(), frame->_actionId);
diff --git a/engines/director/score.h b/engines/director/score.h
index 37f5356374..061585e9d4 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -68,7 +68,7 @@ public:
Movie *getMovie() const { return _movie; }
- void loadFrames(Common::SeekableReadStreamEndian &stream);
+ void loadFrames(Common::SeekableReadStreamEndian &stream, uint16 version);
void loadLabels(Common::SeekableReadStreamEndian &stream);
void loadActions(Common::SeekableReadStreamEndian &stream);
More information about the Scummvm-git-logs
mailing list