[Scummvm-git-logs] scummvm master -> b0093cba4bd750201c803d0e05e046801cb62684

stevenhoefel stevenhoefel at hotmail.com
Tue Feb 28 05:45:04 CET 2017


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
b0093cba4b DIRECTOR: Capture Mouse Down Sprite and highlight respective items.


Commit: b0093cba4bd750201c803d0e05e046801cb62684
    https://github.com/scummvm/scummvm/commit/b0093cba4bd750201c803d0e05e046801cb62684
Author: stevenhoefel (stevenhoefel at hotmail.com)
Date: 2017-02-28T15:44:52+11:00

Commit Message:
DIRECTOR: Capture Mouse Down Sprite and highlight respective items.

Changed paths:
    engines/director/frame.cpp
    engines/director/score.cpp
    engines/director/score.h


diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index 176bc47..f77bf5c 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 c26a099..aa4828e 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 2e762f0..9ffa0e4 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;





More information about the Scummvm-git-logs mailing list