diff --git a/include/editor.h b/include/editor.h index 80e57c5a..3447f8a3 100644 --- a/include/editor.h +++ b/include/editor.h @@ -168,6 +168,7 @@ private: Event* createNewHiddenItemEvent(); Event* createNewSecretBaseEvent(); QString getMovementPermissionText(uint16_t collision, uint16_t elevation); + QString getMetatileDisplayMessage(uint16_t metatileId); private slots: void onMapStartPaint(QGraphicsSceneMouseEvent *event, MapPixmapItem *item); diff --git a/src/editor.cpp b/src/editor.cpp index 00765fc4..ed252450 100644 --- a/src/editor.cpp +++ b/src/editor.cpp @@ -867,7 +867,7 @@ void Editor::onHoveredMovementPermissionCleared() { this->ui->statusBar->clearMessage(); } -void Editor::onHoveredMetatileSelectionChanged(uint16_t metatileId) { +QString Editor::getMetatileDisplayMessage(uint16_t metatileId) { Metatile *metatile = Tileset::getMetatile(metatileId, map->layout->tileset_primary, map->layout->tileset_secondary); QString message; QString hexString = QString("%1").arg(metatileId, 3, 16, QChar('0')).toUpper(); @@ -876,7 +876,11 @@ void Editor::onHoveredMetatileSelectionChanged(uint16_t metatileId) { } else { message = QString("Metatile: 0x%1").arg(hexString); } - this->ui->statusBar->showMessage(message); + return message; +} + +void Editor::onHoveredMetatileSelectionChanged(uint16_t metatileId) { + this->ui->statusBar->showMessage(getMetatileDisplayMessage(metatileId)); } void Editor::onHoveredMetatileSelectionCleared() { @@ -895,11 +899,11 @@ void Editor::onHoveredMapMetatileChanged(int x, int y) { if (map_item->paintingMode == MapPixmapItem::PaintMode::Metatiles && x >= 0 && x < map->getWidth() && y >= 0 && y < map->getHeight()) { int blockIndex = y * map->getWidth() + x; - int tile = map->layout->blockdata->blocks->at(blockIndex).tile; - this->ui->statusBar->showMessage(QString("X: %1, Y: %2, Metatile: 0x%3, Scale = %4x") + int metatileId = map->layout->blockdata->blocks->at(blockIndex).tile; + this->ui->statusBar->showMessage(QString("X: %1, Y: %2, %3, Scale = %4x") .arg(x) .arg(y) - .arg(QString("%1").arg(tile, 3, 16, QChar('0')).toUpper()) + .arg(getMetatileDisplayMessage(metatileId)) .arg(QString::number(pow(scale_base, scale_exp), 'g', 2))); } }