v1.0.0.13: User-placed map notes with Title/Description; custom icon; notes on minimap
Made-with: Cursor
This commit is contained in:
@@ -376,6 +376,7 @@ public unsafe partial class MapRenderer : IDisposable
|
||||
DrawFieldMarkers();
|
||||
DrawPlayer();
|
||||
DrawStaticTextMarkers();
|
||||
DrawMapNotes();
|
||||
DrawFlag();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
||||
using Mappy.Classes;
|
||||
using Mappy.Data;
|
||||
|
||||
namespace Mappy.MapRenderer;
|
||||
|
||||
public partial class MapRenderer
|
||||
{
|
||||
private unsafe void DrawMapNotes()
|
||||
{
|
||||
var agent = AgentMap.Instance();
|
||||
var territoryId = agent->SelectedTerritoryId;
|
||||
var mapId = agent->SelectedMapId;
|
||||
|
||||
foreach (var note in System.MapNoteConfig.Notes.Where(n => n.Territory == territoryId && n.Map == mapId).ToList()) {
|
||||
var pos = new Vector2(note.X, note.Y) * Scale * DrawHelpers.GetMapScaleFactor() + DrawHelpers.GetCombinedOffsetVector() * Scale;
|
||||
|
||||
DrawHelpers.DrawMapMarker(new MarkerInfo
|
||||
{
|
||||
Position = pos,
|
||||
Offset = DrawPosition,
|
||||
Scale = Scale,
|
||||
IconId = DrawHelpers.MapNoteIconId,
|
||||
PrimaryText = () => note.Title ?? "",
|
||||
SecondaryText = () => string.IsNullOrWhiteSpace(note.Description)
|
||||
? note.GetTerritoryType().PlaceNameZone.Value.Name.ExtractText()
|
||||
: $"{note.Description}\n{note.GetTerritoryType().PlaceNameZone.Value.Name.ExtractText()}",
|
||||
OnLeftClicked = () => note.Focus(),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,6 +16,7 @@ using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
||||
using FFXIVClientStructs.Interop;
|
||||
using Lumina.Excel.Sheets;
|
||||
using Mappy.Classes;
|
||||
using Mappy.Data;
|
||||
using Mappy.Extensions;
|
||||
using KamiLib.Extensions;
|
||||
using FieldMarkerSheet = Lumina.Excel.Sheets.FieldMarker;
|
||||
@@ -59,6 +60,8 @@ public partial class MapRenderer
|
||||
DrawMinimapGameObjects(contentTopLeft, TexToContent, size, scaleFactor, offsetX, offsetY);
|
||||
// User flag
|
||||
DrawMinimapFlag(contentTopLeft, TexToContent, scaleFactor, offsetX, offsetY);
|
||||
// User map notes
|
||||
DrawMinimapMapNotes(contentTopLeft, TexToContent, size, scaleFactor, offsetX, offsetY);
|
||||
// Temporary (quest objectives, etc.)
|
||||
DrawMinimapTempMarkers(contentTopLeft, TexToContent, size, scaleFactor, offsetX, offsetY, scale);
|
||||
// Field markers (waymarks)
|
||||
@@ -726,6 +729,30 @@ public partial class MapRenderer
|
||||
}
|
||||
}
|
||||
|
||||
private unsafe void DrawMinimapMapNotes(Vector2 contentTopLeft, Func<float, float, Vector2> texToContent, Vector2 size, float scaleFactor, float offsetX, float offsetY)
|
||||
{
|
||||
var agent = AgentMap.Instance();
|
||||
var territoryId = agent->CurrentTerritoryId;
|
||||
var mapId = agent->CurrentMapId;
|
||||
|
||||
foreach (var note in System.MapNoteConfig.Notes.Where(n => n.Territory == territoryId && n.Map == mapId)) {
|
||||
if (System.IconConfig.IconSettingMap.TryGetValue(DrawHelpers.MapNoteIconId, out var setting) && setting.Hide) continue;
|
||||
|
||||
var tx = 1024.0f + (note.X - offsetX) * scaleFactor;
|
||||
var ty = 1024.0f + (note.Y - offsetY) * scaleFactor;
|
||||
var contentPos = texToContent(tx, ty);
|
||||
if (!IsInMinimapBounds(contentPos, size, MinimapBoundsMargin)) continue;
|
||||
|
||||
var centerScreen = contentPos + contentTopLeft;
|
||||
var iconSize = new Vector2(22f, 28f) * (MinimapIconScaleFromConfig * 0.75f);
|
||||
var col = setting?.Color ?? Vector4.One;
|
||||
DrawHelpers.DrawMapNoteIconCentered(centerScreen, iconSize, col);
|
||||
|
||||
if (!string.IsNullOrEmpty(note.GetTooltipText()) && ImGui.IsMouseHoveringRect(centerScreen - iconSize / 2f, centerScreen + iconSize / 2f))
|
||||
ImGui.SetTooltip(note.GetTooltipText());
|
||||
}
|
||||
}
|
||||
|
||||
private unsafe void DrawMinimapFlag(Vector2 contentTopLeft, Func<float, float, Vector2> texToContent, float scaleFactor, float offsetX, float offsetY)
|
||||
{
|
||||
var agent = AgentMap.Instance();
|
||||
|
||||
Reference in New Issue
Block a user