summaryrefslogtreecommitdiff
path: root/src/flooritem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/flooritem.cpp')
-rw-r--r--src/flooritem.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/flooritem.cpp b/src/flooritem.cpp
index 9376dd73..b2f6376b 100644
--- a/src/flooritem.cpp
+++ b/src/flooritem.cpp
@@ -35,7 +35,8 @@ FloorItem::FloorItem(int id,
mId(id),
mX(x),
mY(y),
- mMap(map)
+ mMap(map),
+ mAlpha(1.0f)
{
// Create a corresponding item instance
mItem = new Item(itemId);
@@ -64,7 +65,13 @@ Item *FloorItem::getItem() const
void FloorItem::draw(Graphics *graphics, int offsetX, int offsetY) const
{
- graphics->drawImage(mItem->getImage(),
- mX * 32 + offsetX,
- mY * 32 + offsetY);
+ if (mItem)
+ {
+ if (mAlpha != mItem->getImage()->getAlpha())
+ mItem->getImage()->setAlpha(mAlpha);
+
+ graphics->drawImage(mItem->getImage(),
+ mX * 32 + offsetX,
+ mY * 32 + offsetY);
+ }
}