diff --git a/modules/core_lib/effects.lua b/modules/core_lib/effects.lua index 41f2faa6..e43a4f1c 100644 --- a/modules/core_lib/effects.lua +++ b/modules/core_lib/effects.lua @@ -14,7 +14,7 @@ end function Effects.fadeOut(widget, time, elapsed) if not elapsed then elapsed = 0 end if not time then time = 250 end - widget:setOpacity((time - elapsed)/time) + widget:setOpacity(math.max((time - elapsed)/time, 0)) if elapsed < time then scheduleEvent(function() Effects.fadeOut(widget, time, elapsed + 30) diff --git a/src/otclient/core/item.cpp b/src/otclient/core/item.cpp index 17f26cc8..33b818fe 100644 --- a/src/otclient/core/item.cpp +++ b/src/otclient/core/item.cpp @@ -49,6 +49,7 @@ ItemPtr Item::create(int id) } PainterShaderProgramPtr itemProgram; +int ITEM_ID_UNIFORM = 10; void Item::draw(const Point& dest, float scaleFactor, bool animate) { @@ -167,8 +168,11 @@ void Item::draw(const Point& dest, float scaleFactor, bool animate) itemProgram->addShaderFromSourceCode(Shader::Vertex, glslMainWithTexCoordsVertexShader + glslPositionOnlyVertexShader); itemProgram->addShaderFromSourceFile(Shader::Fragment, "/game_shaders/item.frag"); assert(itemProgram->link()); + itemProgram->bindUniformLocation(ITEM_ID_UNIFORM, "itemId"); } g_painter.setCustomProgram(itemProgram); + itemProgram->bind(); + itemProgram->setUniformValue(ITEM_ID_UNIFORM, (int)m_id); // now we can draw the item internalDraw(dest, scaleFactor, xPattern, yPattern, zPattern, animationPhase);