Skip to content

Commit

Permalink
Merge pull request #523 from FFXIV-CombatReborn/mergeWIP
Browse files Browse the repository at this point in the history
restored collision debug
  • Loading branch information
CarnifexOptimus authored Dec 28, 2024
2 parents 1ac4a12 + d2f17fb commit 2aadc30
Show file tree
Hide file tree
Showing 8 changed files with 699 additions and 889 deletions.
3 changes: 3 additions & 0 deletions BossMod/Config/ColorConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,5 +139,8 @@ public sealed class ColorConfig : ConfigNode
new(0x80ffffff), new(0x8000ff00), new(0xffffff00), new(0x800000ff), new(0xff404040),
new(0xffff0000), new(0xff000000), new(0x80008080), new(0x8080ff80), new(0xffc0c0c0)];

[PropertyDisplay("Collision debug colors")]
public Color[] CollisionColors = [new(0xff00ff00), new(0xff00ffff), new(0xff0000ff)];

public static ColorConfig DefaultConfig => new();
}
1,444 changes: 630 additions & 814 deletions BossMod/Debug/DebugCollision.cs

Large diffs are not rendered by default.

58 changes: 0 additions & 58 deletions BossMod/Debug/DebugVfx.cs

This file was deleted.

18 changes: 6 additions & 12 deletions BossMod/Debug/MainDebugWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,15 @@ namespace BossMod;
private readonly DebugAddon _debugAddon = new();
private readonly DebugTiming _debugTiming = new();
private readonly DebugTeleport _debugTeleport = new();
// private readonly DebugCollision _debugCollision = new();
private readonly DebugCollision _debugCollision = new();
private readonly DebugQuests _debugQuests = new();
//private readonly DebugVfx _debugVfx = new();

protected override void Dispose(bool disposing)
{
_debugAction.Dispose();
_debugInput.Dispose();
_debugAddon.Dispose();
// _debugCollision.Dispose();
// _debugVfx.Dispose();
_debugCollision.Dispose();
base.Dispose(disposing);
}

