summaryrefslogtreecommitdiff
path: root/src/client/hud.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/hud.cpp')
-rw-r--r--src/client/hud.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/client/hud.cpp b/src/client/hud.cpp
index 0620759da..e08d2ef02 100644
--- a/src/client/hud.cpp
+++ b/src/client/hud.cpp
@@ -1007,11 +1007,15 @@ void drawItemStack(
bool draw_overlay = false;
+ bool has_mesh = false;
+ ItemMesh *imesh;
+
// 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);
- if (!imesh || !imesh->mesh)
- return;
+ imesh = client->idef()->getWieldMesh(def.name, client);
+ has_mesh = imesh && imesh->mesh;
+ }
+ if (has_mesh) {
scene::IMesh *mesh = imesh->mesh;
driver->clearBuffers(video::ECBF_DEPTH);
s32 delta = 0;
@@ -1103,10 +1107,17 @@ void drawItemStack(
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)
- return;
- video::SColor color =
- client->idef()->getItemstackColor(item, client);
+ video::SColor color;
+ if (texture) {
+ color = client->idef()->getItemstackColor(item, client);
+ } else {
+ color = video::SColor(255, 255, 255, 255);
+ ITextureSource *tsrc = client->getTextureSource();
+ texture = tsrc->getTexture("no_texture.png");
+ if (!texture)
+ return;
+ }
+
const video::SColor colors[] = { color, color, color, color };
draw2DImageFilterScaled(driver, texture, rect,