v1.0.0.14: Movement Trail (Carbonite-style) - red dots show where you've been
Made-with: Cursor
This commit is contained in:
@@ -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