Expand Down Expand Up @@ -160,14 +158,10 @@ public override unsafe void Draw()
{
DrawWindowSystem();
}
// if (ImGui.CollapsingHeader("Collision"))
// {
// _debugCollision.Draw();
// }
//if (ImGui.CollapsingHeader("VFX"))
//{
// _debugVfx.Draw();
//}
if (ImGui.CollapsingHeader("Collision"))
{
_debugCollision.Draw();
}
if (ImGui.CollapsingHeader("Limit break"))
{
DrawLimitBreak();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ class DarkNova(BossModule module) : Components.SpreadFromCastTargets(module, Act
[ModuleInfo(BossModuleInfo.Maturity.Verified, Contributors = "The Combat Reborn Team (Malediktus, LTS)", GroupType = BossModuleInfo.GroupType.CFC, GroupID = 1015, NameID = 13653, SortOrder = 8)]
public class A14ShadowLord(WorldState ws, Actor primary) : BossModule(ws, primary, ArenaCenter, DefaultBounds)
{
private const float RadiusSmall = 7.9f;
private const float HalfWidth = 1.9f;
private const int RadiusSmall = 8;
private const int HalfWidth = 2;
private const int Edges = 64;
public static readonly WPos ArenaCenter = new(150, 800);
public static readonly ArenaBoundsCircle DefaultBounds = new(30);
public static readonly Circle[] Circles = [new(new(166, 800), RadiusSmall), new(new(134, 800), RadiusSmall),
new(new(150, 816), RadiusSmall), new(new(150, 784), RadiusSmall)];
public static readonly Polygon[] Circles = [new(new(166.249f, 800), RadiusSmall, Edges), new(new(133.783f, 800), RadiusSmall, Edges),
new(new(150, 816.227f), RadiusSmall, Edges), new(new(150, 783.812f), RadiusSmall, Edges)]; // the circle coordinates are not perfectly placed for some reason, got these from analyzing the collision data
private static readonly RectangleSE[] rects = [new(Circles[1].Center, Circles[2].Center, HalfWidth), new(Circles[1].Center, Circles[3].Center, HalfWidth),
new(Circles[3].Center, Circles[0].Center, HalfWidth), new(Circles[0].Center, Circles[2].Center, HalfWidth)];
public static readonly Shape[] Combined = [.. Circles, .. rects];
Expand Down
2 changes: 1 addition & 1 deletion BossMod/Modules/Endwalker/Alliance/A23Halone/Octagons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace BossMod.Endwalker.Alliance.A23Halone;
class Octagons(BossModule module) : Components.GenericAOEs(module)
{
private const float InnerRadius = 11.2f; // radii adjusted for hitbox radius
private const float OuterRadius = 13.5f;
private const float OuterRadius = 13.3f;
private const int Vertices = 8;
private static readonly WPos[] spears = [new(-686, 592), new(-700, 616.2f), new(-714, 592)];
private static readonly Angle[] angle = [-37.5f.Degrees(), 22.5f.Degrees(), 37.5f.Degrees()];
Expand Down
3 changes: 3 additions & 0 deletions BossMod/Util/Color.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,7 @@ public static class Colors
public static uint Caster => _config.ArenaPlayerGenericCaster.ABGR;
public static uint PhysRanged => _config.ArenaPlayerGenericPhysRanged.ABGR;
public static uint Focus => _config.ArenaPlayerGenericFocus.ABGR;
public static uint CollisionColor1 => _config.CollisionColors[0].ABGR;
public static uint CollisionColor2 => _config.CollisionColors[1].ABGR;
public static uint CollisionColor3 => _config.CollisionColors[2].ABGR;
}
51 changes: 51 additions & 0 deletions BossMod/Util/UITree.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,34 @@ namespace BossMod;

public class UITree
{
private uint _selectedId;

public record struct NodeProperties(string Text, bool Leaf = false, uint Color = 0)
{
public uint Colors = Color == 0 ? BossMod.Colors.TextColor1 : Color;
}

public struct NodeRaii(bool selected, bool opened, bool hovered, bool realOpened) : IDisposable
{
public bool Selected = selected;
public bool Opened = opened;
public bool Hovered = hovered;
private bool _disposed;
private readonly bool _realOpened = realOpened;

public readonly bool SelectedOrHovered => Selected || Hovered;

public void Dispose()
{
if (_disposed)
return;
if (_realOpened)
ImGui.TreePop();
ImGui.PopID();
_disposed = true;
}
}

private uint _selectedID;

// contains 0 elements (if node is closed) or single null (if node is opened)
Expand Down Expand Up @@ -84,4 +107,32 @@ private bool RawNode(string text, bool leaf, uint color, Action? contextMenu, Ac
}
return open;
}

public NodeRaii Node2(string text, bool leaf = false, uint color = 0)
{
var id = ImGui.GetID(text);
var flags = ImGuiTreeNodeFlags.None;
if (id == _selectedId)
flags |= ImGuiTreeNodeFlags.Selected;
if (leaf)
flags |= ImGuiTreeNodeFlags.Leaf;

ImGui.PushID((int)id);
ImGui.PushStyleColor(ImGuiCol.Text, color == 0 ? Colors.TextColor1 : color);
bool open = ImGui.TreeNodeEx(text, flags);
ImGui.PopStyleColor();
if (ImGui.IsItemClicked(ImGuiMouseButton.Left))
_selectedId = id;
if (ImGui.IsItemClicked(ImGuiMouseButton.Right))
ImGui.SetClipboardText(text);
return new(id == _selectedId, open && !leaf, ImGui.IsItemHovered(), open);
}

// returned node is auto disposed
public NodeRaii LeafNode2(string text, uint color = 0)
{
var n = Node2(text, true, color == 0 ? Colors.TextColor1 : color);
n.Dispose();
return n;
}
}

0 comments on commit 2aadc30

Please sign in to comment.