From 4e6e8b7bf1c4a60c6d2f630367862a8645ccbf0c Mon Sep 17 00:00:00 2001 From: cx384 Date: Thu, 10 Oct 2024 20:25:02 +0200 Subject: [PATCH] Fix hotbar alignment with hud_hotbar_max_width --- src/client/hud.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/client/hud.cpp b/src/client/hud.cpp index 2a1acb288..3f3984d48 100644 --- a/src/client/hud.cpp +++ b/src/client/hud.cpp @@ -816,8 +816,6 @@ void Hud::drawHotbar(const v2s32 &pos, const v2f &offset, u16 dir, const v2f &al u16 playeritem = player->getWieldIndex(); v2s32 screen_offset(offset.X, offset.Y); - v2s32 centerlowerpos(m_displaycenter.X, m_screensize.Y); - s32 hotbar_itemcount = player->getMaxHotbarItemcount(); s32 width = hotbar_itemcount * (m_hotbar_imagesize + m_padding * 2); @@ -827,15 +825,11 @@ void Hud::drawHotbar(const v2s32 &pos, const v2f &offset, u16 dir, const v2f &al drawItems(pos, screen_offset, hotbar_itemcount, align, 0, mainlist, playeritem + 1, dir, true); } else { - v2s32 firstpos = pos; - firstpos.X += width/4; + v2s32 upper_pos = pos - v2s32(0, m_hotbar_imagesize + m_padding); - v2s32 secondpos = firstpos; - firstpos = firstpos - v2s32(0, m_hotbar_imagesize + m_padding); - - drawItems(firstpos, screen_offset, hotbar_itemcount / 2, align, 0, + drawItems(upper_pos, screen_offset, hotbar_itemcount / 2, align, 0, mainlist, playeritem + 1, dir, true); - drawItems(secondpos, screen_offset, hotbar_itemcount, align, + drawItems(pos, screen_offset, hotbar_itemcount, align, hotbar_itemcount / 2, mainlist, playeritem + 1, dir, true); } }