aboutsummaryrefslogtreecommitdiff
path: root/engines/director
diff options
context:
space:
mode:
authorScott Percival2020-01-04 02:24:57 +0800
committerScott Percival2020-01-04 10:57:35 +0800
commit7e6c925a683d185f81d1da8b9806270f56040ed2 (patch)
treebea36c3e9d8791595a0dffc9bafe441f49fc3c93 /engines/director
parent70c231a9f3fa61e628e7b1c82deca49d947a6ded (diff)
downloadscummvm-rg350-7e6c925a683d185f81d1da8b9806270f56040ed2.tar.gz
scummvm-rg350-7e6c925a683d185f81d1da8b9806270f56040ed2.tar.bz2
scummvm-rg350-7e6c925a683d185f81d1da8b9806270f56040ed2.zip
DIRECTOR: Fix kCastMemberSprite to fetch shape from cast
Diffstat (limited to 'engines/director')
-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 {