[Scummvm-cvs-logs] CVS: scummvm/scumm script.cpp,1.98,1.99 scummvm.cpp,2.174,2.175 verbs.cpp,1.46,1.47

Max Horn fingolfin at users.sourceforge.net
Wed May 21 16:55:04 CEST 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv18089

Modified Files:
	script.cpp scummvm.cpp verbs.cpp 
Log Message:
cleaned up V2 input code

Index: script.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script.cpp,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -d -r1.98 -r1.99
--- script.cpp	21 May 2003 21:41:27 -0000	1.98
+++ script.cpp	21 May 2003 23:54:39 -0000	1.99
@@ -869,10 +869,18 @@
 
 	if (_features & GF_AFTER_V2) {
 		verbScript = 4;
-		if (a == 1)	// Verb clicked
+		_scummVars[VAR_CLICK_AREA] = a;
+		switch(a) {
+		case 1:		// Verb clicked
 			_scummVars[33] = cmd;
-	} else
+			break;
+		case 3:		// Inventory clicked
+			_scummVars[35] = cmd;
+			break;
+		}
+	} else {
 		verbScript = VAR(VAR_VERB_SCRIPT);
+	}
 
 	memset(args, 0, sizeof(args));
 	args[0] = a;

Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scummvm.cpp,v
retrieving revision 2.174
retrieving revision 2.175
diff -u -d -r2.174 -r2.175
--- scummvm.cpp	21 May 2003 18:53:00 -0000	2.174
+++ scummvm.cpp	21 May 2003 23:54:39 -0000	2.175
@@ -1859,24 +1859,15 @@
 		VAR(VAR_LEFTBTN_HOLD) = (_leftBtnPressed & msDown) != 0;
 		VAR(VAR_RIGHTBTN_HOLD) = (_rightBtnPressed & msDown) != 0;
 	} else if (_features & GF_AFTER_V2) {
-		// Store the input type. So far we can't distinguise
+		// Store the input type. So far we can't distinguish
 		// between 1, 3 and 5.
 		// 1) Verb	2) Scene	3) Inv.		4) Key
 		// 5) Sentence Bar
 
-		if  (_mouseButStat & MBS_LEFT_CLICK) {
-			VirtScreen *zone = findVirtScreen(_mouse.y);
-
-			if (zone->number == 0)		// Clicked in scene
-				_scummVars[VAR_CLICK_AREA] = 2;
-			else if (zone->number == 2) {	// Clicked in verb/sentence
-				if (_mouse.y > zone->topline + 32)
-					_scummVars[VAR_CLICK_AREA] = 3; // Inventory
-				else
-					_scummVars[VAR_CLICK_AREA] = 1; // Verb
-			}
-		} else if (_lastKeyHit) 		// Key Input
-			_scummVars[VAR_CLICK_AREA] = 4;
+		if (_lastKeyHit) {		// Key Input
+			VAR(VAR_KEYPRESS) = _lastKeyHit;
+			runInputScript(4, 0, 0);
+		}
 	}
 
 	_leftBtnPressed &= ~msClicked;

Index: verbs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/verbs.cpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- verbs.cpp	21 May 2003 18:09:49 -0000	1.46
+++ verbs.cpp	21 May 2003 23:54:39 -0000	1.47
@@ -39,8 +39,7 @@
 
 	object = findInventory(_scummVars[VAR_EGO], object+1);
 	if (object > 0) {
-		_scummVars[35] = object;
-		runScript(4, 0, 0, 0);
+		runInputScript(3, object, 0);
 	}
 }
 
@@ -80,14 +79,14 @@
 	if (curInventoryCount > 0) { // Draw Up Arrow
 		_string[1].xpos = 145;
 		_string[1].ypos = virtscr[2].topline + 32;
-		_messagePtr = (const byte *)"U";
+		_messagePtr = (const byte *)"\1\2";
 		drawString(1);
 	}
 
 	if (items == 4) {     // Draw Down Arrow
 		_string[1].xpos = 145;
 		_string[1].ypos = virtscr[2].topline + 47;
-		_messagePtr = (const byte *)"D";
+		_messagePtr = (const byte *)"\3\4";
 		drawString(1);
 	}
 }
@@ -124,14 +123,17 @@
 		}
 		runInputScript(4, _mouseButStat, 1);
 	} else if (_mouseButStat & MBS_MOUSE_MASK) {
+		VirtScreen *zone = findVirtScreen(_mouse.y);
 		byte code = _mouseButStat & MBS_LEFT_CLICK ? 1 : 2;
-		if (_mouse.y >= virtscr[0].topline && _mouse.y < virtscr[0].topline + virtscr[0].height) {
+		if (zone->number == 0) {
 			over = checkMouseOver(_mouse.x, _mouse.y);
 			if (over != 0) {
 				runInputScript(1, _verbs[over].verbid, code);
 				return;
 			}
 			runInputScript(2, 0, code);
+		} else if (_features & GF_AFTER_V2 && zone->number == 2 && _mouse.y > zone->topline + 32) {
+			checkV2Inventory(_mouse.x, _mouse.y);
 		} else {
 			over = checkMouseOver(_mouse.x, _mouse.y);
 
@@ -178,9 +180,6 @@
 
 		return i;
 	} while (--vs, --i);
-
-	if (_features & GF_AFTER_V2)
-		checkV2Inventory(x, y);
 
 	return 0;
 }





More information about the Scummvm-git-logs mailing list