diff --git a/Source/qol/xpbar.cpp b/Source/qol/xpbar.cpp index 31f81c4fb..bc21d9b13 100644 --- a/Source/qol/xpbar.cpp +++ b/Source/qol/xpbar.cpp @@ -31,11 +31,11 @@ constexpr int BackHeight = 9; Art xpbarArt; -void DrawBar(const Surface &out, int x, int y, int width, const ColorGradient &gradient) +void DrawBar(const Surface &out, Point screenPosition, int width, const ColorGradient &gradient) { - UnsafeDrawHorizontalLine(out, { x, y + 1 }, width, gradient[gradient.size() * 3 / 4 - 1]); - UnsafeDrawHorizontalLine(out, { x, y + 2 }, width, gradient[gradient.size() - 1]); - UnsafeDrawHorizontalLine(out, { x, y + 3 }, width, gradient[gradient.size() / 2 - 1]); + UnsafeDrawHorizontalLine(out, screenPosition + Displacement { 0, 1 }, width, gradient[gradient.size() * 3 / 4 - 1]); + UnsafeDrawHorizontalLine(out, screenPosition + Displacement { 0, 2 }, width, gradient[gradient.size() - 1]); + UnsafeDrawHorizontalLine(out, screenPosition + Displacement { 0, 3 }, width, gradient[gradient.size() / 2 - 1]); } void DrawEndCap(const Surface &out, Point point, int idx, const ColorGradient &gradient) @@ -73,9 +73,7 @@ void DrawXPBar(const Surface &out) const auto &player = Players[MyPlayerId]; const Point back = { PANEL_LEFT + PANEL_WIDTH / 2 - 155, PANEL_TOP + PANEL_HEIGHT - 11 }; - - const int xPos = back.x + 3; - const int yPos = back.y + 2; + const Point position = back + Displacement { 3, 2 }; DrawArt(out, back, &xpbarArt); @@ -83,7 +81,7 @@ void DrawXPBar(const Surface &out) if (charLevel == MAXCHARLEVEL - 1) { // Draw a nice golden bar for max level characters. - DrawBar(out, xPos, yPos, BarWidth, GoldGradient); + DrawBar(out, position, BarWidth, GoldGradient); return; } @@ -103,10 +101,10 @@ void DrawXPBar(const Surface &out) const uint64_t fade = (prevXpDelta1 - lastFullPx) * (SilverGradient.size() - 1) / onePx; // Draw beginning of bar full brightness - DrawBar(out, xPos, yPos, fullBar, SilverGradient); + DrawBar(out, position, fullBar, SilverGradient); // End pixels appear gradually - DrawEndCap(out, { xPos + static_cast(fullBar), yPos }, fade, SilverGradient); + DrawEndCap(out, position + Displacement { static_cast(fullBar), 0 }, fade, SilverGradient); } bool CheckXPBarInfo()