Show discovered mission markers in the handheld atlas

This commit is contained in:
2026-10-15 16:53:21 +02:00
parent a2106cfa26
commit 07c4d70de5
6 changed files with 80 additions and 16 deletions
@@ -27,6 +27,7 @@ class ERR_NativeObjectiveMapProbe
protected ref ERR_ObjectiveMapPresentation m_Presentation;
protected SCR_MapMenuUI m_Menu;
protected Widget m_SharedRoot, m_ReusedRoot, m_ExpectedRoot, m_PreviousWidget;
protected ref ERRM_AtlasPresentation m_Atlas;
protected ref MapConfiguration m_Config;
protected MapConfiguration m_Ready;
protected vector m_Point;
@@ -94,7 +95,7 @@ class ERR_NativeObjectiveMapProbe
m_CloseObserved = false;
return 1;
}
protected Widget CreateSharedRoot()
protected Widget CreateSharedRoot(int page = ERRM_PaperPages.OVERVIEW)
{
Widget root = GetGame().GetWorkspace().CreateWidgets("{255E1265F702B4AE}UI/layouts/ERRMap/SharedMapRenderTarget.layout");
if (!root) return null;
@@ -104,6 +105,12 @@ class ERR_NativeObjectiveMapProbe
// is bound, so these observations cannot qualify the physical held texture.
target.SetEnabled(false);
root.SetVisible(true);
// Exercise the production atlas gutter, index grid and objective visibility.
m_Atlas = new ERRM_AtlasPresentation(root);
float zoom; int columns, rows;
if (!ERRM_PaperPages.Layout(m_Map.Size(), 0.5, zoom, columns, rows)) return null;
m_Atlas.Prepare(page, m_Map.Size(), zoom, columns, rows);
m_Atlas.Draw(page, zoom, columns, rows, m_Map.Size());
return root;
}
protected bool OpenShared(Widget root)
@@ -122,7 +129,9 @@ class ERR_NativeObjectiveMapProbe
protected void Center(float zoom)
{
int position[2]; m_Marker.GetWorldPos(position);
m_Map.ZoomPanSmooth(zoom, position[0] + 100.0 / zoom, position[1], 0.1);
float width, height; m_Map.GetMapWidget().GetScreenSize(width, height);
float offset = Math.Min(100, width * 0.25);
m_Map.ZoomPanSmooth(zoom, position[0] + offset / zoom, position[1], 0.1);
}
protected bool Inspect(string label, bool rough)
{
@@ -133,6 +142,13 @@ class ERR_NativeObjectiveMapProbe
Widget nativeIcons = m_ExpectedRoot.FindAnyWidget("UIIconsContainer");
if (!container && nativeIcons) container = nativeIcons.GetParent();
if (!Check(root && element && container && container != m_Map.GetMapWidget() && root.GetParent() == container && m_Presentation.ERR_ProbeContainer() == container && m_Presentation.ERR_ProbeCanvas() == m_Map.GetMapWidget(), "actual authored layout handler belongs to the exact supported objective container and native canvas")) return false;
if (m_ExpectedRoot.FindAnyWidget("ERR_ObjectiveOverlay"))
{
vector mapPos = FrameSlot.GetPos(m_Map.GetMapWidget()), overlayPos = FrameSlot.GetPos(container);
float mapW, mapH, overlayW, overlayH;
m_Map.GetMapWidget().GetScreenSize(mapW, mapH); container.GetScreenSize(overlayW, overlayH);
if (!Check(container.IsVisible() && container.GetZOrder() > 10 && Math.AbsFloat(mapPos[0] - overlayPos[0]) < 0.1 && Math.AbsFloat(mapPos[1] - overlayPos[1]) < 0.1 && Math.AbsFloat(mapW - overlayW) < 1 && Math.AbsFloat(mapH - overlayH) < 1, "atlas index/regional overlay is visible above print and matches the map rectangle")) return false;
}
TextWidget text = TextWidget.Cast(root.FindAnyWidget("ObjectiveText"));
ImageWidget image = ImageWidget.Cast(root.FindAnyWidget("Image"));
if (!Check(text && image && text.GetText() == label && root.IsVisible(), "actual visible widget contains the current objective label and icon widget")) return false;
@@ -285,7 +301,7 @@ class ERR_NativeObjectiveMapProbe
MapConfiguration previousConfig = m_Config;
m_Map.CloseMap();
if (!Check(!m_Presentation.ERR_ProbeRoot(), "closing shared root clears only owned objective widget")) return -1;
m_ReusedRoot = CreateSharedRoot();
m_ReusedRoot = CreateSharedRoot(ERRM_PaperPages.REGION);
if (!OpenShared(m_ReusedRoot)) return -1;
if (!Check(m_Config == previousConfig && m_ReusedRoot != m_SharedRoot, "native plain config is reused with a distinct root")) return -1;
m_Stage = 11; m_Wait = now + 1000; return 0;
@@ -46,9 +46,16 @@ class ERRM_AtlasPresentation
Widget mapWidget = m_Root.FindAnyWidget("MapWidget");
FrameSlot.SetPos(mapWidget, m_X, m_Y);
FrameSlot.SetSize(mapWidget, m_Width, m_Height);
// Objective pins belong on detail pages, not on the atlas jacket/index.
// Every geographical sheet carries the same disclosed objectives as the
// interactive map. Clip pins/labels to cartography, above the printed grid.
Widget objectives = m_Root.FindAnyWidget("ERR_ObjectiveOverlay");
if (objectives) objectives.SetVisible(page < ERRM_PaperPages.OVERVIEW);
if (objectives)
{
FrameSlot.SetPos(objectives, m_X, m_Y);
FrameSlot.SetSize(objectives, m_Width, m_Height);
objectives.SetZOrder(20);
objectives.SetVisible(page != ERRM_PaperPages.COVER);
}
}
void HideNames(MapLayer layer, int faction)
{