Improved adjustment of scrolling direction with emphasis on cardinal directions like the original.

This commit is contained in:
nev6502
2020-07-08 01:56:21 -06:00
parent f362bda53a
commit a2e4e7a8f1
+9 -11
View File
@@ -126,19 +126,17 @@ void ScrollClass::AI(KeyNumType &input, int x, int y)
** Adjust the mouse coordinates to emphasize the
** cardinal directions over the diagonals.
*/
int altx = y;
if (altx < (50)) altx -= (50) - altx;
altx = max(altx, 0);
if (altx > ((half_screen_width - 50))) altx += altx - ((half_screen_width - 50));
altx = min(altx, screen_width);
int altx = x;
int alty = y;
if (alty < (50)) alty -= (50) - alty;
alty = max(alty, 0);
if (alty > ((half_screen_height - 50))) alty += alty - ((half_screen_height - 50));
alty = min(alty, screen_height);
direction = (DirType)Desired_Facing256((half_screen_width), (half_screen_height), x, y);
if (alty == 0 || alty >= screen_height - 1){
if (altx != (half_screen_width)) {
float offset_x = (half_screen_width - altx) * .7;
altx = altx + offset_x;
}
}
direction = (DirType)Desired_Facing256((half_screen_width), (half_screen_height), altx, alty);
}
int control = Dir_Facing(direction);