From 00c8882c73c943e18bba4cd690044916728e85b6 Mon Sep 17 00:00:00 2001 From: PaintingTs Date: Fri, 23 Feb 2024 22:09:05 +0100 Subject: [PATCH] Unique items InfoBox now visible at 800X600 and lower resolutions. Stashed unique items show InfoBox near the Stash Panel --- Source/items.cpp | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/Source/items.cpp b/Source/items.cpp index dbb85ddbbb3..29d216fdd7b 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -1784,10 +1784,31 @@ void PrintItemOil(char iDidx) } } -void DrawUniqueInfoWindow(const Surface &out) -{ - ClxDraw(out, GetPanelPosition(UiPanels::Inventory, { 24 - SidePanelSize.width, 327 }), (*pSTextBoxCels)[0]); - DrawHalfTransparentRectTo(out, GetRightPanel().position.x - SidePanelSize.width + 27, GetRightPanel().position.y + 28, 265, 297); +Point DrawUniqueInfoWindow(const Surface &out) +{ + const bool isInStash = IsStashOpen && GetLeftPanel().contains(MousePosition); + int panelX, panelY; + if (isInStash) { + ClxDraw(out, GetPanelPosition(UiPanels::Stash, { 24 + SidePanelSize.width, 327 }), (*pSTextBoxCels)[0]); + panelX = GetLeftPanel().position.x + SidePanelSize.width + 27; + panelY = GetLeftPanel().position.y + 28; + } else { + ClxDraw(out, GetPanelPosition(UiPanels::Inventory, { 24 - SidePanelSize.width, 327 }), (*pSTextBoxCels)[0]); + panelX = GetRightPanel().position.x - SidePanelSize.width + 27; + panelY = GetRightPanel().position.y + 28; + } + + const Point rightInfoPos = GetRightPanel().position - Displacement { SidePanelSize.width, 0 }; + const Point leftInfoPos = GetLeftPanel().position + Displacement { SidePanelSize.width, 0 }; + + const bool isInfoOverlapping = IsLeftPanelOpen() && IsRightPanelOpen() && GetLeftPanel().contains(rightInfoPos); + int fadeLevel = isInfoOverlapping ? 3 : 1; + + for (int i = 0; i < fadeLevel; ++i) { + DrawHalfTransparentRectTo(out, panelX, panelY, 265, 297); + } + + return isInStash ? leftInfoPos : rightInfoPos; } void printItemMiscKBM(const Item &item, const bool isOil, const bool isCastOnTarget) @@ -3878,12 +3899,7 @@ bool DoOil(Player &player, int cii) void DrawUniqueInfo(const Surface &out) { - const Point position = GetRightPanel().position - Displacement { SidePanelSize.width, 0 }; - if (IsLeftPanelOpen() && GetLeftPanel().contains(position)) { - return; - } - - DrawUniqueInfoWindow(out); + const Point position = DrawUniqueInfoWindow(out); Rectangle rect { position + Displacement { 32, 56 }, { 257, 0 } }; const UniqueItem &uitem = UniqueItems[curruitem._iUid];