Merge pull request #536 from Abextm/logical-height

Fix overlays drawing too far above player's heads
This commit is contained in:
Adam
2018-02-04 10:45:17 -05:00
committed by GitHub
5 changed files with 14 additions and 5 deletions

View File

@@ -63,4 +63,9 @@ public interface Actor extends Renderable
Point getMinimapLocation();
Point getRegionLocation();
/**
* Returns the logical height of the actor's model. This is roughly where the health bar is drawn.
*/
int getLogicalHeight();
}

View File

@@ -173,7 +173,7 @@ public class ImplingsOverlay extends Overlay
graphics.drawOval(minimapLocation.getX(), minimapLocation.getY(), 5, 5);
}
Point textLocation = actor.getCanvasTextLocation(graphics, text, actor.getModelHeight());
Point textLocation = actor.getCanvasTextLocation(graphics, text, actor.getLogicalHeight());
if (textLocation != null)
{
int x = textLocation.getX();

View File

@@ -104,7 +104,7 @@ public class PlayerIndicatorsOverlay extends Overlay
final String name = actor.getName().replace('\u00A0', ' ');
net.runelite.api.Point textLocation = actor
.getCanvasTextLocation(graphics, name, actor.getModelHeight() + 40);
.getCanvasTextLocation(graphics, name, actor.getLogicalHeight() + 40);
if (textLocation != null)
{

View File

@@ -250,7 +250,7 @@ public class OverlayUtil
renderMinimapLocation(graphics, minimapLocation, color);
}
Point textLocation = actor.getCanvasTextLocation(graphics, text, actor.getModelHeight() + 40);
Point textLocation = actor.getCanvasTextLocation(graphics, text, actor.getLogicalHeight() + 40);
if (textLocation != null)
{
renderTextLocation(graphics, textLocation, text, color);
@@ -271,7 +271,7 @@ public class OverlayUtil
renderMinimapLocation(graphics, minimapLocation, color);
}
Point imageLocation = actor.getCanvasImageLocation(graphics, image, actor.getModelHeight());
Point imageLocation = actor.getCanvasImageLocation(graphics, image, actor.getLogicalHeight());
if (imageLocation != null)
{
renderImageLocation(graphics, imageLocation, image);
@@ -292,7 +292,7 @@ public class OverlayUtil
renderMinimapLocation(graphics, minimapLocation, color);
}
Point imageLocation = actor.getCanvasSpriteLocation(graphics, sprite, actor.getModelHeight());
Point imageLocation = actor.getCanvasSpriteLocation(graphics, sprite, actor.getLogicalHeight());
if (imageLocation != null)
{
renderSpriteLocation(graphics, imageLocation, sprite);

View File

@@ -58,4 +58,8 @@ public interface RSActor extends RSRenderable, Actor
@Import("orientation")
@Override
int getOrientation();
@Import("logicalHeight")
@Override
int getLogicalHeight();
}