From 922fa6203bd7b43cfd1e68c871777f2e98be5666 Mon Sep 17 00:00:00 2001 From: Nick Wicked <129680905+wkdgmr@users.noreply.github.com> Date: Sun, 13 Apr 2025 20:44:36 -0400 Subject: [PATCH] BUGFIX: Search Effect not working with Minimap (#7919) --- Source/automap.cpp | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/Source/automap.cpp b/Source/automap.cpp index e46d07f0d..e1039c050 100644 --- a/Source/automap.cpp +++ b/Source/automap.cpp @@ -1283,31 +1283,34 @@ void SearchAutomapItem(const Surface &out, const Displacement &myPlayerOffset, i const int startX = std::clamp(tile.x - searchRadius, 0, MAXDUNX); const int startY = std::clamp(tile.y - searchRadius, 0, MAXDUNY); - const int endX = std::clamp(tile.x + searchRadius, 0, MAXDUNX); const int endY = std::clamp(tile.y + searchRadius, 0, MAXDUNY); - int scale = (GetAutomapType() == AutomapType::Minimap) ? MinimapScale : AutoMapScale; + const AutomapType mapType = GetAutomapType(); + const int scale = (mapType == AutomapType::Minimap) ? MinimapScale : AutoMapScale; for (int i = startX; i < endX; i++) { for (int j = startY; j < endY; j++) { if (!highlightTile({ i, j })) continue; - int px = i - 2 * AutomapOffset.deltaX - ViewPosition.x; - int py = j - 2 * AutomapOffset.deltaY - ViewPosition.y; + const int px = i - 2 * AutomapOffset.deltaX - ViewPosition.x; + const int py = j - 2 * AutomapOffset.deltaY - ViewPosition.y; Point screen = { - (myPlayerOffset.deltaX * scale / 100 / 2) + (px - py) * AmLine(AmLineLength::DoubleTile) + gnScreenWidth / 2, - (myPlayerOffset.deltaY * scale / 100 / 2) + (px + py) * AmLine(AmLineLength::FullTile) + (gnScreenHeight - GetMainPanel().size.height) / 2 + (myPlayerOffset.deltaX * scale / 100 / 2) + (px - py) * AmLine(AmLineLength::DoubleTile), + (myPlayerOffset.deltaY * scale / 100 / 2) + (px + py) * AmLine(AmLineLength::FullTile), }; - if (CanPanelsCoverView()) { + screen += GetAutomapScreen(); + + if (mapType != AutomapType::Minimap && CanPanelsCoverView()) { if (IsRightPanelOpen()) - screen.x -= 160; + screen.x -= gnScreenWidth / 4; if (IsLeftPanelOpen()) - screen.x += 160; + screen.x += gnScreenWidth / 4; } + screen.y -= AmLine(AmLineLength::FullTile); DrawDiamond(out, screen, MapColorsItem); } @@ -1782,6 +1785,11 @@ void DrawAutomap(const Surface &out) DrawHorizontalLine(out, MinimapRect.position + Displacement { -2, MinimapRect.size.height }, MinimapRect.size.width + 3, MapColorsDim); DrawVerticalLine(out, MinimapRect.position + Displacement { -2, -1 }, MinimapRect.size.height + 1, MapColorsDim); DrawVerticalLine(out, MinimapRect.position + Displacement { MinimapRect.size.width, -1 }, MinimapRect.size.height + 1, MapColorsDim); + + if (AutoMapShowItems) + SearchAutomapItem(out, myPlayerOffset, 8, [](Point position) { + return dItem[position.x][position.y] != 0; + }); } Point screen = {};