v1.0.0.20: Fix marker refresh sometimes not running when accepting/advancing quest

Made-with: Cursor
This commit is contained in:
2026-03-04 02:28:16 -05:00
parent 611e61967b
commit 448d3ca933
4 changed files with 29 additions and 14 deletions
+25 -8
View File
@@ -175,6 +175,7 @@ public unsafe partial class MapRenderer : IDisposable
if (string.IsNullOrEmpty(idStr)) return false;
// Try several path conventions so the minimap can show without ever requiring the user to open the Area Map.
// Prefer TextureProvider.GetFromGame (same as Area Map) so path resolution and mods match; fall back to Lumina GetTexFile.
var fileName = idStr.Replace("/", "");
var pathsToTry = new[]
{
@@ -185,17 +186,24 @@ public unsafe partial class MapRenderer : IDisposable
$"ui/uld/areamap/{fileName}.tex",
};
string? gamePath = null;
IDalamudTextureWrap? texture = null;
foreach (var path in pathsToTry) {
var wrap = Service.TextureProvider.GetFromGame(path).GetWrapOrDefault();
if (wrap is not null && wrap.Handle != IntPtr.Zero && wrap.Size.X > 0 && wrap.Size.Y > 0) {
gamePath = path;
break;
}
texture = LoadSingleTexture(path);
if (texture is not null) break;
}
if (texture is null) return false;
if (gamePath is null && texture is null) return false;
TrimMinimapCacheToLimit();
var entry = _minimapCache[mapId] = new MinimapCacheEntry();
entry.PathKey = $"lumina:{mapId}";
entry.Texture = texture;
entry.PathKey = gamePath is not null ? $"game:{gamePath}" : $"lumina:{mapId}";
entry.Texture = texture; // null when using game path (looked up each frame)
entry.ScaleFactor = map.SizeFactor / 100f;
entry.OffsetX = map.OffsetX;
entry.OffsetY = map.OffsetY;
@@ -251,14 +259,23 @@ public unsafe partial class MapRenderer : IDisposable
TryEnsureLuminaCacheFor(currentMapId);
// Draw from cache if we have it for the current map.
if (!_minimapCache.TryGetValue(currentMapId, out var cached) || cached.Texture is null)
if (!_minimapCache.TryGetValue(currentMapId, out var cached))
return;
// Resolve texture: use cached texture, or for "game:" path look up via TextureProvider each frame (same as Area Map).
IDalamudTextureWrap? textureToDraw = cached.Texture;
if (textureToDraw is null && cached.PathKey.StartsWith("game:", StringComparison.Ordinal)) {
var path = cached.PathKey.Substring(5);
textureToDraw = Service.TextureProvider.GetFromGame(path).GetWrapOrDefault();
}
if (textureToDraw is null)
return;
// Use the size passed by the minimap window (window size) so zoom/center is stable.
if (size.X <= 0 || size.Y <= 0) return;
var zoom = Math.Clamp(System.SystemConfig.MinimapZoom, 0.03f, 0.112f);
var mapSize = cached.Texture.Size.X;
var mapSize = textureToDraw.Size.X;
// Scale so the map COVERS the view at zoom=1 (use max so no black bands at max zoom out).
var fitScale = Math.Max(size.X, size.Y) / mapSize;
var scale = fitScale / zoom;
@@ -270,11 +287,11 @@ public unsafe partial class MapRenderer : IDisposable
var drawOffset = (-playerCoord + new Vector2(cached.OffsetX, cached.OffsetY)) * cached.ScaleFactor;
var centerOffset = size / 2.0f;
var mapCenterOffset = (cached.Texture.Size / 2f) * scale;
var mapCenterOffset = (textureToDraw.Size / 2f) * scale;
var drawPosition = centerOffset - mapCenterOffset + drawOffset * scale;
// Clamp so the map always fills the view (no black), but when zoomed in allow full pan so the player tracks.
var texSize = cached.Texture.Size * scale;
var texSize = textureToDraw.Size * scale;
if (texSize.X > size.X && texSize.Y > size.Y) {
// Zoomed in: allow full pan range so the map can shift in any direction and the player stays at center.
drawPosition.X = Math.Clamp(drawPosition.X, size.X - texSize.X, texSize.X - size.X);
@@ -287,7 +304,7 @@ public unsafe partial class MapRenderer : IDisposable
// Content top-left in screen space so player is drawn at the true center of the minimap (not offset by title bar).
var contentTopLeft = ImGui.GetCursorScreenPos();
DrawMinimapCachedTextureAt(drawPosition, scale, cached.Texture);
DrawMinimapCachedTextureAt(drawPosition, scale, textureToDraw);
var centerScreen = contentTopLeft + centerOffset;
// Draw cone under markers so quest/FATE/POI markers stay visible on top of the cone.
DrawMinimapConeAtCenter(centerScreen, scale);