From 274148361e5a7bc4cc43252d91b0d68adfd8f579 Mon Sep 17 00:00:00 2001 From: goat <16760685+goaaats@users.noreply.github.com> Date: Wed, 29 Apr 2020 15:34:41 +0200 Subject: [PATCH] feat: add actor debug overlay for Dalamud Data Window --- Dalamud/Interface/DalamudDataWindow.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Dalamud/Interface/DalamudDataWindow.cs b/Dalamud/Interface/DalamudDataWindow.cs index 5232ba3e8..1fac5f67e 100644 --- a/Dalamud/Interface/DalamudDataWindow.cs +++ b/Dalamud/Interface/DalamudDataWindow.cs @@ -17,6 +17,8 @@ namespace Dalamud.Interface private int currentKind; + private bool drawActors = false; + public DalamudDataWindow(Dalamud dalamud) { this.dalamud = dalamud; @@ -84,6 +86,8 @@ namespace Dalamud.Interface stateString += $"LastLinkedItem: {this.dalamud.Framework.Gui.Chat.LastLinkedItemId.ToString()}\n"; stateString += $"TerritoryType: {this.dalamud.ClientState.TerritoryType}\n\n"; + ImGui.Checkbox("Draw actors on screen", ref this.drawActors); + for (var i = 0; i < this.dalamud.ClientState.Actors.Length; i++) { var actor = this.dalamud.ClientState.Actors[i]; @@ -103,6 +107,22 @@ namespace Dalamud.Interface if (actor is PlayerCharacter pc) stateString += $" HomeWorld: {pc.HomeWorld.GameData.Name} CurrentWorld: {pc.CurrentWorld.GameData.Name} FC: {pc.CompanyTag}\n"; + + if (this.drawActors) { + var screenCoords = this.dalamud.Framework.Gui.WorldToScreen(actor.Position); + + ImGui.PushID("ActorWindow" + i); + ImGui.SetNextWindowPos(new Vector2(screenCoords.X, screenCoords.Y)); + ImGui.SetNextWindowBgAlpha(0.35f); + if (ImGui.Begin("Actor" + i, + ImGuiWindowFlags.NoDecoration | ImGuiWindowFlags.AlwaysAutoResize | + ImGuiWindowFlags.NoSavedSettings | ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoMouseInputs | + ImGuiWindowFlags.NoFocusOnAppearing | ImGuiWindowFlags.NoNav)) { + ImGui.Text($"{actor.Address.ToInt64():X}:{actor.ActorId:X}[{i}] - {actor.ObjectKind} - {actor.Name}"); + ImGui.End(); + } + ImGui.PopID(); + } } }