Skip to content

Commit

Permalink
perspective: change worldToMinimap location calculation back
Browse files Browse the repository at this point in the history
This is how the client calculates positions for npcs/players. Originally I had thought it fixed an issue with minimap overlays being off, but it was due to the constants we were using in worldToMinimap being off in order to account for renderMinimapLocation being wrong
  • Loading branch information
Adam- committed Jul 27, 2018
1 parent 6c7ea1f commit 042c99d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions runelite-api/src/main/java/net/runelite/api/Perspective.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,8 @@ public static Point worldToMiniMap(@Nonnull Client client, int x, int y)
public static Point worldToMiniMap(@Nonnull Client client, int x, int y, int distance)
{
LocalPoint localLocation = client.getLocalPlayer().getLocalLocation();
final int sceneX = x >>> LOCAL_COORD_BITS;
final int sceneY = y >>> LOCAL_COORD_BITS;
x = sceneX * 4 + 2 - localLocation.getX() / 32;
y = sceneY * 4 + 2 - localLocation.getY() / 32;
x = x / 32 - localLocation.getX() / 32;
y = y / 32 - localLocation.getY() / 32;

int dist = x * x + y * y;
if (dist < distance)
Expand Down

0 comments on commit 042c99d

Please sign in to comment.