From daf0d1c48b33db599162a3e0beafd9ceeee68614 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 6 Feb 2021 14:06:19 -0500 Subject: [PATCH] perspective: support rectangular tile areas --- .../java/net/runelite/api/Perspective.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/Perspective.java b/runelite-api/src/main/java/net/runelite/api/Perspective.java index eab5323d38..8c309ccf3d 100644 --- a/runelite-api/src/main/java/net/runelite/api/Perspective.java +++ b/runelite-api/src/main/java/net/runelite/api/Perspective.java @@ -375,7 +375,7 @@ public class Perspective */ public static Polygon getCanvasTilePoly(@Nonnull Client client, @Nonnull LocalPoint localLocation, int zOffset) { - return getCanvasTileAreaPoly(client, localLocation, 1, zOffset); + return getCanvasTileAreaPoly(client, localLocation, 1, 1, zOffset); } /** @@ -388,7 +388,7 @@ public class Perspective */ public static Polygon getCanvasTileAreaPoly(@Nonnull Client client, @Nonnull LocalPoint localLocation, int size) { - return getCanvasTileAreaPoly(client, localLocation, size, 0); + return getCanvasTileAreaPoly(client, localLocation, size, size, 0); } /** @@ -396,23 +396,25 @@ public class Perspective * * @param client the game client * @param localLocation the center location of the AoE - * @param size the size of the area (ie. 3x3 AoE evaluates to size 3) + * @param sizeX the size of the area in tiles on the x axis + * @param sizeY the size of the area in tiles on the y axis * @param zOffset offset from ground plane * @return a polygon representing the tiles in the area */ public static Polygon getCanvasTileAreaPoly( @Nonnull Client client, @Nonnull LocalPoint localLocation, - int size, + int sizeX, + int sizeY, int zOffset) { final int plane = client.getPlane(); - final int swX = localLocation.getX() - (size * LOCAL_TILE_SIZE / 2); - final int swY = localLocation.getY() - (size * LOCAL_TILE_SIZE / 2); + final int swX = localLocation.getX() - (sizeX * LOCAL_TILE_SIZE / 2); + final int swY = localLocation.getY() - (sizeY * LOCAL_TILE_SIZE / 2); - final int neX = localLocation.getX() + (size * LOCAL_TILE_SIZE / 2); - final int neY = localLocation.getY() + (size * LOCAL_TILE_SIZE / 2); + final int neX = localLocation.getX() + (sizeX * LOCAL_TILE_SIZE / 2); + final int neY = localLocation.getY() + (sizeY * LOCAL_TILE_SIZE / 2); final int seX = swX; final int seY = neY;