Skip to content

Commit

Permalink
Unique items InfoBox now visible at 800X600 and lower resolutions. St…
Browse files Browse the repository at this point in the history
…ashed unique items show InfoBox near the Stash Panel
  • Loading branch information
PaintingTs authored and AJenbo committed Mar 2, 2024
1 parent 57b494a commit 00c8882
Showing 1 changed file with 26 additions and 10 deletions.
36 changes: 26 additions & 10 deletions Source/items.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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];
Expand Down

0 comments on commit 00c8882

Please sign in to comment.