Merge pull request #588 from MihailRis/fixes

Fixes
This commit is contained in:
MihailRis 2025-08-12 20:53:57 +03:00 committed by GitHub
commit b22e20154e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 20 additions and 4 deletions

View File

@ -538,6 +538,7 @@ void Hud::closeInventory() {
exchangeSlotInv = nullptr;
inventoryOpen = false;
inventoryView = nullptr;
secondInvView = nullptr;
secondUI = nullptr;
for (auto& element : elements) {
@ -597,6 +598,9 @@ void Hud::remove(const std::shared_ptr<UINode>& node) {
}
}
cleanup();
if (node == secondUI) {
closeInventory();
}
}
void Hud::setDebug(bool flag) {

View File

@ -126,7 +126,15 @@ void Batch3D::sprite(
float scale = 1.0f / static_cast<float>(atlasRes);
float u = (index % atlasRes) * scale;
float v = 1.0f - ((index / atlasRes) * scale) - scale;
sprite(pos, up, right, w, h, UVRegion(u, v, u+scale, v+scale), tint);
sprite(
pos + right * w + up * h, // revert centering
up,
right,
w,
h,
UVRegion(u, v, u + scale, v + scale),
tint
);
}
void Batch3D::sprite(

View File

@ -51,6 +51,7 @@ void TextsRenderer::renderNote(
glm::vec3 yvec = note.getAxisY();
int width = font.calcWidth(text, text.length());
int height = font.getLineHeight();
if (preset.displayMode == NoteDisplayMode::Y_FREE_BILLBOARD ||
preset.displayMode == NoteDisplayMode::XY_FREE_BILLBOARD) {
xvec = camera.position - pos;
@ -96,8 +97,11 @@ void TextsRenderer::renderNote(
pos = screenPos / screenPos.w;
}
} else if (!frustum.isBoxVisible(pos - xvec * (width * 0.5f * preset.scale),
pos + xvec * (width * 0.5f * preset.scale))) {
} else if (!frustum.isBoxVisible(
pos - xvec * (width * 0.5f) * preset.scale,
pos + xvec * (width * 0.5f) * preset.scale +
yvec * static_cast<float>(height) * preset.scale
)) {
return;
}
auto color = preset.color;

View File

@ -46,7 +46,7 @@ static int l_open(lua::State* L) {
}
return lua::pushinteger(L, hud->openInventory(
layout,
level->inventories->get(invid),
lua::isnoneornil(L, 3) ? nullptr : level->inventories->get(invid),
playerInventory
)->getId());
}