diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2009-03-30 03:19:08 -0400 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2009-03-30 03:19:08 -0400 |
| commit | 38c7f13ba4eaf8ffed2dc8de20813c68a2fd709c (patch) | |
| tree | 4e16ba6f3bc9001cbd6e43f99d4776998195823a | |
| parent | cde459950d325ca9023c22eba34bbf9bd88e2369 (diff) | |
| download | sigen-38c7f13ba4eaf8ffed2dc8de20813c68a2fd709c.tar.gz sigen-38c7f13ba4eaf8ffed2dc8de20813c68a2fd709c.tar.xz sigen-38c7f13ba4eaf8ffed2dc8de20813c68a2fd709c.zip | |
Handle always-walkable tiles as well when showing the map with walkable areas
| -rw-r--r-- | sigmodr/widgets/mapeditor/TileItem.cpp | 16 | ||||
| -rw-r--r-- | sigmodr/widgets/mapeditor/TileItem.h | 2 |
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: |
