[Scummvm-git-logs] scummvm master -> 2c71d84f51d7cd29d50734486493ba5d81f840e4

dreammaster noreply at scummvm.org
Sun May 29 16:44:17 UTC 2022


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:
b407e0ed52 CHEWY: Move static global rect arrays to the Globals class
2c71d84f51 CHEWY: Fix clicking in cinema dialog when no cutscenes yet


Commit: b407e0ed522998bf650a7df50df8075ec1e7059c
    https://github.com/scummvm/scummvm/commit/b407e0ed522998bf650a7df50df8075ec1e7059c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-05-29T09:40:38-07:00

Commit Message:
CHEWY: Move static global rect arrays to the Globals class

Changed paths:
    engines/chewy/dialogs/cinema.cpp
    engines/chewy/dialogs/files.cpp
    engines/chewy/dialogs/inventory.cpp
    engines/chewy/dialogs/options.cpp
    engines/chewy/globals.h


diff --git a/engines/chewy/dialogs/cinema.cpp b/engines/chewy/dialogs/cinema.cpp
index 61e18e076c7..9601da83207 100644
--- a/engines/chewy/dialogs/cinema.cpp
+++ b/engines/chewy/dialogs/cinema.cpp
@@ -32,13 +32,6 @@ namespace Dialogs {
 
 static constexpr int CINEMA_LINES = 12;
 
-static const Common::Rect cinematicsHotspots[] = {
-	{ 10,  80,  32, 105 },
-	{ 10, 150,  32, 175 },
-	{ 36,  64, 310, 188 },
-	{ -1,  -1,  -1,  -1 }
-};
-
 static const uint8 CINEMA_FLICS[35] = {
 	FCUT_000, FCUT_002, FCUT_006, FCUT_009, FCUT_015,
 	FCUT_012, FCUT_011, FCUT_SPACECHASE_18, FCUT_003, FCUT_048,
@@ -90,7 +83,7 @@ void Cinema::execute() {
 
 		if (_G(minfo).button == 1 && !flag) {
 			flag = true;
-			switch (_G(in)->findHotspot(cinematicsHotspots)) {
+			switch (_G(in)->findHotspot(_G(cinematicsHotspots))) {
 			case 0:
 				g_events->_kbInfo._scanCode = Common::KEYCODE_UP;
 				if (!endLoop)
diff --git a/engines/chewy/dialogs/files.cpp b/engines/chewy/dialogs/files.cpp
index 6894fbc3d17..155b7f59d72 100644
--- a/engines/chewy/dialogs/files.cpp
+++ b/engines/chewy/dialogs/files.cpp
@@ -38,18 +38,6 @@ enum Widget {
 	GAME = 4, QUIT = 5, OPTIONS = 6, W7 = 7, W8 = 8
 };
 
-static const Common::Rect fileHotspots[] = {
-	{  14,  73,  32,  94 },
-	{  14,  96,  32, 118 },
-	{  36,  64, 310, 128 },
-	{  16, 143,  76, 193 },
-	{  78, 143, 130, 193 },
-	{ 132, 143, 178, 193 },
-	{ 180, 143, 228, 193 },
-	{ 232, 143, 310, 193 },
-	{  -1,  -1,  -1,  -1 }
-};
-
 
 bool Files::execute(bool isInGame) {
 	int16 key = 0;
@@ -170,7 +158,7 @@ bool Files::execute(bool isInGame) {
 		}
 
 		if (!flag && _G(minfo).button == 1) {
-			int16 rect = _G(in)->findHotspot(fileHotspots);
+			int16 rect = _G(in)->findHotspot(_G(fileHotspots));
 			flag = true;
 			key = 0;
 
diff --git a/engines/chewy/dialogs/inventory.cpp b/engines/chewy/dialogs/inventory.cpp
index bd4f80c93b8..51b26b88d26 100644
--- a/engines/chewy/dialogs/inventory.cpp
+++ b/engines/chewy/dialogs/inventory.cpp
@@ -32,18 +32,6 @@
 namespace Chewy {
 namespace Dialogs {
 
-static const Common::Rect inventoryHotspots[] = {
-	{  21,  25,  51,  39 },
-	{  53,  25,  83,  39 },
-	{  -2,  -2,  -2,  -2 },
-	{ 213,  25, 243,  39 },
-	{ 253,  25, 283,  39 },
-	{  21,  45, 283, 135 },
-	{ 257, 151, 307, 165 },
-	{ 257, 171, 307, 185 },
-	{  -1,  -1,  -1,  -1 }
-};
-
 static const int16 ANI_INVENT_END[3] = { 7, 16, 24 };
 
 
@@ -63,11 +51,11 @@ void Inventory::plot_menu() {
 	}
 
 	int16 y;
-	int16 k = _G(in)->findHotspot(inventoryHotspots);
+	int16 k = _G(in)->findHotspot(_G(inventoryHotspots));
 	if (k != -1) {
 		if (k < 5)
-			_G(out)->boxFill(inventoryHotspots[k].left, inventoryHotspots[k].top,
-	  						 inventoryHotspots[k].right + 1, inventoryHotspots[k].bottom + 5, 41);
+			_G(out)->boxFill(_G(inventoryHotspots)[k].left, _G(inventoryHotspots)[k].top,
+	  						 _G(inventoryHotspots)[k].right + 1, _G(inventoryHotspots)[k].bottom + 5, 41);
 		else {
 			int16 x = (g_events->_mousePos.x - (WIN_INF_X)) / 54;
 			y = (g_events->_mousePos.y - (WIN_INF_Y + 4 + 30)) / 30;
@@ -170,7 +158,7 @@ void Inventory::menu() {
 				mouseFl = true;
 				g_events->_kbInfo._keyCode = '\0';
 
-				int16 k = _G(in)->findHotspot(inventoryHotspots);
+				int16 k = _G(in)->findHotspot(_G(inventoryHotspots));
 				if (keyVal == Common::KEYCODE_F1)
 					k = 0;
 				else if (keyVal == Common::KEYCODE_F2)
@@ -422,7 +410,7 @@ int16 Inventory::look(int16 invent_nr, int16 mode, int16 ats_nr) {
 	}
 
 	while (!endLoop) {
-		int16 rect = _G(in)->findHotspot(inventoryHotspots);
+		int16 rect = _G(in)->findHotspot(_G(inventoryHotspots));
 
 		if (_G(minfo).button) {
 			if (_G(minfo).button == 2) {
diff --git a/engines/chewy/dialogs/options.cpp b/engines/chewy/dialogs/options.cpp
index 9c89aa87280..3defc8f9cb1 100644
--- a/engines/chewy/dialogs/options.cpp
+++ b/engines/chewy/dialogs/options.cpp
@@ -45,19 +45,6 @@ namespace Dialogs {
 #define MUSIC_ON2 26
 #define EXIT 27
 
-static const Common::Rect optionHotspots[] = {
-	{  18,   61,   40,   76 },
-	{ 112,   61,  130,   76 },
-	{  82,  104,  144,  139 },
-	{ 164,   93,  194,  115 },
-	{ 198,   80,  206,  115 },
-	{ 210,   55,  302,  138 },
-	{ 126,  146,  210,  198 },
-	{  22,   92,   44,  136 },
-	{  50,   92,   72,  136 },
-	{  -1,   -1,   -1,   -1 }
-};
-
 void Options::execute(TafInfo *ti) {
 	long akt_clock = 0, stop_clock = 0;
 	_G(room)->load_tgp(0, &_G(room_blk), GBOOK_TGP, 0, GBOOK);
@@ -152,7 +139,7 @@ void Options::execute(TafInfo *ti) {
 		if ((_G(minfo).button == 1) || (key == Common::KEYCODE_RETURN)) {
 			WAIT_TASTE_LOS
 
-			int16 rect = _G(in)->findHotspot(optionHotspots);
+			int16 rect = _G(in)->findHotspot(_G(optionHotspots));
 			switch (rect) {
 			case 0:
 				if (_G(gameState).FramesPerSecond > 6)
diff --git a/engines/chewy/globals.h b/engines/chewy/globals.h
index d4d259adf00..2c53c2d901e 100644
--- a/engines/chewy/globals.h
+++ b/engines/chewy/globals.h
@@ -23,6 +23,7 @@
 #define CHEWY_GLOBALS_H
 
 #include "common/array.h"
+#include "common/rect.h"
 #include "chewy/chewy.h"
 #include "chewy/types.h"
 #include "chewy/atds.h"
@@ -263,6 +264,48 @@ public:
 	bool _timer_int = false;
 	int _timer_count = 0;
 	bool _timer_suspend = false;
+
+	// Hotspot rect arrays
+	const Common::Rect _cinematicsHotspots[4] = {
+		{ 10,  80,  32, 105 },
+		{ 10, 150,  32, 175 },
+		{ 36,  64, 310, 188 },
+		{ -1,  -1,  -1,  -1 }
+	};
+	const Common::Rect _fileHotspots[9] = {
+		{  14,  73,  32,  94 },
+		{  14,  96,  32, 118 },
+		{  36,  64, 310, 128 },
+		{  16, 143,  76, 193 },
+		{  78, 143, 130, 193 },
+		{ 132, 143, 178, 193 },
+		{ 180, 143, 228, 193 },
+		{ 232, 143, 310, 193 },
+		{  -1,  -1,  -1,  -1 }
+	};
+	const Common::Rect _inventoryHotspots[9] = {
+		{  21,  25,  51,  39 },
+		{  53,  25,  83,  39 },
+		{  -2,  -2,  -2,  -2 },
+		{ 213,  25, 243,  39 },
+		{ 253,  25, 283,  39 },
+		{  21,  45, 283, 135 },
+		{ 257, 151, 307, 165 },
+		{ 257, 171, 307, 185 },
+		{  -1,  -1,  -1,  -1 }
+	};
+	const Common::Rect _optionHotspots[10] = {
+		{  18,   61,   40,   76 },
+		{ 112,   61,  130,   76 },
+		{  82,  104,  144,  139 },
+		{ 164,   93,  194,  115 },
+		{ 198,   80,  206,  115 },
+		{ 210,   55,  302,  138 },
+		{ 126,  146,  210,  198 },
+		{  22,   92,   44,  136 },
+		{  50,   92,   72,  136 },
+		{  -1,   -1,   -1,   -1 }
+	};
 };
 
 extern Globals *g_globals;


Commit: 2c71d84f51d7cd29d50734486493ba5d81f840e4
    https://github.com/scummvm/scummvm/commit/2c71d84f51d7cd29d50734486493ba5d81f840e4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-05-29T09:43:21-07:00

Commit Message:
CHEWY: Fix clicking in cinema dialog when no cutscenes yet

Changed paths:
    engines/chewy/dialogs/cinema.cpp


diff --git a/engines/chewy/dialogs/cinema.cpp b/engines/chewy/dialogs/cinema.cpp
index 9601da83207..0abf640da92 100644
--- a/engines/chewy/dialogs/cinema.cpp
+++ b/engines/chewy/dialogs/cinema.cpp
@@ -101,9 +101,10 @@ void Cinema::execute() {
 			case 2:
 			{
 				int selIndex = (g_events->_mousePos.y - 68) / 10 + topIndex;
-				if (selIndex < (int)cutscenes.size())
+				if (selIndex < (int)cutscenes.size()) {
 					selected = selIndex;
-				g_events->_kbInfo._scanCode = Common::KEYCODE_RETURN;
+					g_events->_kbInfo._scanCode = Common::KEYCODE_RETURN;
+				}
 				break;
 			}
 




More information about the Scummvm-git-logs mailing list