Browse Source

Use Position in AddItemToLabelQueue()

pull/5656/head
Anders Jenbo 3 years ago
parent
commit
bb2463862c
  1. 2
      Source/engine/render/scrollrt.cpp
  2. 14
      Source/qol/itemlabels.cpp
  3. 2
      Source/qol/itemlabels.h

2
Source/engine/render/scrollrt.cpp

@ -654,7 +654,7 @@ void DrawItem(const Surface &out, Point tilePosition, Point targetBufferPosition
}
ClxDrawLight(out, position, sprite);
if (item.AnimInfo.isLastFrame() || item._iCurs == ICURS_MAGIC_ROCK)
AddItemToLabelQueue(bItem - 1, px, targetBufferPosition.y);
AddItemToLabelQueue(bItem - 1, position);
}
/**

14
Source/qol/itemlabels.cpp

@ -88,7 +88,7 @@ bool IsHighlightingLabelsEnabled()
return altPressed != *sgOptions.Gameplay.showItemLabels;
}
void AddItemToLabelQueue(int id, int x, int y)
void AddItemToLabelQueue(int id, Point position)
{
if (!IsHighlightingLabelsEnabled())
return;
@ -109,14 +109,14 @@ void AddItemToLabelQueue(int id, int x, int y)
labelCenterOffsets[index].emplace((itemBounds.first + itemBounds.second) / 2);
}
x += *labelCenterOffsets[index];
y -= TILE_HEIGHT;
position.x += *labelCenterOffsets[index];
position.y -= TILE_HEIGHT;
if (*sgOptions.Graphics.zoom) {
x *= 2;
y *= 2;
position *= 2;
}
x -= nameWidth / 2;
labelQueue.push_back(ItemLabel { id, nameWidth, { x, y - Height }, textOnGround });
position.x -= nameWidth / 2;
position.y -= Height;
labelQueue.push_back(ItemLabel { id, nameWidth, position, textOnGround });
}
bool IsMouseOverGameArea()

2
Source/qol/itemlabels.h

@ -13,7 +13,7 @@ void ToggleItemLabelHighlight();
void AltPressed(bool pressed);
bool IsItemLabelHighlighted();
bool IsHighlightingLabelsEnabled();
void AddItemToLabelQueue(int id, int x, int y);
void AddItemToLabelQueue(int id, Point position);
void DrawItemNameLabels(const Surface &out);
} // namespace devilution

Loading…
Cancel
Save