summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sigmodr/widgets/mapeditor/TileItem.cpp16
-rw-r--r--sigmodr/widgets/mapeditor/TileItem.h2
2 files changed, 13 insertions, 5 deletions
diff --git a/sigmodr/widgets/mapeditor/TileItem.cpp b/sigmodr/widgets/mapeditor/TileItem.cpp
index 76a780c2..dd40adbc 100644
--- a/sigmodr/widgets/mapeditor/TileItem.cpp
+++ b/sigmodr/widgets/mapeditor/TileItem.cpp
@@ -97,7 +97,7 @@ void TileItem::drawCollisionMask(const bool mask)
update();
}
-void TileItem::setSprite(const int spriteId)
+void TileItem::setSprite(const int spriteId, const bool walkable)
{
if (spriteId == m_tileIndex)
return;
@@ -109,8 +109,16 @@ void TileItem::setSprite(const int spriteId)
}
if (!m_pixmap.isNull())
{
- m_masked = m_pixmap.alphaChannel();
- m_masked.setMask(m_masked.createMaskFromColor(Qt::white));
+ if (walkable)
+ {
+ m_masked = QPixmap(m_pixmap.size());
+ m_masked.fill(Qt::black);
+ }
+ else
+ {
+ m_masked = m_pixmap.alphaChannel();
+ m_masked.setMask(m_masked.createMaskFromColor(Qt::white));
+ }
}
prepareGeometryChange();
m_tileIndex = spriteId;
@@ -125,7 +133,7 @@ void TileItem::tileChanged()
{
const Tile* tile = m_tile->game()->tileById(m_tile->tile());
if (tile)
- setSprite(tile->preview());
+ setSprite(tile->preview(), tile->walkable());
setPos(m_tile->position());
setZValue(m_tile->zIndex());
resetLabel();
diff --git a/sigmodr/widgets/mapeditor/TileItem.h b/sigmodr/widgets/mapeditor/TileItem.h
index 1cfe0b52..081a21ea 100644
--- a/sigmodr/widgets/mapeditor/TileItem.h
+++ b/sigmodr/widgets/mapeditor/TileItem.h
@@ -53,7 +53,7 @@ class SIGMODRWIDGETS_NO_EXPORT TileItem : public MapItem
public slots:
void drawCollisionMask(const bool mask);
- void setSprite(const int spriteId);
+ void setSprite(const int spriteId, const bool walkable);
protected:
void moveTo(const QPoint& point);
protected slots: