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

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sun Apr 6 15:06:05 CEST 2008


Revision: 31422
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31422&view=rev
Author:   lordhoto
Date:     2008-04-06 06:06:05 -0700 (Sun, 06 Apr 2008)

Log Message:
-----------
Fixed various bugs in GUI_v2::processButtonList.
This fixes bugs:
 - #1935827 "HoF: Buttons pressed state not available"
 - #1935219 "HoF: artefact after loading game"

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/gui_v2.cpp
    scummvm/trunk/engines/kyra/kyra_v2.cpp
    scummvm/trunk/engines/kyra/staticres.cpp

Modified: scummvm/trunk/engines/kyra/gui_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui_v2.cpp	2008-04-06 12:17:41 UTC (rev 31421)
+++ scummvm/trunk/engines/kyra/gui_v2.cpp	2008-04-06 13:06:05 UTC (rev 31422)
@@ -378,12 +378,14 @@
 }
 
 int GUI_v2::processButtonList(Button *buttonList, uint16 inputFlag) {
+	static uint16 flagsModifier = 0;
+
 	if (!buttonList)
 		return inputFlag & 0x7FFF;
 
 	if (_backUpButtonList != buttonList || _buttonListChanged) {
 		_unknownButtonList = 0;
-		//XXX_gui_unk2 (very strange code, maybe keyboard related? or some non interactive input...)
+		//flagsModifier |= 0x2200;
 		_backUpButtonList = buttonList;
 		_buttonListChanged = false;
 
@@ -402,19 +404,21 @@
 		uint16 inFlags = inputFlag & 0xFF;
 		uint16 temp = 0;
 
-		// this is NOT like in the original
-		// the original game somehow just enabled flag 0x1000 here
-		// but did some other magic, which looks like it depends on how the handle
-		// key input... so we just enable 0x1000 and 0x4000 here to allow
-		// all GUI buttons to work (for now at least...)
-		if (inFlags == 198 || inFlags == 199)
-			temp = 0x1000 | 0x4000;
+		// HACK: inFlags == 200 is our left button (up)
+		if (inFlags == 199 || inFlags == 200)
+			temp = 0x1000;
+		if (inFlags == 198)
+			temp = 0x100;
 
-		//if (inputFlag & 0x800)
-		//	temp <<= 2;
+		if (inputFlag & 0x800)
+			temp <<= 2;
 
-		// the original did some flag hackery here, this works fine too
 		flags |= temp;
+
+		flagsModifier &= ~((temp & 0x4400) >> 1);
+		flagsModifier |= (temp & 0x1100) * 2;
+		flags |= flagsModifier;
+		flags |= (flagsModifier << 2) ^ 0x8800;
 	}
 
 	buttonList = _backUpButtonList;
@@ -430,7 +434,7 @@
 			buttonList = buttonList->nextButton;
 			continue;
 		}
-		buttonList->flags2 &= 0xFFE7;
+		buttonList->flags2 &= ~0x18;
 		buttonList->flags2 |= (buttonList->flags2 & 3) << 3;
 
 		int x = buttonList->x;
@@ -448,6 +452,7 @@
 		if (mouseX >= x && mouseY >= y && mouseX <= x+buttonList->width && mouseY <= y+buttonList->height)
 			progress = true;
 
