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

strangerke at users.sourceforge.net strangerke at users.sourceforge.net
Tue Dec 1 22:49:45 CET 2009


Revision: 46233
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46233&view=rev
Author:   strangerke
Date:     2009-12-01 21:49:45 +0000 (Tue, 01 Dec 2009)

Log Message:
-----------
gob - Add cursor handling for Fascination windows (close and move at least)

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

Modified: scummvm/trunk/engines/gob/hotspots.cpp
===================================================================
--- scummvm/trunk/engines/gob/hotspots.cpp	2009-12-01 19:19:58 UTC (rev 46232)
+++ scummvm/trunk/engines/gob/hotspots.cpp	2009-12-01 21:49:45 UTC (rev 46233)
@@ -522,6 +522,31 @@
 		call(spot.funcLeave);
 }
 
+int16 Hotspots::curWindow(int16 &dx, int16 &dy) const {
+	if ((_vm->_draw->_renderFlags & 0x80)==0) 
+		return(0);
+	for (int i = 0; i < 10; i++)
+		if (_vm->_draw->_fascinWin[i].id != -1)
+			if (_vm->_global->_inter_mouseX >= _vm->_draw->_fascinWin[i].left && 
+				_vm->_global->_inter_mouseX < _vm->_draw->_fascinWin[i].left + _vm->_draw->_fascinWin[i].width && 
+				_vm->_global->_inter_mouseY >= _vm->_draw->_fascinWin[i].top && 
+				_vm->_global->_inter_mouseY < _vm->_draw->_fascinWin[i].top + _vm->_draw->_fascinWin[i].height)
+				if (_vm->_draw->_fascinWin[i].id == _vm->_draw->_winCount-1) {
+					dx = _vm->_draw->_fascinWin[i].left;
+					dy = _vm->_draw->_fascinWin[i].top;
+					if (_vm->_global->_inter_mouseX < _vm->_draw->_fascinWin[i].left + 12 && 
+						_vm->_global->_inter_mouseY < _vm->_draw->_fascinWin[i].top  + 12 && 
+						(VAR((_vm->_draw->_winVarArrayStatus / 4) + i) & 2))
+						return(5);
+					if (_vm->_global->_inter_mouseX >= _vm->_draw->_fascinWin[i].left + _vm->_draw->_fascinWin[i].width - 12 && 
+						_vm->_global->_inter_mouseY < _vm->_draw->_fascinWin[i].top + 12 && 
+						(VAR((_vm->_draw->_winVarArrayStatus / 4) + i) & 4))
+						return(6);
+					return(-i);
+				}
+	return(0);
+}
+
 uint16 Hotspots::checkMouse(Type type, uint16 &id, uint16 &index) const {
 	id    = 0;
 	index = 0;
@@ -1581,29 +1606,56 @@
 int16 Hotspots::findCursor(uint16 x, uint16 y) const {
 	int16 cursor = 0;
 
-	for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) {
-		const Hotspot &spot = _hotspots[i];
+	int16 deltax;
+	int16 deltay;
+	
+	if ( _vm->getGameType() == kGameTypeFascination ) {
+		cursor = curWindow(deltax, deltay);
+	}
+	if (cursor == 0) {
+		for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) {
+			const Hotspot &spot = _hotspots[i];
 
-		if ((spot.getWindow() != 0) || spot.isDisabled())
-			// Ignore disabled and non-main-windowed hotspots
-			continue;
+			if ((spot.getWindow() != 0) || spot.isDisabled())
+				// Ignore disabled and non-main-windowed hotspots
+				continue;
 
-		if (!spot.isIn(x, y))
-			// We're not in that hotspot, ignore it
-			continue;
+			if (!spot.isIn(x, y))
+				// We're not in that hotspot, ignore it
+				continue;
 
-		if (spot.getCursor() == 0) {
-			// Hotspot doesn't itself specify a cursor...
-			if (spot.getType() >= kTypeInput1NoLeave) {
-				// ...but the type has a generic one
-				cursor = 3;
-				break;
-			} else if ((spot.getButton() != kMouseButtonsRight) && (cursor == 0))
-				// ...but there's a generic "click" cursor
-				cursor = 1;
-		} else if (cursor == 0)
-			// Hotspot had an attached cursor index
-			cursor = spot.getCursor();
+			if (spot.getCursor() == 0) {
+				// Hotspot doesn't itself specify a cursor...
+				if (spot.getType() >= kTypeInput1NoLeave) {
+					// ...but the type has a generic one
+					cursor = 3;
+					break;
+				} else if ((spot.getButton() != kMouseButtonsRight) && (cursor == 0))
+					// ...but there's a generic "click" cursor
+					cursor = 1;
+			} else if (cursor == 0)
+				// Hotspot had an attached cursor index
+				cursor = spot.getCursor();
+		}
+	} else {
+		if (cursor < 0) {
+			int16 curType = - cursor * 256;
+			cursor = 0;
+			for (int i = 0; (i < kHotspotCount) && !_hotspots[i].isEnd(); i++) {
+				const Hotspot &spot = _hotspots[i];
+				if ((spot.flags & 0xFF00) == curType)
+					if (spot.isIn(x - deltax, y - deltay)) {
+						if (spot.getType() < kTypeInput1NoLeave)
+							cursor = 1;
+						else 
+							cursor = 3;
+						break; 
+					}
+			}
+		}
+		if (_vm->_draw->_cursorAnimLow[cursor] == -1)
+		// If the cursor is invalid... there's a generic "click" cursor
+			cursor = 1;
 	}
 
 	return cursor;

Modified: scummvm/trunk/engines/gob/hotspots.h
===================================================================
--- scummvm/trunk/engines/gob/hotspots.h	2009-12-01 19:19:58 UTC (rev 46232)
+++ scummvm/trunk/engines/gob/hotspots.h	2009-12-01 21:49:45 UTC (rev 46233)
@@ -202,6 +202,9 @@
 	/** Handling hotspot leave events. */
 	void leave(uint16 index);
 
+	/** Which window is the mouse cursor currently in? (Fascination) */
+	int16 curWindow(int16 &dx, int16 &dy) const;
+
 	/** Which hotspot is the mouse cursor currently at? */
 	uint16 checkMouse(Type type, uint16 &id, uint16 &index) const;
 


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