diff --git a/CHANGELOG.md b/CHANGELOG.md index 555fc370..a0a7e638 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ The **"Breaking Changes"** listed below are changes that have been made in the d - The heal location prefixes `SPAWN_` and `HEAL_LOCATION_` may now be used interchangeably. - The number and order of entries in the heal location data tables can now be changed arbitrarily, and independently of each other. - The metatile behavior is now displayed in the bottom bar mouseover text. +- Number values are now allowed in the Tileset Editor's Metatile Behavior field. - Removed some unnecessary error logs from the scripting API and added new useful ones. - If any JSON data is the incorrect type Porymap will now attempt to convert it. @@ -62,7 +63,6 @@ The **"Breaking Changes"** listed below are changes that have been made in the d - Fix drawing large amounts of text with the scripting API causing a significant drop in performance. - Silence unnecessary error logging when parsing C defines Porymap doesn't use. - Fix some windows like the Tileset Editor not raising to the front when reactivated. -- Metatile behaviors with no constant will now display their value in the Tileset Editor. - Fix incorrect limits on Floor Number and Border Width/Height in the New Map Options window. - Fix Border Width/Height being set to 0 when creating a new map from an existing layout. - Fix certain UI elements not highlighting red on some platforms. diff --git a/include/ui/tileseteditor.h b/include/ui/tileseteditor.h index 29912e4d..9ac4bf9f 100644 --- a/include/ui/tileseteditor.h +++ b/include/ui/tileseteditor.h @@ -85,7 +85,7 @@ private slots: void on_actionRedo_triggered(); - void on_comboBox_metatileBehaviors_textActivated(const QString &arg1); + void on_comboBox_metatileBehaviors_currentTextChanged(const QString &arg1); void on_lineEdit_metatileLabel_editingFinished(); diff --git a/src/ui/tileseteditor.cpp b/src/ui/tileseteditor.cpp index 14e9d441..cf6203cb 100644 --- a/src/ui/tileseteditor.cpp +++ b/src/ui/tileseteditor.cpp @@ -497,11 +497,26 @@ void TilesetEditor::on_checkBox_yFlip_stateChanged(int checked) this->metatileLayersItem->clearLastModifiedCoords(); } -void TilesetEditor::on_comboBox_metatileBehaviors_textActivated(const QString &metatileBehavior) +void TilesetEditor::on_comboBox_metatileBehaviors_currentTextChanged(const QString &metatileBehavior) { if (this->metatile) { + int behavior; + if (project->metatileBehaviorMap.contains(metatileBehavior)) { + behavior = project->metatileBehaviorMap[metatileBehavior]; + } else { + // Check if user has entered a number value instead + bool ok; + behavior = metatileBehavior.toInt(&ok, 0); + if (!ok) return; + } + + // This function can also be called when the user selects + // a different metatile. Stop this from being considered a change. + if (this->metatile->behavior == static_cast(behavior)) + return; + Metatile *prevMetatile = new Metatile(*this->metatile); - this->metatile->behavior = static_cast(project->metatileBehaviorMap[metatileBehavior]); + this->metatile->behavior = behavior; MetatileHistoryItem *commit = new MetatileHistoryItem(this->getSelectedMetatileId(), prevMetatile, new Metatile(*this->metatile)); metatileHistory.push(commit);