aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/director/frame.cpp56
-rw-r--r--graphics/primitives.cpp7
-rw-r--r--graphics/primitives.h1
3 files changed, 50 insertions, 14 deletions
diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index a50933fbc5..f93a6610ce 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -586,9 +586,14 @@ void Frame::renderSprites(Graphics::ManagedSurface &surface, bool renderTrail) {
castType = kCastBitmap;
break;
case kRectangleSprite:
+ case kRoundedRectangleSprite:
+ case kOvalSprite:
+ case kLineTopBottomSprite:
+ case kLineBottomTopSprite:
case kOutlinedRectangleSprite: // this is actually a mouse-over shape? I don't think it's a real button.
+ case kOutlinedRoundedRectangleSprite:
+ case kOutlinedOvalSprite:
case kCastMemberSprite: // Face kit D3
- case kLineTopBottomSprite:
castType = kCastShape;
break;
case kTextSprite:
@@ -666,20 +671,43 @@ void Frame::renderShape(Graphics::ManagedSurface &surface, uint16 spriteId) {
Graphics::ManagedSurface tmpSurface;
tmpSurface.create(shapeRect.width(), shapeRect.height(), Graphics::PixelFormat::createFormatCLUT8());
- 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.
- } else {
- // No minus one on the pattern here! MacPlotData will do that for us!
- Graphics::MacPlotData pd(&tmpSurface, &_vm->getPatterns(), sp->_castId, 1, sp->_backColor);
- Common::Rect fillRect(shapeRect.width(), shapeRect.height());
- Graphics::drawFilledRect(fillRect, sp->_foreColor, Graphics::macDrawPixel, &pd);
- }
- 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);
+ // No minus one on the pattern here! MacPlotData will do that for us!
+ //Graphics::MacPlotData pd(&tmpSurface, &_vm->getPatterns(), 1, 1, sp->_backColor);
+ Graphics::MacPlotData pd(&tmpSurface, &_vm->getPatterns(), sp->_ink + 1, sp->_lineSize + 1, sp->_backColor);
+ Common::Rect fillRect(shapeRect.width(), shapeRect.height());
+
+ switch (sp->_spriteType) {
+ case kRectangleSprite:
+ Graphics::drawFilledRect(fillRect, sp->_foreColor, Graphics::macDrawPixel, &pd);
+ break;
+ case kRoundedRectangleSprite:
+ Graphics::drawRoundRect(fillRect, 4, sp->_foreColor, true, Graphics::macDrawPixel, &pd);
+ break;
+ case kOvalSprite:
+ Graphics::drawEllipse(fillRect.left, fillRect.top, fillRect.right, fillRect.bottom, sp->_foreColor, true, Graphics::macDrawPixel, &pd);
+ break;
+ case kLineTopBottomSprite:
+ Graphics::drawLine(fillRect.left, fillRect.top, fillRect.right, fillRect.bottom, sp->_foreColor, Graphics::macDrawPixel, &pd);
+ break;
+ case kLineBottomTopSprite:
+ Graphics::drawLine(fillRect.left, fillRect.bottom, fillRect.right, fillRect.top, sp->_foreColor, Graphics::macDrawPixel, &pd);
+ break;
+ case kOutlinedRectangleSprite: // this is actually a mouse-over shape? I don't think it's a real button.
+ Graphics::drawRect(fillRect, sp->_foreColor, Graphics::macDrawPixel, &pd);
+ break;
+ case kOutlinedRoundedRectangleSprite:
+ Graphics::drawRoundRect(fillRect, 4, sp->_foreColor, false, Graphics::macDrawPixel, &pd);
+ break;
+ case kOutlinedOvalSprite:
+ 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:
+ warning("Frame::renderShape(): Unhandled sprite type: %d", sp->_spriteType);
}
addDrawRect(spriteId, shapeRect);
diff --git a/graphics/primitives.cpp b/graphics/primitives.cpp
index 97e3d06177..60898aa16c 100644
--- a/graphics/primitives.cpp
+++ b/graphics/primitives.cpp
@@ -244,6 +244,13 @@ void drawFilledRect(Common::Rect &rect, int color, void (*plotProc)(int, int, in
drawHLine(rect.left, rect.right, y, color, plotProc, data);
}
+void drawRect(Common::Rect &rect, int color, void (*plotProc)(int, int, int, void *), void *data) {
+ drawHLine(rect.left, rect.right, rect.top, color, plotProc, data);
+ drawHLine(rect.left, rect.right, rect.bottom, color, plotProc, data);
+ drawVLine(rect.top, rect.bottom, rect.left, color, plotProc, data);
+ drawVLine(rect.top, rect.bottom, rect.right, color, plotProc, data);
+}
+
// http://members.chello.at/easyfilter/bresenham.html
void drawRoundRect(Common::Rect &rect, int arc, int color, bool filled, void (*plotProc)(int, int, int, void *), void *data) {
if (rect.height() < rect.width()) {
diff --git a/graphics/primitives.h b/graphics/primitives.h
index 62dc10bfdf..95c31dfe10 100644
--- a/graphics/primitives.h
+++ b/graphics/primitives.h
@@ -34,6 +34,7 @@ void drawThickLine(int x0, int y0, int x1, int y1, int penX, int penY, int color
void drawThickLine2(int x1, int y1, int x2, int y2, int thick, int color,
void (*plotProc)(int, int, int, void *), void *data);
void drawFilledRect(Common::Rect &rect, int color, void (*plotProc)(int, int, int, void *), void *data);
+void drawRect(Common::Rect &rect, int color, void (*plotProc)(int, int, int, void *), void *data);
void drawRoundRect(Common::Rect &rect, int arc, int color, bool filled, void (*plotProc)(int, int, int, void *), void *data);
void drawPolygonScan(int *polyX, int *polyY, int npoints, Common::Rect &bbox, int color,
void (*plotProc)(int, int, int, void *), void *data);