diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/CameraOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/CameraOverlay.java index f8ee0e9b11f..456447a7a87 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/CameraOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/CameraOverlay.java @@ -31,7 +31,6 @@ import net.runelite.client.ui.overlay.OverlayPanel; import net.runelite.client.ui.overlay.OverlayPosition; import net.runelite.client.ui.overlay.components.LineComponent; -import net.runelite.client.ui.overlay.components.TitleComponent; public class CameraOverlay extends OverlayPanel { @@ -54,23 +53,15 @@ public Dimension render(Graphics2D graphics) return null; } - panelComponent.getChildren().add(TitleComponent.builder() - .text("Camera") - .build()); - - panelComponent.getChildren().add(LineComponent.builder() - .left("X") - .right("" + client.getCameraX()) - .build()); + panelComponent.setPreferredSize(new Dimension(175, 0)); - panelComponent.getChildren().add(LineComponent.builder() - .left("Y") - .right("" + client.getCameraY()) - .build()); + int camX = client.getCameraX(); + int camY = client.getCameraZ(); + int camZ = client.getCameraY(); panelComponent.getChildren().add(LineComponent.builder() - .left("Z") - .right("" + client.getCameraZ()) + .left("Camera") + .right(camX + ", " + camY + ", " + camZ) .build()); panelComponent.getChildren().add(LineComponent.builder() diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsOverlay.java index 75b3dafd03f..4da3834d409 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsOverlay.java @@ -303,14 +303,12 @@ private void renderTileTooltip(Graphics2D graphics, Tile tile) Polygon poly = Perspective.getCanvasTilePoly(client, tileLocalLocation); if (poly != null && poly.contains(client.getMouseCanvasPosition().getX(), client.getMouseCanvasPosition().getY())) { - WorldPoint worldLocation = tile.getWorldLocation(); - Point sceneLocation = tile.getSceneLocation(); + WorldPoint worldLocation = WorldPoint.fromLocalInstance(client, tileLocalLocation); + byte flags = client.getTileSettings()[tile.getRenderLevel()][tile.getSceneLocation().getX()][tile.getSceneLocation().getY()]; String tooltip = String.format("World location: %d, %d, %d
" + - "Scene location: %d, %d
" + - "Region ID: %d location: %d, %d", + "Flags: %d", worldLocation.getX(), worldLocation.getY(), worldLocation.getPlane(), - sceneLocation.getX(), sceneLocation.getY(), - (client.isInInstancedRegion() ? WorldPoint.fromLocalInstance(client, tileLocalLocation).getRegionID() : worldLocation.getRegionID()), worldLocation.getRegionX(), worldLocation.getRegionY()); + flags); toolTipManager.add(new Tooltip(tooltip)); OverlayUtil.renderPolygon(graphics, poly, GREEN); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/LocationOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/LocationOverlay.java index 372afebc827..6fd3588bdb1 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/LocationOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/LocationOverlay.java @@ -30,6 +30,7 @@ import javax.inject.Inject; import net.runelite.api.Client; import static net.runelite.api.Constants.CHUNK_SIZE; +import static net.runelite.api.Constants.SCENE_SIZE; import net.runelite.api.coords.LocalPoint; import net.runelite.api.coords.WorldPoint; import net.runelite.client.ui.overlay.OverlayPanel; @@ -57,61 +58,80 @@ public Dimension render(Graphics2D graphics) return null; } - WorldPoint localWorld = client.getLocalPlayer().getWorldLocation(); + WorldPoint worldPoint = client.getLocalPlayer().getWorldLocation(); LocalPoint localPoint = client.getLocalPlayer().getLocalLocation(); - int regionID = localWorld.getRegionID(); - if (client.isInInstancedRegion()) { - regionID = WorldPoint.fromLocalInstance(client, localPoint).getRegionID(); + worldPoint = WorldPoint.fromLocalInstance(client, localPoint); panelComponent.getChildren().add(LineComponent.builder() .left("Instance") .build()); - - int[][][] instanceTemplateChunks = client.getInstanceTemplateChunks(); - int z = client.getPlane(); - int chunkData = instanceTemplateChunks[z][localPoint.getSceneX() / CHUNK_SIZE][localPoint.getSceneY() / CHUNK_SIZE]; - - int rotation = chunkData >> 1 & 0x3; - int chunkY = (chunkData >> 3 & 0x7FF) * CHUNK_SIZE; - int chunkX = (chunkData >> 14 & 0x3FF) * CHUNK_SIZE; - - panelComponent.getChildren().add(LineComponent.builder() - .left("Chunk " + localPoint.getSceneX() / CHUNK_SIZE + "," + localPoint.getSceneY() / CHUNK_SIZE) - .right(rotation + " " + chunkX + " " + chunkY) - .build()); } panelComponent.getChildren().add(LineComponent.builder() - .left("Base") - .right(client.getBaseX() + ", " + client.getBaseY()) - .build()); - - panelComponent.getChildren().add(LineComponent.builder() - .left("Local") - .right(localPoint.getX() + ", " + localPoint.getY()) - .build()); + .left("Local") + .right(localPoint.getX() + ", " + localPoint.getY()) + .build()); panelComponent.getChildren().add(LineComponent.builder() - .left("Scene") - .right(localPoint.getSceneX() + ", " + localPoint.getSceneY()) - .build()); + .left("World") + .right(worldPoint.getX() + ", " + worldPoint.getY() + ", " + client.getPlane()) + .build()); panelComponent.getChildren().add(LineComponent.builder() - .left("Tile") - .right(localWorld.getX() + ", " + localWorld.getY() + ", " + client.getPlane()) + .left("Scene") + .right(localPoint.getSceneX() + ", " + localPoint.getSceneY()) .build()); + if (client.isInInstancedRegion()) + { + int[][][] instanceTemplateChunks = client.getInstanceTemplateChunks(); + int z = client.getPlane(); + for (int cy = 0; cy < SCENE_SIZE / CHUNK_SIZE; ++cy) + { + for (int cx = 0; cx < SCENE_SIZE / CHUNK_SIZE; ++cx) + { + int chunkData = instanceTemplateChunks[z][cx][cy]; + + if (chunkData == -1) + { + continue; + } + + int rotation = chunkData >> 1 & 0x3; // NOPMD + int chunkY = (chunkData >> 3 & 0x7FF); + int chunkX = (chunkData >> 14 & 0x3FF); + int chunkPlane = chunkData >> 24 & 0x3; + + boolean myChunk = cx == localPoint.getSceneX() / CHUNK_SIZE && cy == localPoint.getSceneY() / CHUNK_SIZE; + panelComponent.getChildren().add(LineComponent.builder() + .left("Chunk") + .right(chunkX + ", " + chunkY + ", " + chunkPlane) + .rightColor(myChunk ? Color.GREEN : Color.WHITE) + .build()); + } + } + } + else + { + panelComponent.getChildren().add(LineComponent.builder() + .left("Base") + .right(client.getBaseX() + ", " + client.getBaseY()) + .build()); + } + for (int i = 0; i < client.getMapRegions().length; i++) { int region = client.getMapRegions()[i]; + int mx = region >> 8; + int my = region & 0xff; panelComponent.getChildren().add(LineComponent.builder() .left((i == 0) ? "Map regions" : " ") - .right(String.valueOf(region)) - .rightColor((region == regionID) ? Color.GREEN : Color.WHITE) + .right(mx + ", " + my) + .rightColor((region == worldPoint.getRegionID()) ? Color.GREEN : Color.WHITE) .build()); }