Skip to content

Commit

Permalink
npc indicators: add true tile highlight
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam- committed Jun 17, 2022
1 parent 9a584d2 commit 592e193
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class HighlightedNpc
Color fillColor = new Color(0, 0, 0, 50);
boolean hull;
boolean tile;
boolean trueTile;
boolean swTile;
boolean outline;
boolean name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,20 @@ private void renderNpcOverlay(Graphics2D graphics, HighlightedNpc highlightedNpc
renderPoly(graphics, borderColor, borderWidth, fillColor, tilePoly);
}

if (highlightedNpc.isTrueTile())
{
LocalPoint lp = LocalPoint.fromWorld(client, actor.getWorldLocation()); // centered on sw tile
if (lp != null)
{
final int size = npcComposition.getSize();
final LocalPoint centerLp = new LocalPoint(
lp.getX() + Perspective.LOCAL_TILE_SIZE * (size - 1) / 2,
lp.getY() + Perspective.LOCAL_TILE_SIZE * (size - 1) / 2);
Polygon tilePoly = Perspective.getCanvasTileAreaPoly(client, centerLp, size);
renderPoly(graphics, borderColor, borderWidth, fillColor, tilePoly);
}
}

if (highlightedNpc.isSwTile())
{
LocalPoint lp = LocalPoint.fromWorld(client, actor.getWorldLocation());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,18 @@ default boolean highlightTile()

@ConfigItem(
position = 2,
keyName = "highlightTrueTile",
name = "Highlight true tile",
description = "Configures whether or not NPC should be highlighted by true tile",
section = renderStyleSection
)
default boolean highlightTrueTile()
{
return false;
}

@ConfigItem(
position = 3,
keyName = "highlightSouthWestTile",
name = "Highlight south west tile",
description = "Configures whether or not NPC should be highlighted by south western tile",
Expand All @@ -79,7 +91,7 @@ default boolean highlightSouthWestTile()
}

@ConfigItem(
position = 3,
position = 4,
keyName = "highlightOutline",
name = "Highlight outline",
description = "Configures whether or not the model of the NPC should be highlighted by outline",
Expand All @@ -92,7 +104,7 @@ default boolean highlightOutline()

@Alpha
@ConfigItem(
position = 4,
position = 10,
keyName = "npcColor",
name = "Highlight Color",
description = "Color of the NPC highlight border, menu, and text",
Expand All @@ -105,7 +117,7 @@ default Color highlightColor()

@Alpha
@ConfigItem(
position = 5,
position = 11,
keyName = "fillColor",
name = "Fill Color",
description = "Color of the NPC highlight fill",
Expand All @@ -117,7 +129,7 @@ default Color fillColor()
}

@ConfigItem(
position = 6,
position = 12,
keyName = "borderWidth",
name = "Border Width",
description = "Width of the highlighted NPC border",
Expand All @@ -129,7 +141,7 @@ default double borderWidth()
}

@ConfigItem(
position = 7,
position = 13,
keyName = "outlineFeather",
name = "Outline feather",
description = "Specify between 0-4 how much of the model outline should be faded",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,7 @@ private HighlightedNpc highlightedNpc(NPC npc)
.fillColor(config.fillColor())
.hull(config.highlightHull())
.tile(config.highlightTile())
.trueTile(config.highlightTrueTile())
.swTile(config.highlightSouthWestTile())
.outline(config.highlightOutline())
.name(config.drawNames())
Expand Down

0 comments on commit 592e193

Please sign in to comment.