[Scummvm-cvs-logs] scummvm master -> 2509b6475cb05fd9375a3455a5714d8fd2f4c316

digitall dgturner at iee.org
Mon Dec 3 13:05:52 CET 2012


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
220fb66364 TINSEL: Add scrollwheel support to save/load and inventory
2509b6475c Merge pull request #294 from eriktorbjorn/tinsel-scrollwheel


Commit: 220fb663648059fb39178b081385a0f44a572690
    https://github.com/scummvm/scummvm/commit/220fb663648059fb39178b081385a0f44a572690
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2012-11-24T02:06:42-08:00

Commit Message:
TINSEL: Add scrollwheel support to save/load and inventory

Changed paths:
    engines/tinsel/dialogs.cpp
    engines/tinsel/events.cpp
    engines/tinsel/events.h
    engines/tinsel/tinsel.cpp



diff --git a/engines/tinsel/dialogs.cpp b/engines/tinsel/dialogs.cpp
index e1a2923..562f519 100644
--- a/engines/tinsel/dialogs.cpp
+++ b/engines/tinsel/dialogs.cpp
@@ -4861,50 +4861,101 @@ static void InvDragEnd() {
 	g_Xchange = g_Ychange = 0;		// Probably no need, but does no harm!
 }
 
-static void MenuPageDown() {
+static bool MenuDown(int lines) {
 	if (cd.box == loadBox || cd.box == saveBox) {
-		if (cd.extraBase < MAX_SAVED_FILES-NUM_RGROUP_BOXES) {
-			FirstFile(cd.extraBase+(NUM_RGROUP_BOXES - 1));
+		if (cd.extraBase < MAX_SAVED_FILES - NUM_RGROUP_BOXES) {
+			FirstFile(cd.extraBase + lines);
 			AddBoxes(true);
-			cd.selBox = NUM_RGROUP_BOXES - 1;
-			Select(cd.selBox, true);
+			return true;
 		}
 	} else if (cd.box == hopperBox1) {
 		if (cd.extraBase < g_numScenes - NUM_RGROUP_BOXES) {
-			FirstScene(cd.extraBase + (NUM_RGROUP_BOXES - 1));
+			FirstScene(cd.extraBase + lines);
 			AddBoxes(true);
-			if (cd.selBox)
-				cd.selBox = NUM_RGROUP_BOXES - 1;
-			Select(cd.selBox, true);
+			return true;
 		}
 	} else if (cd.box == hopperBox2) {
 		if (cd.extraBase < g_numEntries - NUM_RGROUP_BOXES) {
-			FirstEntry(cd.extraBase+(NUM_RGROUP_BOXES - 1));
+			FirstEntry(cd.extraBase + lines);
 			AddBoxes(true);
-			if (cd.selBox)
-				cd.selBox = NUM_RGROUP_BOXES - 1;
-			Select(cd.selBox, true);
+			return true;
 		}
 	}
+	return false;
 }
 
-static void MenuPageUp() {
+static bool MenuUp(int lines) {
 	if (cd.extraBase > 0) {
 		if (cd.box == loadBox || cd.box == saveBox)
-			FirstFile(cd.extraBase-(NUM_RGROUP_BOXES - 1));
+			FirstFile(cd.extraBase - lines);
 		else if (cd.box == hopperBox1)
-			FirstScene(cd.extraBase-(NUM_RGROUP_BOXES - 1));
+			FirstScene(cd.extraBase - lines);
 		else if (cd.box == hopperBox2)
-			FirstEntry(cd.extraBase-(NUM_RGROUP_BOXES - 1));
+			FirstEntry(cd.extraBase - lines);
 		else
-			return;
+			return false;
 
 		AddBoxes(true);
+		return true;
+	}
+	return false;
+}
+
+static void MenuRollDown() {
+	if (MenuDown(1)) {
+		if (cd.selBox > 0)
+			cd.selBox--;
+		Select(cd.selBox, true);
+	}
+}
+
+static void MenuRollUp() {
+	if (MenuUp(1)) {
+		if (cd.selBox < NUM_RGROUP_BOXES - 1)
+			cd.selBox++;
+		Select(cd.selBox, true);
+	}
+}
+
+static void MenuPageDown() {
+	if (MenuDown(NUM_RGROUP_BOXES - 1)) {
+		cd.selBox = NUM_RGROUP_BOXES - 1;
+		Select(cd.selBox, true);
+	}
+}
+
+static void MenuPageUp() {
+	if (MenuUp(NUM_RGROUP_BOXES - 1)) {
 		cd.selBox = 0;
 		Select(cd.selBox, true);
 	}
 }
 
+static void InventoryDown() {
+	// This code is a copy of the IB_SLIDE_DOWN case in InvWalkTo
+	// TODO: So share this duplicate code
+	if (g_InvD[g_ino].NoofVicons == 1)
+		if (g_InvD[g_ino].FirstDisp + g_InvD[g_ino].NoofHicons*g_InvD[g_ino].NoofVicons < g_InvD[g_ino].NoofItems)
+			g_InvD[g_ino].FirstDisp += g_InvD[g_ino].NoofHicons;
+	for (int i = 1; i < g_InvD[g_ino].NoofVicons; i++) {
+		if (g_InvD[g_ino].FirstDisp + g_InvD[g_ino].NoofHicons*g_InvD[g_ino].NoofVicons < g_InvD[g_ino].NoofItems)
+			g_InvD[g_ino].FirstDisp += g_InvD[g_ino].NoofHicons;
+	}
+	g_ItemsChanged = true;
+}
+
+static void InventoryUp() {
+	// This code is a copy of the I_SLIDE_UP case in InvWalkTo
+	// TODO: So share this duplicate code
+	if (g_InvD[g_ino].NoofVicons == 1)
+		g_InvD[g_ino].FirstDisp -= g_InvD[g_ino].NoofHicons;
+	for (int i = 1; i < g_InvD[g_ino].NoofVicons; i++)
+		g_InvD[g_ino].FirstDisp -= g_InvD[g_ino].NoofHicons;
+	if (g_InvD[g_ino].FirstDisp < 0)
+		g_InvD[g_ino].FirstDisp = 0;
+	g_ItemsChanged = true;
+}
+
 /**************************************************************************/
 /************** Incoming events - further processing **********************/
 /**************************************************************************/
@@ -5402,16 +5453,7 @@ extern void EventToInventory(PLR_EVENT pEvent, const Common::Point &coOrds) {
 			// Only act if load or save screen
 			MenuPageDown();
 		} else {
-			// This code is a copy of the IB_SLIDE_DOWN case in InvWalkTo
-			// TODO: So share this duplicate code
-			if (g_InvD[g_ino].NoofVicons == 1)
-				if (g_InvD[g_ino].FirstDisp + g_InvD[g_ino].NoofHicons*g_InvD[g_ino].NoofVicons < g_InvD[g_ino].NoofItems)
-					g_InvD[g_ino].FirstDisp += g_InvD[g_ino].NoofHicons;
-			for (int i = 1; i < g_InvD[g_ino].NoofVicons; i++) {
-				if (g_InvD[g_ino].FirstDisp + g_InvD[g_ino].NoofHicons*g_InvD[g_ino].NoofVicons < g_InvD[g_ino].NoofItems)
-					g_InvD[g_ino].FirstDisp += g_InvD[g_ino].NoofHicons;
-			}
-			g_ItemsChanged = true;
+			InventoryDown();
 		}
 		break;
 
@@ -5420,15 +5462,25 @@ extern void EventToInventory(PLR_EVENT pEvent, const Common::Point &coOrds) {
 			// Only act if load or save screen
 			MenuPageUp();
 		} else {
-			// This code is a copy of the I_SLIDE_UP case in InvWalkTo
-			// TODO: So share this duplicate code
-			if (g_InvD[g_ino].NoofVicons == 1)
-				g_InvD[g_ino].FirstDisp -= g_InvD[g_ino].NoofHicons;
-			for (int i = 1; i < g_InvD[g_ino].NoofVicons; i++)
-				g_InvD[g_ino].FirstDisp -= g_InvD[g_ino].NoofHicons;
-			if (g_InvD[g_ino].FirstDisp < 0)
-				g_InvD[g_ino].FirstDisp = 0;
-			g_ItemsChanged = true;
+			InventoryUp();
+		}
+		break;
+
+	case PLR_WHEEL_DOWN:
+		if (g_ino == INV_MENU) {
+			// Only act if load or save screen
+			MenuRollDown();
+		} else {
+			InventoryDown();
+		}
+		break;
+
+	case PLR_WHEEL_UP:
+		if (g_ino == INV_MENU) {
+			// Only act if load or save screen
+			MenuRollUp();
+		} else {
+			InventoryUp();
 		}
 		break;
 
diff --git a/engines/tinsel/events.cpp b/engines/tinsel/events.cpp
index 1aa4d34..61d3903 100644
--- a/engines/tinsel/events.cpp
+++ b/engines/tinsel/events.cpp
@@ -389,7 +389,8 @@ void PlayerEvent(PLR_EVENT pEvent, const Common::Point &coOrds) {
 		"PLR_PROV_WALKTO", "PLR_WALKTO", "PLR_LOOK", "PLR_ACTION", "PLR_ESCAPE",
 		"PLR_MENU", "PLR_QUIT", "PLR_PGUP", "PLR_PGDN", "PLR_HOME", "PLR_END",
 		"PLR_DRAG1_START", "PLR_DRAG1_END", "PLR_DRAG2_START", "PLR_DRAG2_END",
-		"PLR_JUMP", "PLR_NOEVENT"};
+		"PLR_JUMP", "PLR_NOEVENT", "PLR_SAVE", "PLR_LOAD", "PLR_WHEEL_UP",
+		"PLR_WHEEL_DOWN"};
 	debugC(DEBUG_BASIC, kTinselDebugActions, "%s - (%d,%d)",
 		actionList[pEvent], coOrds.x, coOrds.y);
 	static uint32 lastRealAction = 0;	// FIXME: Avoid non-const global vars
diff --git a/engines/tinsel/events.h b/engines/tinsel/events.h
index cdf5ae2..51669e4 100644
--- a/engines/tinsel/events.h
+++ b/engines/tinsel/events.h
@@ -65,6 +65,8 @@ enum PLR_EVENT {
 	PLR_NOEVENT = 16,
 	PLR_SAVE = 17,
 	PLR_LOAD = 18,
+	PLR_WHEEL_UP = 19,
+	PLR_WHEEL_DOWN = 20,
 
 	// Aliases used for DW1 actions
 	PLR_SLEFT = PLR_WALKTO,
diff --git a/engines/tinsel/tinsel.cpp b/engines/tinsel/tinsel.cpp
index 16ba6a8..a60eb2b 100644
--- a/engines/tinsel/tinsel.cpp
+++ b/engines/tinsel/tinsel.cpp
@@ -430,6 +430,14 @@ static void MouseProcess(CORO_PARAM, const void *) {
 				ProcessButEvent(PLR_DRAG2_END);
 			break;
 
+		case Common::EVENT_WHEELUP:
+			PlayerEvent(PLR_WHEEL_UP, mousePos);
+			break;
+
+		case Common::EVENT_WHEELDOWN:
+			PlayerEvent(PLR_WHEEL_DOWN, mousePos);
+			break;
+
 		default:
 			break;
 		}
@@ -1046,6 +1054,8 @@ bool TinselEngine::pollEvent() {
 	case Common::EVENT_LBUTTONUP:
 	case Common::EVENT_RBUTTONDOWN:
 	case Common::EVENT_RBUTTONUP:
+	case Common::EVENT_WHEELUP:
+	case Common::EVENT_WHEELDOWN:
 		// Add button to queue for the mouse process
 		_mouseButtons.push_back(event.type);
 		break;


Commit: 2509b6475cb05fd9375a3455a5714d8fd2f4c316
    https://github.com/scummvm/scummvm/commit/2509b6475cb05fd9375a3455a5714d8fd2f4c316
Author: David Turner (dgturner at iee.org)
Date: 2012-12-03T04:05:14-08:00

Commit Message:
Merge pull request #294 from eriktorbjorn/tinsel-scrollwheel

TINSEL: Add scrollwheel support to save/load and inventory

Changed paths:
    engines/tinsel/dialogs.cpp
    engines/tinsel/events.cpp
    engines/tinsel/events.h
    engines/tinsel/tinsel.cpp









More information about the Scummvm-git-logs mailing list