Browse Source

BUGFIX: Search Effect not working with Minimap (#7919)

pull/7920/head
Nick Wicked 11 months ago committed by GitHub
parent
commit
922fa6203b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 26
      Source/automap.cpp

26
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 = {};

Loading…
Cancel
Save