+		buttonList->flags2 &= ~0x80;
 		uint16 inFlags = inputFlag & 0x7FFF;
 		if (inFlags) {
 			if (buttonList->unk6 == inFlags) {
@@ -469,7 +474,7 @@
 
 		bool unk1 = false;
 		if (!progress)
-			buttonList->flags2 &= 0xFFF9;
+			buttonList->flags2 &= ~6;
 
 		if ((flags & 0x3300) && (buttonList->flags & 4) && progress && (buttonList == _unknownButtonList || !_unknownButtonList)) {
 			buttonList->flags |= 6;
@@ -478,7 +483,7 @@
 		} else if ((flags & 0x8800) && !(buttonList->flags & 4) && progress) {
 			buttonList->flags2 |= 6;
 		} else {
-			buttonList->flags2 &= 0xFFF9;
+			buttonList->flags2 &= ~6;
 		}
 
 		bool progressSwitch = false;
@@ -511,15 +516,15 @@
 
 				switch (flagTable[combinedFlags]) {
 				case 0x400:
-					if ((buttonList->flags & 1) && _unknownButtonList == buttonList) {
+					if (!(buttonList->flags & 1) || ((buttonList->flags & 1) && _unknownButtonList == buttonList)) {
 						buttonList->flags2 ^= 1;
 						returnValue = buttonList->index | 0x8000;
 						unk1 = true;
 					}
 
 					if (!(buttonList->flags & 4)) {
-						buttonList->flags2 &= 0xFFFB;
-						buttonList->flags2 &= 0xFFFD;
+						buttonList->flags2 &= ~4;
+						buttonList->flags2 &= ~2;
 					}
 					break;
 
@@ -551,8 +556,8 @@
 					if (buttonList->flags & 4) {
 						buttonList->flags2 |= 4;
 						buttonList->flags2 |= 2;
-						_unknownButtonList = buttonList;
 					}
+					_unknownButtonList = buttonList;
 					break;
 				}
 			}
@@ -570,7 +575,7 @@
 		if ((flags & 0x8800) == 0x8800) {
 			_unknownButtonList = 0;
 			if (!progress || (buttonList->flags & 4))
-				buttonList->flags2 &= 0xFFF9;
+				buttonList->flags2 &= ~6;
 		}
 
 		if (!progress && buttonList == _unknownButtonList && !(buttonList->flags & 0x40))
@@ -580,7 +585,7 @@
 			processButton(buttonList);
 
 		if (unk2)
-			buttonList->flags2 &= 0xFFFE;
+			buttonList->flags2 &= ~1;
 
 		if (unk1) {
 			buttonList->flags2 &= 0xFF;

Modified: scummvm/trunk/engines/kyra/kyra_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v2.cpp	2008-04-06 12:17:41 UTC (rev 31421)
+++ scummvm/trunk/engines/kyra/kyra_v2.cpp	2008-04-06 13:06:05 UTC (rev 31422)
@@ -771,10 +771,11 @@
 				_eventList.push_back(event);
 			break;
 
-		case Common::EVENT_LBUTTONUP:
+		case Common::EVENT_LBUTTONDOWN:
 			_eventList.push_back(Event(event, true));
 			break;
 
+		case Common::EVENT_LBUTTONUP:
 		case Common::EVENT_MOUSEMOVE:
 			_eventList.push_back(event);
 			break;
@@ -822,11 +823,12 @@
 			_screen->updateScreen();
 			} break;
 
+		case Common::EVENT_LBUTTONDOWN:
 		case Common::EVENT_LBUTTONUP: {
 			Common::Point pos = getMousePos();
 			_mouseX = pos.x;
 			_mouseY = pos.y;
-			keys = 199;
+			keys = event.type == Common::EVENT_LBUTTONDOWN ? 199 : (200 | 0x800);
 			breakLoop = true;
 			} break;
 

Modified: scummvm/trunk/engines/kyra/staticres.cpp
===================================================================
--- scummvm/trunk/engines/kyra/staticres.cpp	2008-04-06 12:17:41 UTC (rev 31421)
+++ scummvm/trunk/engines/kyra/staticres.cpp	2008-04-06 13:06:05 UTC (rev 31422)
@@ -1486,8 +1486,7 @@
 		GUI_V2_BUTTON(_sliderButtons[1][i], 0x1D+i, 0, 0, 1, 1, 1, 0x4487, 0, 0, 0, 0x0A, 0x0E, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0);
 	}
 	for (int i = 0; i < 3; ++i) {
-		// original used flags 0x2200 here, as long as our input code isn't 100% correct we have to use 0x1100 here though
-		GUI_V2_BUTTON(_sliderButtons[2][i], 0x21+i, 0, 0, 0, 0, 0, 0x1100, 0, 0, 0, 0x6E, 0x0E, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0);
+		GUI_V2_BUTTON(_sliderButtons[2][i], 0x21+i, 0, 0, 0, 0, 0, 0x2200, 0, 0, 0, 0x6E, 0x0E, 0xC7, 0xCF, 0xC7, 0xCF, 0xC7, 0xCF, 0);
 	}
 
 	for (uint i = 0; i < ARRAYSIZE(_menuButtons); ++i) {


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