Make Gamepad cursor independant of hardware mouse

The gamepad cursor (inventory, spells etc) no longer relies on warping a
real mouse cursor. This should make things work better on platforms that
do not support this, like Wayland.
This commit is contained in:
Anders Jenbo 2021-12-25 17:54:55 +01:00
commit b0252b3339
10 changed files with 46 additions and 34 deletions

View file

@ -1481,7 +1481,7 @@ bool IsPlayerAdjacentToObject(Player &player, Object &object)
{
int x = abs(player.position.tile.x - object.position.x);
int y = abs(player.position.tile.y - object.position.y);
if (y > 1 && ObjectAtPosition(object.position + Direction::NorthEast) == &object) {
if (y > 1 && object.position.y >= 1 && ObjectAtPosition(object.position + Direction::NorthEast) == &object) {
// special case for activating a large object from the north-east side
y = abs(player.position.tile.y - object.position.y + 1);
}