v1.0.8.20: Fixed hotbar cooldowns showing through dialogue box when Show HUD during dialogue enabled
Made-with: Cursor
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using Dalamud.Game.ClientState.Conditions;
|
||||
using HSUI.Config;
|
||||
using HSUI.Interface.GeneralElements;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI;
|
||||
@@ -335,6 +336,56 @@ namespace HSUI.Helpers
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true when the given area overlaps a game addon (e.g. dialogue box) and should not be drawn on top of it.
|
||||
/// Used by hotbars when "Show HUD during dialogue" is on, to avoid cooldown overlays bleeding through dialogue.
|
||||
/// Uses full clip rects when Window Clipping is enabled, otherwise a minimal dialogue-addon check.
|
||||
/// </summary>
|
||||
public bool SlotOverlapsGameAddon(Vector2 pos, Vector2 size)
|
||||
{
|
||||
// When Window Clipping is enabled, use full clip rects (all game addons)
|
||||
ClipRect? clipRect = GetClipRectForArea(pos, size);
|
||||
if (clipRect.HasValue) { return true; }
|
||||
|
||||
// When "Show HUD during dialogue" is on and we're in dialogue, check dialogue addons
|
||||
// (works even when full Window Clipping is disabled)
|
||||
var hudOptions = ConfigurationManager.Instance?.GetConfigObject<HUDOptionsConfig>();
|
||||
if (hudOptions?.ShowHudDuringDialogue != true) { return false; }
|
||||
if (!Plugin.Condition[ConditionFlag.OccupiedInQuestEvent] && !Plugin.Condition[ConditionFlag.OccupiedInEvent])
|
||||
{ return false; }
|
||||
|
||||
return GetClipRectForDialogueAddon(pos, size).HasValue;
|
||||
}
|
||||
|
||||
private static readonly string[] _dialogueAddonNames = { "Talk", "SelectString", "SelectIconString", "Journal" };
|
||||
|
||||
private unsafe ClipRect? GetClipRectForDialogueAddon(Vector2 pos, Vector2 size)
|
||||
{
|
||||
ClipRect area = new ClipRect(pos, pos + size);
|
||||
|
||||
foreach (string addonName in _dialogueAddonNames)
|
||||
{
|
||||
try
|
||||
{
|
||||
var addon = (AtkUnitBase*)Plugin.GameGui.GetAddonByName(addonName, 1).Address;
|
||||
if (addon == null || addon->RootNode == null || !addon->IsVisible) { continue; }
|
||||
|
||||
float margin = 5 * addon->Scale;
|
||||
Vector2 addonPos = new Vector2(addon->X + addon->RootNode->X * addon->Scale + margin,
|
||||
addon->Y + addon->RootNode->Y * addon->Scale + margin);
|
||||
Vector2 addonSize = new Vector2(
|
||||
addon->RootNode->Width * addon->Scale - margin * 2,
|
||||
addon->RootNode->Height * addon->Scale - margin * 2);
|
||||
ClipRect addonRect = new ClipRect(addonPos, addonPos + addonSize);
|
||||
|
||||
if (addonRect.IntersectsWith(area)) { return addonRect; }
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ClipRect[] GetInvertedClipRects(ClipRect clipRect)
|
||||
{
|
||||
float maxX = ImGui.GetMainViewport().Size.X;
|
||||
|
||||
Reference in New Issue
Block a user