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 getMinimapLocation();
Point getRegionLocation(); 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); 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) if (textLocation != null)
{ {
int x = textLocation.getX(); int x = textLocation.getX();

View File

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

View File

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

View File

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