From 332dd858a85dff9372fc3d88877fc8b647520bac Mon Sep 17 00:00:00 2001 From: bradjrenshaw Date: Tue, 10 May 2022 14:21:17 -0400 Subject: [PATCH] Fixed bug with tile cursor not passing exact integer tile values causing terrain features like crops to not be read out. --- stardew-access/Features/MouseHandler.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/stardew-access/Features/MouseHandler.cs b/stardew-access/Features/MouseHandler.cs index b93c96b..ecdcf7d 100644 --- a/stardew-access/Features/MouseHandler.cs +++ b/stardew-access/Features/MouseHandler.cs @@ -63,9 +63,9 @@ namespace stardew_access.Features private void cursorMoveInput(Vector2 delta, Boolean precise = false) { - if (!tryMoveTileView(delta)) return; + if (!tryMoveTileView(delta)) return; Vector2 position = this.getTileCursorPosition(); - Vector2 tile = position / Game1.tileSize; + Vector2 tile = new Vector2((float)Math.Floor(position.X / Game1.tileSize), (float)Math.Floor(position.Y / Game1.tileSize)); String ?name = TileInfo.getNameAtTile(tile); if (name == null) { @@ -79,7 +79,7 @@ namespace stardew_access.Features } if (precise) { - MainClass.ScreenReader.Say($"{position.X}, {position.Y}", true); + MainClass.ScreenReader.Say($"{name}, {position.X}, {position.Y}", true); } else { @@ -111,6 +111,7 @@ namespace stardew_access.Features public void update() { + //Reset the viewing cursor to the player when they turn or move. This will not reset the locked offset relative cursor position. if (this.prevFacing != this.PlayerFacingVector || this.prevPlayerPosition != this.PlayerPosition) { this.ViewingOffset = Vector2.Zero; @@ -119,6 +120,7 @@ namespace stardew_access.Features this.prevPlayerPosition = this.PlayerPosition; if (MainClass.Config.SnapMouse) this.SnapMouseToPlayer(); + if (MainClass.Config.TileCursorUpKey.JustPressed()) { this.cursorMoveInput(new Vector2(0, -Game1.tileSize)); @@ -137,7 +139,6 @@ namespace stardew_access.Features } } - private static bool allowMouseSnap(Vector2 point) { if (!Utility.isOnScreen(point, 0)) return false;