[Scummvm-cvs-logs] SF.net SVN: scummvm:[41734] scummvm/trunk/engines/kyra

athrxx at users.sourceforge.net athrxx at users.sourceforge.net
Sun Jun 21 22:40:32 CEST 2009


Revision: 41734
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41734&view=rev
Author:   athrxx
Date:     2009-06-21 20:40:31 +0000 (Sun, 21 Jun 2009)

Log Message:
-----------
LOL: - implemented support for "floating cursors"
- prevent complete refresh for audio menu whenever a mouse button is pressed

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/gui_lol.cpp
    scummvm/trunk/engines/kyra/lol.cpp
    scummvm/trunk/engines/kyra/lol.h

Modified: scummvm/trunk/engines/kyra/gui_lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui_lol.cpp	2009-06-21 20:10:45 UTC (rev 41733)
+++ scummvm/trunk/engines/kyra/gui_lol.cpp	2009-06-21 20:40:31 UTC (rev 41734)
@@ -585,7 +585,7 @@
 }
 
 int LoLEngine::gui_enableControls() {
-	_floatingMouseArrowControl = 0;
+	_floatingCursorControl = 0;
 
 	if (!_currentControlMode) {
 		for (int i = 76; i < 85; i++)
@@ -600,7 +600,7 @@
 	if (_currentControlMode)
 		return 0;
 
-	_floatingMouseArrowControl = (controlMode & 2) ? 2 : 1;
+	_floatingCursorControl = (controlMode & 2) ? 2 : 1;
 
 	gui_toggleFightButtons(true);
 
@@ -2406,7 +2406,7 @@
 
 			if (getInput()) {
 				if (!_newMenu)
-					_newMenu = _currentMenu;
+					_newMenu = (_currentMenu != &_audioOptions) ? _currentMenu : 0;
 				else
 					_lastMenu = _menuResult == -1 ? _lastMenu : _currentMenu;
 			}
@@ -2685,8 +2685,10 @@
 
 	newVolume = CLIP(newVolume, 2, 102);
 
-	if (newVolume == oldVolume)
+	if (newVolume == oldVolume) {
+		_screen->updateScreen();
 		return 0;
+	}
 
 	_screen->drawShape(0, _vm->_gameShapes[87], tX + oldVolume, button->y, 0, 0x10);
 	// Temporary HACK

Modified: scummvm/trunk/engines/kyra/lol.cpp
===================================================================
--- scummvm/trunk/engines/kyra/lol.cpp	2009-06-21 20:10:45 UTC (rev 41733)
+++ scummvm/trunk/engines/kyra/lol.cpp	2009-06-21 20:40:31 UTC (rev 41734)
@@ -200,7 +200,7 @@
 	_partyPosX = _partyPosY = 0;
 	_shpDmX = _shpDmY = _dmScaleW = _dmScaleH = 0;
 
-	_floatingMouseArrowControl = 0;
+	_floatingCursorControl = _currentFloatingCursor = 0;
 
 	memset(_activeTim, 0, sizeof(_activeTim));
 	memset(_openDoorState, 0, sizeof(_openDoorState));
@@ -663,6 +663,55 @@
 	return true;
 }
 
+void LoLEngine::checkFloatingPointerRegions() {
+	if (!_floatingCursorsEnabled)
+		return;
+
+	int t = -1;
+
+	Common::Point p = getMousePos();
+	int mouseX = p.x;
+	int mouseY = p.y;
+
+	if (!(_updateFlags & 4) & !_floatingCursorControl) {
+		if (posWithinRect(p.x, p.y, 96, 0, 303, 136)) {
+			if (!posWithinRect(p.x, p.y, 128, 16, 271, 119)) {
+				if (posWithinRect(p.x, p.y, 112, 0, 287, 15))
+					t = 0;
+				if (posWithinRect(p.x, p.y, 272, 88, 303, 319))
+					t = 1;
+				if (posWithinRect(p.x, p.y, 112, 110, 287, 135))
+					t = 2;
+				if (posWithinRect(p.x, p.y, 96, 88, 127, 119))
+					t = 3;
+				if (posWithinRect(p.x, p.y, 96, 16, 127, 87))
+					t = 4;
+				if (posWithinRect(p.x, p.y, 272, 16, 303, 87))
+					t = 5;
+
+				if (t < 4) {
+					int d = (_currentDirection + t) & 3;
+					if (!checkBlockPassability(calcNewBlockPosition(_currentBlock, d), d))
+						t = 6;
+				}
+			}
+		}
+	}
+
+	if (t == _currentFloatingCursor)
+		return;
+
+	if (t == -1) {
+		setMouseCursorToItemInHand();
+	} else {
+		static const uint8 floatingPtrX[] = { 7, 13, 7, 0, 0, 15, 7 };
+		static const uint8 floatingPtrY[] = { 0, 7, 12, 7, 6, 6, 7 };
+		_screen->setMouseCursor(floatingPtrX[t], floatingPtrY[t], _gameShapes[10 + t]);
+	}
+
+	_currentFloatingCursor = t;
+}
+
 uint8 *LoLEngine::getItemIconShapePtr(int index) {
 	int ix = _itemProperties[_itemsInPlay[index].itemPropertyIndex].shpIndex;
 	if (_itemProperties[_itemsInPlay[index].itemPropertyIndex].flags & 0x200)
@@ -860,7 +909,7 @@
 
 		_timer->update();
 
-		//checkFloatingPointerRegions();
+		checkFloatingPointerRegions();
 		gui_updateInput();
 
 		update();
@@ -1465,7 +1514,7 @@
 	_specialSceneFlag = 1;
 	_currentControlMode = controlMode;
 	calcCharPortraitXpos();
-	//checkMouseRegions();
+	checkFloatingPointerRegions();
 }
 
 void LoLEngine::gui_specialSceneRestoreControls(int restoreLamp) {
@@ -1475,7 +1524,7 @@
 	}
 	_updateFlags &= 0xfffe;
 	_specialSceneFlag = 0;
-	//checkMouseRegions();
+	checkFloatingPointerRegions();
 }
 
 void LoLEngine::restoreAfterSceneWindowDialogue(int redraw) {

Modified: scummvm/trunk/engines/kyra/lol.h
===================================================================
--- scummvm/trunk/engines/kyra/lol.h	2009-06-21 20:10:45 UTC (rev 41733)
+++ scummvm/trunk/engines/kyra/lol.h	2009-06-21 20:40:31 UTC (rev 41734)
@@ -347,7 +347,9 @@
 	uint8 *getItemIconShapePtr(int index);
 	bool posWithinRect(int mouseX, int mouseY, int x1, int y1, int x2, int y2);
 
-	int _floatingMouseArrowControl;
+	void checkFloatingPointerRegions();
+	int _floatingCursorControl;
+	int _currentFloatingCursor;
 
 	// intro + character selection
 	int processPrologue();


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