From b0093cba4bd750201c803d0e05e046801cb62684 Mon Sep 17 00:00:00 2001 From: stevenhoefel Date: Tue, 28 Feb 2017 15:44:52 +1100 Subject: DIRECTOR: Capture Mouse Down Sprite and highlight respective items. --- engines/director/frame.cpp | 12 ++++++------ engines/director/score.cpp | 8 +++++--- engines/director/score.h | 1 + 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp index 176bc475d1..f77bf5c8f8 100644 --- a/engines/director/frame.cpp +++ b/engines/director/frame.cpp @@ -622,8 +622,8 @@ void Frame::renderSprites(Graphics::ManagedSurface &surface, bool renderTrail) { Common::Rect drawRect(x, y, x + width, y + height); - inkBasedBlit(surface, *img->getSurface(), i, drawRect); addDrawRect(i, drawRect); + inkBasedBlit(surface, *img->getSurface(), i, drawRect); } } } @@ -645,10 +645,10 @@ void Frame::renderShape(Graphics::ManagedSurface &surface, uint16 spriteId) { Graphics::ManagedSurface tmpSurface; tmpSurface.create(shapeRect.width(), shapeRect.height(), Graphics::PixelFormat::createFormatCLUT8()); if (_vm->getVersion() <= 3 && _sprites[spriteId]->_spriteType == 0x0c) { - tmpSurface.fillRect(Common::Rect(shapeRect.width(), shapeRect.height()), 255); - tmpSurface.frameRect(Common::Rect(shapeRect.width(), shapeRect.height()), 0); + 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 = kInkTypeTransparent; + _sprites[spriteId]->_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); @@ -661,8 +661,8 @@ void Frame::renderShape(Graphics::ManagedSurface &surface, uint16 spriteId) { tmpSurface.frameRect(Common::Rect(rr, rr, shapeRect.width() - (rr * 2), shapeRect.height() - (rr * 2)), 0); } + addDrawRect(spriteId, shapeRect); inkBasedBlit(surface, tmpSurface, spriteId, shapeRect); - addDrawRect(spriteId, shapeRect); } void Frame::renderButton(Graphics::ManagedSurface &surface, uint16 spriteId, uint16 textId) { @@ -1062,7 +1062,7 @@ void Frame::drawReverseSprite(Graphics::ManagedSurface &target, const Graphics:: for (int j = 0; j < drawRect.width(); j++) { if ((getSpriteIDFromPos(Common::Point(drawRect.left + j, drawRect.top + ii)) != 0)) - *dst = (_vm->getPaletteColorCount() - 1) - *src; + if (*src != skipColor) *dst = (*dst == *src ? (*src == 0 ? 0xff : 0) : *src); else if (*src != skipColor) *dst = *src; src++; diff --git a/engines/director/score.cpp b/engines/director/score.cpp index c26a09927f..aa4828ead7 100644 --- a/engines/director/score.cpp +++ b/engines/director/score.cpp @@ -991,11 +991,13 @@ void Score::processEvents() { Common::Point pos = g_system->getEventManager()->getMousePos(); // D3 doesn't have both mouse up and down. + // But we still want to know if the mouse is down for press effects. + _currentMouseDownSpriteId = _frames[_currentFrame]->getSpriteIDFromPos(pos); + if (_vm->getVersion() > 3) { // TODO: check that this is the order of script execution! - uint16 spriteId = _frames[_currentFrame]->getSpriteIDFromPos(pos); - _lingo->processEvent(kEventMouseDown, kCastScript, _frames[_currentFrame]->_sprites[spriteId]->_castId); - _lingo->processEvent(kEventMouseDown, kSpriteScript, _frames[_currentFrame]->_sprites[spriteId]->_scriptId); + _lingo->processEvent(kEventMouseDown, kCastScript, _frames[_currentFrame]->_sprites[_currentMouseDownSpriteId]->_castId); + _lingo->processEvent(kEventMouseDown, kSpriteScript, _frames[_currentFrame]->_sprites[_currentMouseDownSpriteId]->_scriptId); } } diff --git a/engines/director/score.h b/engines/director/score.h index 2e762f0dad..9ffa0e4de2 100644 --- a/engines/director/score.h +++ b/engines/director/score.h @@ -111,6 +111,7 @@ public: Graphics::Font *_font; Archive *_movieArchive; Common::Rect _movieRect; + uint16 _currentMouseDownSpriteId; bool _stopPlay; uint32 _nextFrameTime; -- cgit v1.2.3