[Scummvm-cvs-logs] SF.net SVN: scummvm:[52487] scummvm/trunk/engines/mohawk

mthreepwood at users.sourceforge.net mthreepwood at users.sourceforge.net
Thu Sep 2 01:22:13 CEST 2010


Revision: 52487
          http://scummvm.svn.sourceforge.net/scummvm/?rev=52487&view=rev
Author:   mthreepwood
Date:     2010-09-01 23:22:12 +0000 (Wed, 01 Sep 2010)

Log Message:
-----------
MOHAWK: Cleanup mouse cursor position handling in Riven

This fixes some cursors showing up incorrectly if the cursor moved during ie. a video and then the card changes. Also, remove an unneeded rect check in loadHotspots() that's from the ancient times before script size calculation was fixed and some warnings that don't affect gameplay.

Modified Paths:
--------------
    scummvm/trunk/engines/mohawk/riven.cpp
    scummvm/trunk/engines/mohawk/riven.h
    scummvm/trunk/engines/mohawk/riven_external.cpp

Modified: scummvm/trunk/engines/mohawk/riven.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/riven.cpp	2010-09-01 22:15:10 UTC (rev 52486)
+++ scummvm/trunk/engines/mohawk/riven.cpp	2010-09-01 23:22:12 UTC (rev 52487)
@@ -143,11 +143,10 @@
 		while (_eventMan->pollEvent(event)) {
 			switch (event.type) {
 			case Common::EVENT_MOUSEMOVE:
-				_mousePos = event.mouse;
 				checkHotspotChange();
 
 				// Check to show the inventory
-				if (_mousePos.y >= 392)
+				if (_eventMan->getMousePos().y >= 392)
 					_gfx->showInventory();
 				else
 					_gfx->hideInventory();
@@ -384,7 +383,6 @@
 	_hotspotCount = inStream->readUint16BE();
 	_hotspots = new RivenHotspot[_hotspotCount];
 
-
 	for (uint16 i = 0; i < _hotspotCount; i++) {
 		_hotspots[i].enabled = true;
 
@@ -396,26 +394,12 @@
 		int16 right = inStream->readSint16BE();
 		int16 bottom = inStream->readSint16BE();
 
-		// Riven has some weird hotspots, disable them here
-		if (left >= right || top >= bottom) {
-			left = top = right = bottom = 0;
-			_hotspots[i].enabled = 0;
-		}
-
 		_hotspots[i].rect = Common::Rect(left, top, right, bottom);
 
 		_hotspots[i].u0 = inStream->readUint16BE();
-
-		if (_hotspots[i].u0 != 0)
-			warning("Hotspot %d u0 non-zero", i);
-
 		_hotspots[i].mouse_cursor = inStream->readUint16BE();
 		_hotspots[i].index = inStream->readUint16BE();
 		_hotspots[i].u1 = inStream->readSint16BE();
-
-		if (_hotspots[i].u1 != -1)
-			warning("Hotspot %d u1 not -1", i);
-
 		_hotspots[i].zipModeHotspot = inStream->readUint16BE();
 
 		// Read in the scripts now
@@ -455,7 +439,7 @@
 	uint16 hotspotIndex = 0;
 	bool foundHotspot = false;
 	for (uint16 i = 0; i < _hotspotCount; i++)
-		if (_hotspots[i].enabled && _hotspots[i].rect.contains(_mousePos)) {
+		if (_hotspots[i].enabled && _hotspots[i].rect.contains(_eventMan->getMousePos())) {
 			foundHotspot = true;
 			hotspotIndex = i;
 		}
@@ -481,8 +465,10 @@
 }
 
 void MohawkEngine_Riven::checkInventoryClick() {
+	Common::Point mousePos = _eventMan->getMousePos();
+
 	// Don't even bother. We're not in the inventory portion of the screen.
-	if (_mousePos.y < 392)
+	if (mousePos.y < 392)
 		return;
 
 	// No inventory in the demo or opening screens.
@@ -500,31 +486,31 @@
 
 	// Go to the book if a hotspot contains the mouse
 	if (!hasCathBook) {
-		if (g_atrusJournalRect1->contains(_mousePos)) {
+		if (g_atrusJournalRect1->contains(mousePos)) {
 			_gfx->hideInventory();
 			changeToStack(aspit);
 			changeToCard(5);
 		}
 	} else if (!hasTrapBook) {
-		if (g_atrusJournalRect2->contains(_mousePos)) {
+		if (g_atrusJournalRect2->contains(mousePos)) {
 			_gfx->hideInventory();
 			changeToStack(aspit);
 			changeToCard(5);
-		} else if (g_cathJournalRect2->contains(_mousePos)) {
+		} else if (g_cathJournalRect2->contains(mousePos)) {
 			_gfx->hideInventory();
 			changeToStack(aspit);
 			changeToCard(6);
 		}
 	} else {
-		if (g_atrusJournalRect3->contains(_mousePos)) {
+		if (g_atrusJournalRect3->contains(mousePos)) {
 			_gfx->hideInventory();
 			changeToStack(aspit);
 			changeToCard(5);
-		} else if (g_cathJournalRect3->contains(_mousePos)) {
+		} else if (g_cathJournalRect3->contains(mousePos)) {
 			_gfx->hideInventory();
 			changeToStack(aspit);
 			changeToCard(6);
-		} else if (g_trapBookRect3->contains(_mousePos)) {
+		} else if (g_trapBookRect3->contains(mousePos)) {
 			_gfx->hideInventory();
 			changeToStack(aspit);
 			changeToCard(7);

Modified: scummvm/trunk/engines/mohawk/riven.h
===================================================================
--- scummvm/trunk/engines/mohawk/riven.h	2010-09-01 22:15:10 UTC (rev 52486)
+++ scummvm/trunk/engines/mohawk/riven.h	2010-09-01 23:22:12 UTC (rev 52487)
@@ -169,7 +169,6 @@
 	uint16 matchRMAPToCard(uint32);
 	uint32 getCurCardRMAP();
 
-	Common::Point _mousePos;
 	RivenHotspot *_hotspots;
 	int32 _curHotspot;
 	Common::Array<ZipMode> _zipModeData;

Modified: scummvm/trunk/engines/mohawk/riven_external.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/riven_external.cpp	2010-09-01 22:15:10 UTC (rev 52486)
+++ scummvm/trunk/engines/mohawk/riven_external.cpp	2010-09-01 23:22:12 UTC (rev 52487)
@@ -304,7 +304,7 @@
 void RivenExternal::checkSliderCursorChange(uint16 startHotspot) {
 	// Set the cursor based on _sliderState and what hotspot we're over
 	for (uint16 i = 0; i < kDomeSliderSlotCount; i++) {
-		if (_vm->_hotspots[i + startHotspot].rect.contains(_vm->_mousePos)) {
+		if (_vm->_hotspots[i + startHotspot].rect.contains(_vm->_system->getEventManager()->getMousePos())) {
 			if (_sliderState & (1 << (24 - i)))
 				_vm->_gfx->changeCursor(kRivenOpenHandCursor);
 			else
@@ -318,7 +318,7 @@
 	int16 foundSlider = -1;
 
 	for (uint16 i = 0; i < kDomeSliderSlotCount; i++) {
-		if (_vm->_hotspots[i + startHotspot].rect.contains(_vm->_mousePos)) {
+		if (_vm->_hotspots[i + startHotspot].rect.contains(_vm->_system->getEventManager()->getMousePos())) {
 			// If the slider is not at this hotspot, we can't do anything else
 			if (!(_sliderState & (1 << (24 - i))))
 				return;
@@ -887,6 +887,8 @@
 }
 
 void RivenExternal::xvalvecontrol(uint16 argc, uint16 *argv) {
+	Common::Point startPos = _vm->_system->getEventManager()->getMousePos();
+
 	// Get the variable for the valve
 	uint32 *valve = _vm->matchVarToString("bvalve");
 
@@ -904,8 +906,8 @@
 		while (_vm->_system->getEventManager()->pollEvent(event)) {
 			switch (event.type) {
 			case Common::EVENT_MOUSEMOVE:
-				changeX = event.mouse.x - _vm->_mousePos.x;
-				changeY = _vm->_mousePos.y - event.mouse.y;
+				changeX = event.mouse.x - startPos.x;
+				changeY = startPos.y - event.mouse.y;
 				_vm->_system->updateScreen();
 				break;
 			case Common::EVENT_LBUTTONUP:
@@ -1290,6 +1292,8 @@
 }
 
 int RivenExternal::jspitElevatorLoop() {
+	Common::Point startPos = _vm->_system->getEventManager()->getMousePos();
+
 	Common::Event event;
 	int changeLevel = 0;
 
@@ -1299,9 +1303,9 @@
 		while (_vm->_system->getEventManager()->pollEvent(event)) {
 			switch (event.type) {
 			case Common::EVENT_MOUSEMOVE:
-				if (event.mouse.y > (_vm->_mousePos.y + 10)) {
+				if (event.mouse.y > (startPos.y + 10)) {
 					changeLevel = -1;
-				} else if (event.mouse.y < (_vm->_mousePos.y - 10)) {
+				} else if (event.mouse.y < (startPos.y - 10)) {
 					changeLevel = 1;
 				} else {
 					changeLevel = 0;


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