mirror of
https://github.com/luanti-org/luanti.git
synced 2025-09-15 18:57:08 +00:00
Fix selected item offset
This commit is contained in:
parent
a4303f0562
commit
6248707548
1 changed files with 8 additions and 5 deletions
|
@ -358,7 +358,7 @@ void Hud::drawHotbar(const v2s32 &screen_pos, const v2f &offset, u16 direction,
|
||||||
direction, pos, width, height);
|
direction, pos, width, height);
|
||||||
drawInventoryBackground(pos, width, height);
|
drawInventoryBackground(pos, width, height);
|
||||||
|
|
||||||
// Handle offset
|
/// Handle offset
|
||||||
std::size_t source_index = 0;
|
std::size_t source_index = 0;
|
||||||
u16 length_before = 0;
|
u16 length_before = 0;
|
||||||
for (s32 i_offset = inv_offset; source_index < sources.size(); source_index++) {
|
for (s32 i_offset = inv_offset; source_index < sources.size(); source_index++) {
|
||||||
|
@ -367,8 +367,10 @@ void Hud::drawHotbar(const v2s32 &screen_pos, const v2f &offset, u16 direction,
|
||||||
s32 inv_length = MYMIN(source.length - i_offset, max_inv_length);
|
s32 inv_length = MYMIN(source.length - i_offset, max_inv_length);
|
||||||
|
|
||||||
drawItems(pos + getInventoryPosOffset(direction, 0, max_inv_length - inv_length),
|
drawItems(pos + getInventoryPosOffset(direction, 0, max_inv_length - inv_length),
|
||||||
inv_length + source.offset + i_offset, source.offset + i_offset,
|
inv_length + source.offset + i_offset,
|
||||||
inventory->getList(source.list), wield_index + source.offset,
|
source.offset + i_offset,
|
||||||
|
inventory->getList(source.list),
|
||||||
|
wield_index + source.offset - inv_offset + i_offset,
|
||||||
direction, true, 0);
|
direction, true, 0);
|
||||||
length_before = inv_length;
|
length_before = inv_length;
|
||||||
source_index++;
|
source_index++;
|
||||||
|
@ -386,7 +388,8 @@ void Hud::drawHotbar(const v2s32 &screen_pos, const v2f &offset, u16 direction,
|
||||||
drawItems(pos + getInventoryPosOffset(direction, length_before, max_inv_length - inv_length),
|
drawItems(pos + getInventoryPosOffset(direction, length_before, max_inv_length - inv_length),
|
||||||
inv_length + source.offset,
|
inv_length + source.offset,
|
||||||
source.offset, inventory->getList(source.list),
|
source.offset, inventory->getList(source.list),
|
||||||
wield_index - length_before + source.offset, direction, true, length_before);
|
wield_index - length_before + source.offset - inv_offset,
|
||||||
|
direction, true, length_before);
|
||||||
length_before += inv_length;
|
length_before += inv_length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue