aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/director/cast.cpp16
-rw-r--r--engines/director/cast.h7
-rw-r--r--engines/director/frame.cpp27
-rw-r--r--engines/director/score.cpp6
-rw-r--r--engines/director/types.h7
5 files changed, 40 insertions, 23 deletions
diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp
index 2a59443e27..f47fa37ad0 100644
--- a/engines/director/cast.cpp
+++ b/engines/director/cast.cpp
@@ -249,9 +249,11 @@ void TextCast::setText(const char *text) {
}
ShapeCast::ShapeCast(Common::ReadStreamEndian &stream, uint16 version) {
+ byte flags, unk1;
+
if (version < 4) {
- /*byte flags = */ stream.readByte();
- /*unk1 = */ stream.readByte();
+ flags = stream.readByte();
+ unk1 = stream.readByte();
_shapeType = static_cast<ShapeType>(stream.readByte());
_initialRect = Score::readRect(stream);
_pattern = stream.readUint16BE();
@@ -261,8 +263,8 @@ ShapeCast::ShapeCast(Common::ReadStreamEndian &stream, uint16 version) {
_lineThickness = stream.readByte();
_lineDirection = stream.readByte();
} else {
- stream.readByte();
- stream.readByte();
+ flags = stream.readByte();
+ unk1 = stream.readByte();
_initialRect = Score::readRect(stream);
_boundingRect = Score::readRect(stream);
@@ -275,6 +277,12 @@ ShapeCast::ShapeCast(Common::ReadStreamEndian &stream, uint16 version) {
_lineDirection = 0;
}
_modified = 0;
+
+ debugC(3, kDebugLoading, "ShapeCast: fl: %x unk1: %x type: %d pat: %d fg: %d bg: %d fill: %d thick: %d dir: %d",
+ flags, unk1, _shapeType, _pattern, _fgCol, _bgCol, _fillType, _lineThickness, _lineDirection);
+
+ if (debugChannelSet(3, kDebugLoading))
+ _initialRect.debugPrint(0, "ShapeCast: rect:");
}
ButtonCast::ButtonCast(Common::ReadStreamEndian &stream, uint16 version) : TextCast(stream, version) {
diff --git a/engines/director/cast.h b/engines/director/cast.h
index 9c026fc957..66cb77ffe7 100644
--- a/engines/director/cast.h
+++ b/engines/director/cast.h
@@ -68,13 +68,6 @@ public:
uint32 _tag;
};
-enum ShapeType {
- kShapeRectangle,
- kShapeRoundRect,
- kShapeOval,
- kShapeLine
-};
-
class ShapeCast : public Cast {
public:
ShapeCast(Common::ReadStreamEndian &stream, uint16 version = 2);
diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index 06bda82501..1a3d66e71d 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -649,27 +649,34 @@ void Frame::addDrawRect(uint16 spriteId, Common::Rect &rect) {
}
void Frame::renderShape(Graphics::ManagedSurface &surface, uint16 spriteId) {
- Common::Rect shapeRect = Common::Rect(_sprites[spriteId]->_startPoint.x,
- _sprites[spriteId]->_startPoint.y,
- _sprites[spriteId]->_startPoint.x + _sprites[spriteId]->_width,
- _sprites[spriteId]->_startPoint.y + _sprites[spriteId]->_height);
+ Sprite *sp = _sprites[spriteId];
+
+ if (sp->_shapeCast == NULL) {
+ warning("Frame::renderShape(): missing shapecast in sprite id: %d", spriteId);
+ return;
+ }
+
+ Common::Rect shapeRect = Common::Rect(sp->_startPoint.x,
+ sp->_startPoint.y,
+ sp->_startPoint.x + sp->_width,
+ sp->_startPoint.y + sp->_height);
Graphics::ManagedSurface tmpSurface;
tmpSurface.create(shapeRect.width(), shapeRect.height(), Graphics::PixelFormat::createFormatCLUT8());
- if (_vm->getVersion() <= 3 && _sprites[spriteId]->_spriteType == kOutlinedRectangleSprite) {
+ if (_vm->getVersion() <= 3 && sp->_spriteType == kOutlinedRectangleSprite) {
tmpSurface.fillRect(Common::Rect(shapeRect.width(), shapeRect.height()), (_vm->getCurrentScore()->_currentMouseDownSpriteId == spriteId ? 0 : 0xff));
//tmpSurface.frameRect(Common::Rect(shapeRect.width(), shapeRect.height()), 0);
// TODO: don't override, work out how to display correctly.
- _sprites[spriteId]->_ink = kInkTypeReverse;
+ sp->_ink = kInkTypeReverse;
} else {
// No minus one on the pattern here! MacPlotData will do that for us!
- Graphics::MacPlotData pd(&tmpSurface, &_vm->getPatterns(), _sprites[spriteId]->_castId, 1, _sprites[spriteId]->_backColor);
+ Graphics::MacPlotData pd(&tmpSurface, &_vm->getPatterns(), sp->_castId, 1, sp->_shapeCast->_bgCol);
Common::Rect fillRect(shapeRect.width(), shapeRect.height());
- Graphics::drawFilledRect(fillRect, _sprites[spriteId]->_foreColor, Graphics::macDrawPixel, &pd);
+ Graphics::drawFilledRect(fillRect, sp->_shapeCast->_fgCol, Graphics::macDrawPixel, &pd);
}
- if (_sprites[spriteId]->_lineSize > 0) {
- for (int rr = 0; rr < (_sprites[spriteId]->_lineSize - 1); rr++)
+ if (sp->_lineSize > 0) {
+ for (int rr = 0; rr < (sp->_lineSize - 1); rr++)
tmpSurface.frameRect(Common::Rect(rr, rr, shapeRect.width() - (rr * 2), shapeRect.height() - (rr * 2)), 0);
}
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 0429e99d48..7b0642f1ce 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -140,7 +140,6 @@ void Score::loadArchive() {
assert(_movieArchive->hasResource(MKTAG('V', 'W', 'S', 'C'), -1));
loadFrames(*_movieArchive->getFirstResource(MKTAG('V', 'W', 'S', 'C')));
-
if (_movieArchive->hasResource(MKTAG('V', 'W', 'C', 'F'), -1)) {
loadConfig(*_movieArchive->getFirstResource(MKTAG('V', 'W', 'C', 'F')));
} else {
@@ -464,7 +463,7 @@ void Score::loadFrames(Common::SeekableSubReadStreamEndian &stream) {
frame->readChannels(str);
delete str;
- debugC(3, kDebugLoading, "Frame %d actionId: %d", _frames.size(), frame->_actionId);
+ debugC(8, kDebugLoading, "Frame %d actionId: %d", _frames.size(), frame->_actionId);
_frames.push_back(frame);
} else {
@@ -546,6 +545,9 @@ void Score::setSpriteCasts() {
for (uint16 j = 0; j < _frames[i]->_sprites.size(); j++) {
uint16 castId = _frames[i]->_sprites[j]->_castId;
+ if (castId == 0)
+ continue;
+
if (_vm->getSharedScore() != nullptr && _vm->getSharedScore()->_loadedBitmaps->contains(castId)) {
_frames[i]->_sprites[j]->_bitmapCast = _vm->getSharedScore()->_loadedBitmaps->getVal(castId);
} else if (_loadedBitmaps->contains(castId)) {
diff --git a/engines/director/types.h b/engines/director/types.h
index 9626f6d8e2..708718b9b9 100644
--- a/engines/director/types.h
+++ b/engines/director/types.h
@@ -51,6 +51,13 @@ enum ScriptType {
kMaxScriptType = 4 // Sync with score.cpp:45, array scriptTypes[]
};
+enum ShapeType {
+ kShapeRectangle,
+ kShapeRoundRect,
+ kShapeOval,
+ kShapeLine
+};
+
enum TextType {
kTextTypeAdjustToFit,
kTextTypeScrolling,