aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/director/cast.cpp12
-rw-r--r--engines/director/frame.cpp35
-rw-r--r--engines/director/types.h8
3 files changed, 45 insertions, 10 deletions
diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp
index 6e87c7a6de..dc1170b611 100644
--- a/engines/director/cast.cpp
+++ b/engines/director/cast.cpp
@@ -282,6 +282,18 @@ ShapeCast::ShapeCast(Common::ReadStreamEndian &stream, uint16 version) {
_ink = static_cast<InkType>(_fillType & 0x3f);
_lineThickness = stream.readByte();
_lineDirection = stream.readByte();
+ } else if (version == 4) {
+ flags = 0;
+ unk1 = stream.readByte();
+ _shapeType = static_cast<ShapeType>(stream.readByte());
+ _initialRect = Score::readRect(stream);
+ _pattern = stream.readUint16BE();
+ _fgCol = (uint8)stream.readByte();
+ _bgCol = (uint8)stream.readByte();
+ _fillType = stream.readByte();
+ _ink = static_cast<InkType>(_fillType & 0x3f);
+ _lineThickness = stream.readByte();
+ _lineDirection = stream.readByte();
} else {
flags = stream.readByte();
unk1 = stream.readByte();
diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index 45c5f87780..3de87f6fd8 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -660,10 +660,34 @@ void Frame::addDrawRect(uint16 spriteId, Common::Rect &rect) {
void Frame::renderShape(Graphics::ManagedSurface &surface, uint16 spriteId) {
Sprite *sp = _sprites[spriteId];
- if (sp->_cast != NULL) {
- sp->_foreColor = ((ShapeCast *)sp->_cast)->_fgCol;
- sp->_backColor = ((ShapeCast *)sp->_cast)->_bgCol;
- //sp->_ink = sp->_shapeCast->_ink;
+ byte spriteType = sp->_spriteType;
+ if (spriteType == kCastMemberSprite && sp->_cast != NULL) {
+ switch (sp->_cast->_type) {
+ case kCastShape:
+ {
+ ShapeCast *sc = (ShapeCast *)sp->_cast;
+ switch (sc->_shapeType) {
+ case kShapeRectangle:
+ spriteType = sc->_fillType ? kRectangleSprite : kOutlinedRectangleSprite;
+ break;
+ case kShapeRoundRect:
+ spriteType = sc->_fillType ? kRoundedRectangleSprite : kOutlinedRoundedRectangleSprite;
+ break;
+ case kShapeOval:
+ spriteType = sc->_fillType ? kOvalSprite : kOutlinedOvalSprite;
+ break;
+ case kShapeLine:
+ spriteType = sc->_lineDirection == 6 ? kLineTopBottomSprite : kLineBottomTopSprite;
+ break;
+ default:
+ break;
+ }
+ }
+ break;
+ default:
+ warning("Frame::renderShape(): Unhandled cast type: %d", sp->_cast->_type);
+ break;
+ }
}
Common::Rect shapeRect = Common::Rect(sp->_startPoint.x,
@@ -679,7 +703,7 @@ void Frame::renderShape(Graphics::ManagedSurface &surface, uint16 spriteId) {
Graphics::MacPlotData pd(&tmpSurface, &_vm->getPatterns(), sp->getPattern(), sp->_lineSize + 1, sp->_backColor);
Common::Rect fillRect(shapeRect.width(), shapeRect.height());
- switch (sp->_spriteType) {
+ switch (spriteType) {
case kRectangleSprite:
Graphics::drawFilledRect(fillRect, sp->_foreColor, Graphics::macDrawPixel, &pd);
break;
@@ -706,7 +730,6 @@ void Frame::renderShape(Graphics::ManagedSurface &surface, uint16 spriteId) {
Graphics::drawEllipse(fillRect.left, fillRect.top, fillRect.right, fillRect.bottom, sp->_foreColor, false, Graphics::macDrawPixel, &pd);
break;
case kCastMemberSprite: // Face kit D3
- // FIXME. Check
Graphics::drawFilledRect(fillRect, sp->_foreColor, Graphics::macDrawPixel, &pd);
break;
default:
diff --git a/engines/director/types.h b/engines/director/types.h
index 0ed33550a4..d05cd3b72b 100644
--- a/engines/director/types.h
+++ b/engines/director/types.h
@@ -52,10 +52,10 @@ enum ScriptType {
};
enum ShapeType {
- kShapeRectangle,
- kShapeRoundRect,
- kShapeOval,
- kShapeLine
+ kShapeRectangle = 1,
+ kShapeRoundRect = 2,
+ kShapeOval = 3,
+ kShapeLine = 4
};
enum TextType {