Properly name Perspective methods, remove unused

- Properly rename world->local Perspective methods and force them to
accept LocalPoint to prevent confusion
- Remove unused params from Perspective methods

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
Tomas Slusny
2018-07-30 17:38:40 +02:00
parent 40637f8f92
commit 73dbea874a
24 changed files with 95 additions and 117 deletions

View File

@@ -130,7 +130,7 @@ public class BlastMineRockOverlay extends Overlay
return;
}
Point loc = Perspective.getCanvasImageLocation(client, graphics, rock.getGameObject().getLocalLocation(), icon, 150);
Point loc = Perspective.getCanvasImageLocation(client, rock.getGameObject().getLocalLocation(), icon, 150);
if (loc != null)
{
@@ -145,7 +145,7 @@ public class BlastMineRockOverlay extends Overlay
return;
}
Point loc = Perspective.worldToCanvas(client, rock.getGameObject().getX(), rock.getGameObject().getY(), client.getPlane(), 150);
Point loc = Perspective.localToCanvas(client, rock.getGameObject().getLocalLocation(), rock.getGameObject().getPlane(), 150);
if (loc != null)
{

View File

@@ -104,7 +104,7 @@ public class CannonSpotOverlay extends Overlay
}
//Render icon
Point imageLoc = Perspective.getCanvasImageLocation(client, graphics, point, image, 0);
Point imageLoc = Perspective.getCanvasImageLocation(client, point, image, 0);
if (imageLoc != null)
{

View File

@@ -90,7 +90,7 @@ public class DemonicGorillaOverlay extends Overlay
LocalPoint lp = gorilla.getNpc().getLocalLocation();
if (lp != null)
{
Point point = Perspective.worldToCanvas(client, lp.getX(), lp.getY(), client.getPlane(),
Point point = Perspective.localToCanvas(client, lp, client.getPlane(),
gorilla.getNpc().getLogicalHeight() + 16);
if (point != null)
{

View File

@@ -135,9 +135,8 @@ public class SceneOverlay extends Overlay
boolean first = true;
for (int y = lp1.getY(); y <= lp2.getY(); y += LOCAL_TILE_SIZE)
{
Point p = Perspective.worldToCanvas(client,
lp1.getX() - LOCAL_TILE_SIZE / 2,
y - LOCAL_TILE_SIZE / 2,
Point p = Perspective.localToCanvas(client,
new LocalPoint(lp1.getX() - LOCAL_TILE_SIZE / 2, y - LOCAL_TILE_SIZE / 2),
client.getPlane());
if (p != null)
{
@@ -161,9 +160,8 @@ public class SceneOverlay extends Overlay
boolean first = true;
for (int x = lp1.getX(); x <= lp2.getX(); x += LOCAL_TILE_SIZE)
{
Point p = Perspective.worldToCanvas(client,
x - LOCAL_TILE_SIZE / 2,
lp1.getY() - LOCAL_TILE_SIZE / 2,
Point p = Perspective.localToCanvas(client,
new LocalPoint(x - LOCAL_TILE_SIZE / 2, lp1.getY() - LOCAL_TILE_SIZE / 2),
client.getPlane());
if (p != null)
{
@@ -202,9 +200,8 @@ public class SceneOverlay extends Overlay
boolean first = true;
for (int y = lp1.getY(); y <= lp2.getY(); y += LOCAL_TILE_SIZE)
{
Point p = Perspective.worldToCanvas(client,
lp1.getX() - LOCAL_TILE_SIZE / 2,
y - LOCAL_TILE_SIZE / 2,
Point p = Perspective.localToCanvas(client,
new LocalPoint(lp1.getX() - LOCAL_TILE_SIZE / 2, y - LOCAL_TILE_SIZE / 2),
client.getPlane());
if (p != null)
{
@@ -228,9 +225,8 @@ public class SceneOverlay extends Overlay
boolean first = true;
for (int x = lp1.getX(); x <= lp2.getX(); x += LOCAL_TILE_SIZE)
{
Point p = Perspective.worldToCanvas(client,
x - LOCAL_TILE_SIZE / 2,
lp1.getY() - LOCAL_TILE_SIZE / 2,
Point p = Perspective.localToCanvas(client,
new LocalPoint(x - LOCAL_TILE_SIZE / 2, lp1.getY() - LOCAL_TILE_SIZE / 2),
client.getPlane());
if (p != null)
{
@@ -376,7 +372,7 @@ public class SceneOverlay extends Overlay
}
LocalPoint fl = fa.getLocalLocation();
Point fs = Perspective.worldToCanvas(client, fl.getX(), fl.getY(), client.getPlane(), fa.getLogicalHeight() / 2);
Point fs = Perspective.localToCanvas(client, fl, client.getPlane(), fa.getLogicalHeight() / 2);
if (fs == null)
{
return;
@@ -385,7 +381,7 @@ public class SceneOverlay extends Overlay
int fsy = fs.getY() - INTERACTING_SHIFT;
LocalPoint tl = ta.getLocalLocation();
Point ts = Perspective.worldToCanvas(client, tl.getX(), tl.getY(), client.getPlane(), ta.getLogicalHeight() / 2);
Point ts = Perspective.localToCanvas(client, tl, client.getPlane(), ta.getLogicalHeight() / 2);
if (ts == null)
{
return;

View File

@@ -113,7 +113,7 @@ class FishingSpotOverlay extends Overlay
}
LocalPoint localPoint = npc.getLocalLocation();
Point location = Perspective.worldToCanvas(client, localPoint.getX(), localPoint.getY(), client.getPlane());
Point location = Perspective.localToCanvas(client, localPoint, client.getPlane());
if (location != null)
{
@@ -141,7 +141,7 @@ class FishingSpotOverlay extends Overlay
BufferedImage fishImage = itemManager.getImage(spot.getFishSpriteId());;
if (fishImage != null)
{
Point imageLocation = npc.getCanvasImageLocation(graphics, fishImage, npc.getLogicalHeight());
Point imageLocation = npc.getCanvasImageLocation(fishImage, npc.getLogicalHeight());
if (imageLocation != null)
{
OverlayUtil.renderImageLocation(graphics, imageLocation, fishImage);

View File

@@ -141,7 +141,7 @@ public class TrapOverlay extends Overlay
{
return;
}
net.runelite.api.Point loc = Perspective.worldToCanvas(client, localLoc.getX(), localLoc.getY(), trap.getWorldLocation().getPlane());
net.runelite.api.Point loc = Perspective.localToCanvas(client, localLoc, client.getPlane());
double timeLeft = 1 - trap.getTrapTimeRelative();
@@ -172,7 +172,7 @@ public class TrapOverlay extends Overlay
{
return;
}
net.runelite.api.Point loc = Perspective.worldToCanvas(client, localLoc.getX(), localLoc.getY(), trap.getWorldLocation().getPlane());
net.runelite.api.Point loc = Perspective.localToCanvas(client, localLoc, client.getPlane());
ProgressPieComponent pie = new ProgressPieComponent();
pie.setFill(fill);

View File

@@ -106,7 +106,7 @@ class KourendLibraryOverlay extends Overlay
{
continue;
}
Point screenBookcase = Perspective.worldToCanvas(client, localBookcase.getX(), localBookcase.getY(), caseLoc.getPlane(), 25);
Point screenBookcase = Perspective.localToCanvas(client, localBookcase, caseLoc.getPlane(), 25);
if (screenBookcase != null)
{
@@ -219,7 +219,7 @@ class KourendLibraryOverlay extends Overlay
LocalPoint local = n.getLocalLocation();
Polygon poly = getCanvasTilePoly(client, local);
OverlayUtil.renderPolygon(g, poly, Color.WHITE);
Point screen = Perspective.worldToCanvas(client, local.getX(), local.getY(), client.getPlane(), n.getLogicalHeight());
Point screen = Perspective.localToCanvas(client, local, client.getPlane(), n.getLogicalHeight());
if (screen != null)
{
g.drawImage(b.getIcon(), screen.getX() - (b.getIcon().getWidth() / 2), screen.getY() - b.getIcon().getHeight(), null);

View File

@@ -438,6 +438,6 @@ public class MotherlodePlugin extends Plugin
*/
boolean isUpstairs(LocalPoint localPoint)
{
return Perspective.getTileHeight(client, localPoint.getX(), localPoint.getY(), 0) < UPPER_FLOOR_HEIGHT;
return Perspective.getTileHeight(client, localPoint, 0) < UPPER_FLOOR_HEIGHT;
}
}

View File

@@ -111,7 +111,7 @@ class MotherlodeRocksOverlay extends Overlay
private void renderVein(Graphics2D graphics, WallObject vein)
{
Point canvasLoc = Perspective.getCanvasImageLocation(client, graphics, vein.getLocalLocation(), miningIcon, 150);
Point canvasLoc = Perspective.getCanvasImageLocation(client, vein.getLocalLocation(), miningIcon, 150);
if (canvasLoc != null)
{

View File

@@ -384,7 +384,7 @@ public class AlchemyRoom extends MTARoom
}
BufferedImage image = itemManager.getImage(alchemyItem.getId());
Point canvasLoc = Perspective.getCanvasImageLocation(client, graphics, object.getLocalLocation(), image, IMAGE_Z_OFFSET);
Point canvasLoc = Perspective.getCanvasImageLocation(client, object.getLocalLocation(), image, IMAGE_Z_OFFSET);
if (canvasLoc != null)
{

View File

@@ -131,7 +131,7 @@ public class NpcSceneOverlay extends Overlay
final int textHeight = graphics.getFontMetrics().getAscent();
final Point canvasPoint = Perspective
.worldToCanvas(client, centerLp.getX(), centerLp.getY(), respawnLocation.getPlane());
.localToCanvas(client, centerLp, respawnLocation.getPlane());
if (canvasPoint != null)
{

View File

@@ -77,7 +77,7 @@ class PrayerBarOverlay extends Overlay
final int height = client.getLocalPlayer().getLogicalHeight() + 10;
final LocalPoint localLocation = client.getLocalPlayer().getLocalLocation();
final Point canvasPoint = Perspective.worldToCanvas(client, localLocation.getX(), localLocation.getY(), client.getPlane(), height);
final Point canvasPoint = Perspective.localToCanvas(client, localLocation, client.getPlane(), height);
// Draw bar
final int barX = canvasPoint.getX() + client.getViewportXOffset() - 15;

View File

@@ -101,7 +101,7 @@ public class TitheFarmPlantOverlay extends Overlay
continue;
}
final Point canvasLocation = Perspective.worldToCanvas(client, localLocation.getX(), localLocation.getY(), client.getPlane());
final Point canvasLocation = Perspective.localToCanvas(client, localLocation, client.getPlane());
if (viewport != null && canvasLocation != null)
{

View File

@@ -85,7 +85,7 @@ public class OverlayUtil
public static void renderImageLocation(Client client, Graphics2D graphics, LocalPoint localPoint, BufferedImage image, int zOffset)
{
net.runelite.api.Point imageLocation = Perspective.getCanvasImageLocation(client, graphics, localPoint, image, zOffset);
net.runelite.api.Point imageLocation = Perspective.getCanvasImageLocation(client, localPoint, image, zOffset);
if (imageLocation != null)
{
renderImageLocation(graphics, imageLocation, image);
@@ -123,7 +123,7 @@ public class OverlayUtil
renderPolygon(graphics, poly, color);
}
Point imageLocation = actor.getCanvasImageLocation(graphics, image, zOffset);
Point imageLocation = actor.getCanvasImageLocation(image, zOffset);
if (imageLocation != null)
{
renderImageLocation(graphics, imageLocation, image);