v1.0.0.14: Movement Trail (Carbonite-style) - red dots show where you've been
Made-with: Cursor
This commit is contained in:
@@ -377,6 +377,7 @@ public unsafe partial class MapRenderer : IDisposable
|
||||
DrawPlayer();
|
||||
DrawStaticTextMarkers();
|
||||
DrawMapNotes();
|
||||
DrawMovementTrail();
|
||||
DrawFlag();
|
||||
}
|
||||
}
|
||||
@@ -62,6 +62,8 @@ public partial class MapRenderer
|
||||
DrawMinimapFlag(contentTopLeft, TexToContent, scaleFactor, offsetX, offsetY);
|
||||
// User map notes
|
||||
DrawMinimapMapNotes(contentTopLeft, TexToContent, size, scaleFactor, offsetX, offsetY);
|
||||
// Movement trail
|
||||
DrawMinimapMovementTrail(contentTopLeft, TexToContent, size, scaleFactor, offsetX, offsetY);
|
||||
// Temporary (quest objectives, etc.)
|
||||
DrawMinimapTempMarkers(contentTopLeft, TexToContent, size, scaleFactor, offsetX, offsetY, scale);
|
||||
// Field markers (waymarks)
|
||||
@@ -729,6 +731,33 @@ public partial class MapRenderer
|
||||
}
|
||||
}
|
||||
|
||||
private unsafe void DrawMinimapMovementTrail(Vector2 contentTopLeft, Func<float, float, Vector2> texToContent, Vector2 size, float scaleFactor, float offsetX, float offsetY)
|
||||
{
|
||||
if (!System.SystemConfig.ShowMovementTrail) return;
|
||||
|
||||
var agent = AgentMap.Instance();
|
||||
var territoryId = agent->CurrentTerritoryId;
|
||||
var mapId = agent->CurrentMapId;
|
||||
var now = DateTime.UtcNow.Subtract(DateTime.UnixEpoch).TotalSeconds;
|
||||
var fadeTime = System.SystemConfig.MovementTrailFadeTimeSeconds;
|
||||
|
||||
foreach (var pt in System.MovementTrailConfig.GetVisiblePoints(territoryId, mapId).ToList()) {
|
||||
var age = now - pt.TimeStamp;
|
||||
var alpha = (float)((fadeTime - age) / fadeTime * 0.9);
|
||||
if (alpha <= 0f) continue;
|
||||
|
||||
var tx = 1024.0f + (pt.X - offsetX) * scaleFactor;
|
||||
var ty = 1024.0f + (pt.Y - offsetY) * scaleFactor;
|
||||
var contentPos = texToContent(tx, ty);
|
||||
if (!IsInMinimapBounds(contentPos, size, MinimapBoundsMargin)) continue;
|
||||
|
||||
var centerScreen = contentPos + contentTopLeft;
|
||||
var trailSize = 4f * 0.75f;
|
||||
var color = System.MovementTrailConfig.TrailColor with { W = alpha };
|
||||
ImGui.GetWindowDrawList().AddCircleFilled(centerScreen, trailSize, ImGui.GetColorU32(color));
|
||||
}
|
||||
}
|
||||
|
||||
private unsafe void DrawMinimapMapNotes(Vector2 contentTopLeft, Func<float, float, Vector2> texToContent, Vector2 size, float scaleFactor, float offsetX, float offsetY)
|
||||
{
|
||||
var agent = AgentMap.Instance();
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using Dalamud.Interface;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
||||
using Mappy.Classes;
|
||||
using Mappy.Data;
|
||||
|
||||
namespace Mappy.MapRenderer;
|
||||
|
||||
public partial class MapRenderer
|
||||
{
|
||||
private unsafe void DrawMovementTrail()
|
||||
{
|
||||
if (!System.SystemConfig.ShowMovementTrail) return;
|
||||
|
||||
var agent = AgentMap.Instance();
|
||||
var territoryId = agent->SelectedTerritoryId;
|
||||
var mapId = agent->SelectedMapId;
|
||||
|
||||
var now = DateTime.UtcNow.Subtract(DateTime.UnixEpoch).TotalSeconds;
|
||||
var fadeTime = System.SystemConfig.MovementTrailFadeTimeSeconds;
|
||||
|
||||
foreach (var pt in System.MovementTrailConfig.GetVisiblePoints(territoryId, mapId).ToList()) {
|
||||
var age = now - pt.TimeStamp;
|
||||
var alpha = (float)((fadeTime - age) / fadeTime * 0.9);
|
||||
if (alpha <= 0f) continue;
|
||||
|
||||
// Same coordinate space as map notes: world X,Z
|
||||
var pos = new Vector2(pt.X, pt.Y) * Scale * DrawHelpers.GetMapScaleFactor() + DrawHelpers.GetCombinedOffsetVector() * Scale;
|
||||
|
||||
var size = Math.Clamp(4 * Scale, 3f, 25f);
|
||||
var screenPos = ImGui.GetWindowPos() + DrawPosition + pos;
|
||||
|
||||
var color = System.MovementTrailConfig.TrailColor with { W = alpha };
|
||||
var drawList = ImGui.GetWindowDrawList();
|
||||
drawList.AddCircleFilled(screenPos, size, ImGui.GetColorU32(color));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user