DIRECTOR: Store cast member size

This commit is contained in:
Eugene Sandulenko 2020-07-21 18:28:17 +02:00
parent 1aea38cc63
commit d759ca6271
2 changed files with 25 additions and 23 deletions

View File

@ -31,7 +31,7 @@
namespace Director {
CastMember::CastMember(Cast* cast, uint16 castId) {
CastMember::CastMember(Cast* cast, uint16 castId, Common::SeekableReadStreamEndian &stream) {
_type = kCastTypeNull;
_cast = cast;
_castId = castId;
@ -39,6 +39,7 @@ CastMember::CastMember(Cast* cast, uint16 castId) {
_hilite = false;
_autoHilite = false;
_purgePriority = 3;
_size = stream.size();
_modified = true;
}
@ -48,8 +49,8 @@ CastMember::~CastMember() {
delete _widget;
}
BitmapCastMember::BitmapCastMember(Cast *cast, uint16 castId, Common::ReadStreamEndian &stream, uint32 castTag, uint16 version)
: CastMember(cast, castId) {
BitmapCastMember::BitmapCastMember(Cast *cast, uint16 castId, Common::SeekableReadStreamEndian &stream, uint32 castTag, uint16 version)
: CastMember(cast, castId, stream) {
_type = kCastBitmap;
_img = nullptr;
_matte = nullptr;
@ -233,8 +234,8 @@ Graphics::Surface *BitmapCastMember::getMatte() {
return _matte ? _matte->getMask() : nullptr;
}
DigitalVideoCastMember::DigitalVideoCastMember(Cast *cast, uint16 castId, Common::ReadStreamEndian &stream, uint16 version)
: CastMember(cast, castId) {
DigitalVideoCastMember::DigitalVideoCastMember(Cast *cast, uint16 castId, Common::SeekableReadStreamEndian &stream, uint16 version)
: CastMember(cast, castId, stream) {
_type = kCastDigitalVideo;
if (version < 4) {
@ -283,8 +284,8 @@ DigitalVideoCastMember::~DigitalVideoCastMember() {
}
SoundCastMember::SoundCastMember(Cast *cast, uint16 castId, Common::ReadStreamEndian &stream, uint16 version)
: CastMember(cast, castId) {
SoundCastMember::SoundCastMember(Cast *cast, uint16 castId, Common::SeekableReadStreamEndian &stream, uint16 version)
: CastMember(cast, castId, stream) {
_type = kCastSound;
_audio = nullptr;
_looping = 0;
@ -297,8 +298,8 @@ SoundCastMember::SoundCastMember(Cast *cast, uint16 castId, Common::ReadStreamEn
}
}
TextCastMember::TextCastMember(Cast *cast, uint16 castId, Common::ReadStreamEndian &stream, uint16 version, bool asButton)
: CastMember(cast, castId) {
TextCastMember::TextCastMember(Cast *cast, uint16 castId, Common::SeekableReadStreamEndian &stream, uint16 version, bool asButton)
: CastMember(cast, castId, stream) {
_type = kCastText;
_borderSize = kSizeNone;
@ -558,8 +559,8 @@ bool TextCastMember::setEditable(bool editable) {
return true;
}
ShapeCastMember::ShapeCastMember(Cast *cast, uint16 castId, Common::ReadStreamEndian &stream, uint16 version)
: CastMember(cast, castId) {
ShapeCastMember::ShapeCastMember(Cast *cast, uint16 castId, Common::SeekableReadStreamEndian &stream, uint16 version)
: CastMember(cast, castId, stream) {
_type = kCastShape;
byte flags, unk1;
@ -614,8 +615,8 @@ ShapeCastMember::ShapeCastMember(Cast *cast, uint16 castId, Common::ReadStreamEn
_initialRect.debugPrint(0, "ShapeCastMember: rect:");
}
ScriptCastMember::ScriptCastMember(Cast *cast, uint16 castId, Common::ReadStreamEndian &stream, uint16 version)
: CastMember(cast, castId) {
ScriptCastMember::ScriptCastMember(Cast *cast, uint16 castId, Common::SeekableReadStreamEndian &stream, uint16 version)
: CastMember(cast, castId, stream) {
_type = kCastLingoScript;
_scriptType = kNoneScript;
@ -651,7 +652,7 @@ ScriptCastMember::ScriptCastMember(Cast *cast, uint16 castId, Common::ReadStream
}
}
RTECastMember::RTECastMember(Cast *cast, uint16 castId, Common::ReadStreamEndian &stream, uint16 version)
RTECastMember::RTECastMember(Cast *cast, uint16 castId, Common::SeekableReadStreamEndian &stream, uint16 version)
: TextCastMember(cast, castId, stream, version) {
_type = kCastRTE;

View File

@ -39,7 +39,7 @@ class MacWidget;
namespace Common {
class SeekableReadStream;
class ReadStreamEndian;
class SeekableReadStreamEndian;
}
namespace Image {
@ -54,7 +54,7 @@ struct Resource;
class CastMember {
public:
CastMember(Cast *cast, uint16 castId);
CastMember(Cast *cast, uint16 castId, Common::SeekableReadStreamEndian &stream);
virtual ~CastMember();
Cast *getCast() { return _cast; }
@ -78,6 +78,7 @@ public:
bool _hilite;
bool _autoHilite;
int _purgePriority;
uint32 _size;
Graphics::MacWidget *_widget;
@ -88,7 +89,7 @@ private:
class BitmapCastMember : public CastMember {
public:
BitmapCastMember(Cast *cast, uint16 castId, Common::ReadStreamEndian &stream, uint32 castTag, uint16 version);
BitmapCastMember(Cast *cast, uint16 castId, Common::SeekableReadStreamEndian &stream, uint32 castTag, uint16 version);
~BitmapCastMember();
virtual void createWidget() override;
@ -113,7 +114,7 @@ public:
class DigitalVideoCastMember : public CastMember {
public:
DigitalVideoCastMember(Cast *cast, uint16 castId, Common::ReadStreamEndian &stream, uint16 version);
DigitalVideoCastMember(Cast *cast, uint16 castId, Common::SeekableReadStreamEndian &stream, uint16 version);
~DigitalVideoCastMember();
bool _looping;
@ -132,7 +133,7 @@ public:
class SoundCastMember : public CastMember {
public:
SoundCastMember(Cast *cast, uint16 castId, Common::ReadStreamEndian &stream, uint16 version);
SoundCastMember(Cast *cast, uint16 castId, Common::SeekableReadStreamEndian &stream, uint16 version);
bool _looping;
AudioDecoder *_audio;
@ -140,7 +141,7 @@ public:
class ShapeCastMember : public CastMember {
public:
ShapeCastMember(Cast *cast, uint16 castId, Common::ReadStreamEndian &stream, uint16 version);
ShapeCastMember(Cast *cast, uint16 castId, Common::SeekableReadStreamEndian &stream, uint16 version);
virtual uint getForeColor() override { return _fgCol; }
virtual uint getBackColor() override { return _bgCol; }
@ -158,7 +159,7 @@ private:
class TextCastMember : public CastMember {
public:
TextCastMember(Cast *cast, uint16 castId, Common::ReadStreamEndian &stream, uint16 version, bool asButton = false);
TextCastMember(Cast *cast, uint16 castId, Common::SeekableReadStreamEndian &stream, uint16 version, bool asButton = false);
virtual void setColors(int *fgcolor, int *bgcolor) override;
void setText(const char *text);
@ -205,14 +206,14 @@ private:
class ScriptCastMember : public CastMember {
public:
ScriptCastMember(Cast *cast, uint16 castId, Common::ReadStreamEndian &stream, uint16 version);
ScriptCastMember(Cast *cast, uint16 castId, Common::SeekableReadStreamEndian &stream, uint16 version);
ScriptType _scriptType;
};
class RTECastMember : public TextCastMember {
public:
RTECastMember(Cast *cast, uint16 castId, Common::ReadStreamEndian &stream, uint16 version);
RTECastMember(Cast *cast, uint16 castId, Common::SeekableReadStreamEndian &stream, uint16 version);
void loadChunks();
};