[Scummvm-cvs-logs] SF.net SVN: scummvm:[47828] scummvm/trunk/engines/gob

strangerke at users.sourceforge.net strangerke at users.sourceforge.net
Wed Feb 3 00:39:20 CET 2010


Revision: 47828
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47828&view=rev
Author:   strangerke
Date:     2010-02-02 23:39:19 +0000 (Tue, 02 Feb 2010)

Log Message:
-----------
Fascination - Add a window specific function, modify checkmouse() function in order to use it (without breaking the other games). Windows are no longer "transparent" 

Modified Paths:
--------------
    scummvm/trunk/engines/gob/draw.cpp
    scummvm/trunk/engines/gob/draw.h
    scummvm/trunk/engines/gob/hotspots.cpp

Modified: scummvm/trunk/engines/gob/draw.cpp
===================================================================
--- scummvm/trunk/engines/gob/draw.cpp	2010-02-02 23:35:08 UTC (rev 47827)
+++ scummvm/trunk/engines/gob/draw.cpp	2010-02-02 23:39:19 UTC (rev 47828)
@@ -744,7 +744,7 @@
 	right  = left + width  - 1;
 	bottom = top  + height - 1;
 
-// To be fixed : either wrong surface, r anything else, but crappy look.
+// To be fixed : either wrong surface, or anything else, but crappy look.
 //	_vm->_video->drawLine(*_frontSurface, left,  top,    right, top,    0);
 //	_vm->_video->drawLine(*_frontSurface, left,  top,    left,  bottom, 0);
 //	_vm->_video->drawLine(*_frontSurface, left,  bottom, right, bottom, 0);
@@ -1284,6 +1284,35 @@
 	}
 }
 
+int16 Draw::isOverWin(int16 &dx, int16 &dy) {
+	int16 bestMatch = -1;
+
+	warning("isOverWin");
+	if ((_vm->_draw->_renderFlags & 128) == 0)
+		return -1;
+
+	for (int i = 0; i < 10; i++) 
+		if (_fascinWin[i].id != -1) {
+			if ((_vm->_global->_inter_mouseX >= _fascinWin[i].left) &&
+			    (_vm->_global->_inter_mouseX <  _fascinWin[i].left + _fascinWin[i].width) &&
+			    (_vm->_global->_inter_mouseY >= _fascinWin[i].top) &&
+			    (_vm->_global->_inter_mouseY <  _fascinWin[i].top  + _fascinWin[i].height)) {
+
+				if (_fascinWin[i].id == _winCount - 1) {
+					dx = _fascinWin[i].left;
+					dy = _fascinWin[i].top;
+					return(i);
+				} else 
+					if (_fascinWin[i].id > bestMatch)
+						bestMatch = _fascinWin[i].id;
+			}
+		}
+
+	if (bestMatch != -1) 
+		return(0);
+	else 
+		return(-1);
+}
 int32 Draw::getSpriteRectSize(int16 index) {
 	if (!_spritesArray[index])
 		return 0;

Modified: scummvm/trunk/engines/gob/draw.h
===================================================================
--- scummvm/trunk/engines/gob/draw.h	2010-02-02 23:35:08 UTC (rev 47827)
+++ scummvm/trunk/engines/gob/draw.h	2010-02-02 23:39:19 UTC (rev 47828)
@@ -199,6 +199,7 @@
 	void handleWinBorder(int16 id);
 	void winDraw(int16 fct);
 	void winTrace(int16 left, int16 top, int16 width, int16 height);
+    int16 isOverWin(int16 &dx, int16 &dy);
 
 	int32 getSpriteRectSize(int16 index);
 	void forceBlit(bool backwards = false);

Modified: scummvm/trunk/engines/gob/hotspots.cpp
===================================================================
--- scummvm/trunk/engines/gob/hotspots.cpp	2010-02-02 23:35:08 UTC (rev 47827)
+++ scummvm/trunk/engines/gob/hotspots.cpp	2010-02-02 23:39:19 UTC (rev 47828)
@@ -551,6 +551,22 @@
 	id    = 0;
 	index = 0;
 
+	int16 dx = 0;
+	int16 dy = 0;
+	int16 winId = -1;
+
+	if (_vm->getGameType() == kGameTypeFascination)
+		winId = _vm->_draw->isOverWin(dx, dy);
+
+	warning("checkmouse %d - %d %d",winId, dx, dy);
+
+	if (winId < 0) {
+		winId = 0;
+		dx = 0;
+		dy = 0;
+	} else
+		winId *= 256;
+
 	if (type == kTypeMove) {
 		// Check where the mouse was moved to
 
@@ -561,6 +577,10 @@
 				// Only consider enabled hotspots
 				continue;
 
+//Strangerke, for Fascination
+			if ((spot.flags & 0xFF00) != winId)
+				continue;
+
 			if (spot.getType() > kTypeMove)
 				// Only consider click and move hotspots
 				continue;
@@ -569,7 +589,7 @@
 				// Only check the main window
 				continue;
 
-			if (!spot.isIn(_vm->_global->_inter_mouseX, _vm->_global->_inter_mouseY))
+			if (!spot.isIn(_vm->_global->_inter_mouseX - dx, _vm->_global->_inter_mouseY - dy))
 				// If we're not in it, ignore it
 				continue;
 
@@ -591,6 +611,10 @@
 				// Only consider enabled hotspots
 				continue;
 
+//Strangerke, for Fascination
+			if ((spot.flags & 0xFF00) != winId)
+				continue;
+
 			if (spot.getWindow() != 0)
 				// Only check the main window
 				continue;
@@ -599,7 +623,7 @@
 				// Only consider hotspots that can be clicked
 				continue;
 
-			if (!spot.isIn(_vm->_global->_inter_mouseX, _vm->_global->_inter_mouseY))
+			if (!spot.isIn(_vm->_global->_inter_mouseX - dx, _vm->_global->_inter_mouseY - dy))
 				// If we're not in it, ignore it
 				continue;
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list