aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2021-05-08 19:33:52 +0200
committersfan5 <sfan5@live.de>2021-05-08 19:44:43 +0200
commit2443f1e2351d641d82597525e937792cce15be1e (patch)
treeb53e9cc6c59b68f54ce50210e464c321690346c8 /src
parent7c2826cbc0f36027d4a9781f433150d1c5d0d03f (diff)
downloadminetest-2443f1e2351d641d82597525e937792cce15be1e.tar.gz
minetest-2443f1e2351d641d82597525e937792cce15be1e.tar.bz2
minetest-2443f1e2351d641d82597525e937792cce15be1e.zip
Fix overlays for 2D-drawn items
fixes #11248
Diffstat (limited to 'src')
-rw-r--r--src/client/hud.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/client/hud.cpp b/src/client/hud.cpp
index 7f044cccd..0bfdd5af0 100644
--- a/src/client/hud.cpp
+++ b/src/client/hud.cpp
@@ -997,6 +997,8 @@ void drawItemStack(
const ItemDefinition &def = item.getDefinition(client->idef());
+ bool draw_overlay = false;
+
// Render as mesh if animated or no inventory image
if ((enable_animations && rotation_kind < IT_ROT_NONE) || def.inventory_image.empty()) {
ItemMesh *imesh = client->idef()->getWieldMesh(def.name, client);
@@ -1089,6 +1091,8 @@ void drawItemStack(
driver->setTransform(video::ETS_VIEW, oldViewMat);
driver->setTransform(video::ETS_PROJECTION, oldProjMat);
driver->setViewPort(oldViewPort);
+
+ draw_overlay = def.type == ITEM_NODE && def.inventory_image.empty();
} else { // Otherwise just draw as 2D
video::ITexture *texture = client->idef()->getInventoryTexture(def.name, client);
if (!texture)
@@ -1100,11 +1104,12 @@ void drawItemStack(
draw2DImageFilterScaled(driver, texture, rect,
core::rect<s32>({0, 0}, core::dimension2di(texture->getOriginalSize())),
clip, colors, true);
+
+ draw_overlay = true;
}
// draw the inventory_overlay
- if (def.type == ITEM_NODE && def.inventory_image.empty() &&
- !def.inventory_overlay.empty()) {
+ if (!def.inventory_overlay.empty() && draw_overlay) {
ITextureSource *tsrc = client->getTextureSource();
video::ITexture *overlay_texture = tsrc->getTexture(def.inventory_overlay);
core::dimension2d<u32> dimens = overlay_texture->getOriginalSize();