| 877 | } |
| 878 | |
| 879 | void HandleRightStickMotion() |
| 880 | { |
| 881 | static RightStickAccumulator acc; |
| 882 | // deadzone is handled in ScaleJoystickAxes() already |
| 883 | if (rightStickX == 0 && rightStickY == 0) { |
| 884 | acc.clear(); |
| 885 | return; |
| 886 | } |
| 887 | |
| 888 | if (IsAutomapActive()) { // move map |
| 889 | int dx = 0, dy = 0; |
| 890 | acc.pool(&dx, &dy, 32); |
| 891 | AutoMapXOfs += dy + dx; |
| 892 | AutoMapYOfs += dy - dx; |
| 893 | return; |
| 894 | } |
| 895 | |
| 896 | { // move cursor |
| 897 | sgbControllerActive = false; |
| 898 | int x = MouseX; |
| 899 | int y = MouseY; |
| 900 | acc.pool(&x, &y, 2); |
| 901 | x = std::min(std::max(x, 0), SCREEN_WIDTH - 1); |
| 902 | y = std::min(std::max(y, 0), SCREEN_HEIGHT - 1); |
| 903 | SetCursorPos(x, y); |
| 904 | } |
| 905 | } |
| 906 | |
| 907 | /** |
| 908 | * @brief Moves the mouse to the first inventory slot. |
no test coverage detected