[Scummvm-git-logs] scummvm master -> f2ffba0f855ab998f3c84ff70c9ef7b4f3f8fb74

salty-horse ori at avtalion.name
Fri Feb 12 15:13:31 UTC 2021


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

Summary:
f2ffba0f85 AGS: Fix hit detection in dialog boxes


Commit: f2ffba0f855ab998f3c84ff70c9ef7b4f3f8fb74
    https://github.com/scummvm/scummvm/commit/f2ffba0f855ab998f3c84ff70c9ef7b4f3f8fb74
Author: Ori Avtalion (ori at avtalion.name)
Date: 2021-02-12T17:12:39+02:00

Commit Message:
AGS: Fix hit detection in dialog boxes

Changed paths:
    engines/ags/engine/gui/mylistbox.cpp
    engines/ags/engine/gui/mypushbutton.cpp
    engines/ags/engine/gui/newcontrol.cpp


diff --git a/engines/ags/engine/gui/mylistbox.cpp b/engines/ags/engine/gui/mylistbox.cpp
index 2579767a1e..107e82e82f 100644
--- a/engines/ags/engine/gui/mylistbox.cpp
+++ b/engines/ags/engine/gui/mylistbox.cpp
@@ -110,14 +110,14 @@ void MyListBox::draw(Bitmap *ds) {
 }
 
 int MyListBox::pressedon(int mousex, int mousey) {
-	if (_G(mousex) > x + wid - ARROWWIDTH) {
-		if ((_G(mousey) - y < hit / 2) & (topitem > 0))
+	if (mousex > x + wid - ARROWWIDTH) {
+		if ((mousey - y < hit / 2) & (topitem > 0))
 			topitem--;
-		else if ((_G(mousey) - y > hit / 2) &(topitem + numonscreen < items))
+		else if ((mousey - y > hit / 2) &(topitem + numonscreen < items))
 			topitem++;
 
 	} else {
-		selected = ((_G(mousey) - y) - 2) / TEXT_HT + topitem;
+		selected = ((mousey - y) - 2) / TEXT_HT + topitem;
 		if (selected >= items)
 			selected = items - 1;
 
diff --git a/engines/ags/engine/gui/mypushbutton.cpp b/engines/ags/engine/gui/mypushbutton.cpp
index 7fbc5c7f10..5a618d4bb5 100644
--- a/engines/ags/engine/gui/mypushbutton.cpp
+++ b/engines/ags/engine/gui/mypushbutton.cpp
@@ -86,7 +86,7 @@ int MyPushButton::pressedon(int mousex, int mousey) {
 	while (mbutrelease(LEFT) == 0) {
 
 		wasstat = state;
-		state = mouseisinarea(_G(mousex), _G(mousey));
+		state = mouseisinarea(mousex, mousey);
 		// stop mp3 skipping if button held down
 		update_polled_stuff_if_runtime();
 		if (wasstat != state) {
diff --git a/engines/ags/engine/gui/newcontrol.cpp b/engines/ags/engine/gui/newcontrol.cpp
index d709adf82b..6738c54d57 100644
--- a/engines/ags/engine/gui/newcontrol.cpp
+++ b/engines/ags/engine/gui/newcontrol.cpp
@@ -56,7 +56,7 @@ int NewControl::mouseisinarea(int mousex, int mousey) {
 	if (topwindowhandle != wlevel)
 		return 0;
 
-	if ((_G(mousex) > x) &(_G(mousex) < x + wid) &(_G(mousey) > y) &(_G(mousey) < y + hit))
+	if ((mousex > x) && (mousex < x + wid) && (mousey > y) && (mousey < y + hit))
 		return 1;
 
 	return 0;




More information about the Scummvm-git-logs mailing list