[Scummvm-git-logs] scummvm master -> 861481b535df89c12ee85801318869b2d38d663b

dreammaster noreply at scummvm.org
Fri Jul 1 04:06:58 UTC 2022


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:
861481b535 CHEWY: Fix calculating scroll offsets on room changes


Commit: 861481b535df89c12ee85801318869b2d38d663b
    https://github.com/scummvm/scummvm/commit/861481b535df89c12ee85801318869b2d38d663b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2022-06-30T21:06:38-07:00

Commit Message:
CHEWY: Fix calculating scroll offsets on room changes

Changed paths:
    engines/chewy/main.cpp


diff --git a/engines/chewy/main.cpp b/engines/chewy/main.cpp
index 208928a0310..ffb3f80e7a3 100644
--- a/engines/chewy/main.cpp
+++ b/engines/chewy/main.cpp
@@ -1704,31 +1704,17 @@ void calc_ausgang(int16 x, int16 y) {
 }
 
 void get_scroll_off(int16 x, int16 y, int16 pic_x, int16 pic_y, int16 *sc_x, int16 *sc_y) {
-	if (pic_x == SCREEN_WIDTH)
-		*sc_x = 0;
-	else {
-		if ((pic_x - x) > (SCREEN_WIDTH / 2)) {
-			*sc_x = (((pic_x - 1) / SCREEN_WIDTH) - 1) * SCREEN_WIDTH;
-			if (!*sc_x && x > (SCREEN_WIDTH / 2)) {
-
-				*sc_x = x - (SCREEN_WIDTH / 2);
-			}
-		} else {
-			*sc_x = pic_x - SCREEN_WIDTH;
-		}
-	}
+	*sc_x = 0;
+	*sc_y = 0;
 
-	if (pic_y == SCREEN_HEIGHT)
-		*sc_y = 0;
-	else {
-		if ((pic_y - y) > (SCREEN_HEIGHT / 2)) {
-			*sc_y = (((pic_y - 1) / SCREEN_HEIGHT) - 1) * SCREEN_HEIGHT;
-			if (!*sc_y && y > (SCREEN_HEIGHT / 2))
+	if (x >= SCREEN_WIDTH) {
+		*sc_x = MIN(x - (SCREEN_WIDTH / 2),
+			pic_x - SCREEN_WIDTH);
+	}
 
-				*sc_y = y - (SCREEN_HEIGHT / 2);
-		} else {
-			*sc_y = pic_y - SCREEN_HEIGHT;
-		}
+	if (y >= SCREEN_HEIGHT) {
+		*sc_y = MIN(y - (SCREEN_HEIGHT / 2),
+			pic_y - SCREEN_HEIGHT);
 	}
 }
 




More information about the Scummvm-git-logs mailing list