diff --git a/forms/projectsettingseditor.ui b/forms/projectsettingseditor.ui index a088d87e..179392dd 100644 --- a/forms/projectsettingseditor.ui +++ b/forms/projectsettingseditor.ui @@ -39,7 +39,7 @@ 0 0 559 - 568 + 589 @@ -66,6 +66,16 @@ + + + + <html><head/><body><p>If enabled, Porymap will not discard data like &quot;connections_include_order&quot; or &quot;name_clone&quot;, which serve no purpose other than recreating the original game.</p></body></html> + + + Preserve data only needed to match the original game + + + @@ -1084,7 +1094,7 @@ 0 0 559 - 788 + 840 diff --git a/include/config.h b/include/config.h index eb9c9ac3..6746a0f4 100644 --- a/include/config.h +++ b/include/config.h @@ -323,6 +323,7 @@ public: this->tilesetsHaveCallback = true; this->tilesetsHaveIsCompressed = true; this->setTransparentPixelsBlack = true; + this->preserveMatchingOnlyData = false; this->filePaths.clear(); this->eventIconPaths.clear(); this->pokemonIconPaths.clear(); @@ -389,6 +390,7 @@ public: bool tilesetsHaveCallback; bool tilesetsHaveIsCompressed; bool setTransparentPixelsBlack; + bool preserveMatchingOnlyData; int metatileAttributesSize; uint32_t metatileBehaviorMask; uint32_t metatileTerrainTypeMask; diff --git a/src/config.cpp b/src/config.cpp index d74adbcb..d76f17a5 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -809,6 +809,8 @@ void ProjectConfig::parseConfigKeyValue(QString key, QString value) { this->tilesetsHaveIsCompressed = getConfigBool(key, value); } else if (key == "set_transparent_pixels_black") { this->setTransparentPixelsBlack = getConfigBool(key, value); + } else if (key == "preserve_matching_only_data") { + this->preserveMatchingOnlyData = getConfigBool(key, value); } else if (key == "event_icon_path_object") { this->eventIconPaths[Event::Group::Object] = value; } else if (key == "event_icon_path_warp") { @@ -899,6 +901,7 @@ QMap ProjectConfig::getKeyValueMap() { map.insert("tilesets_have_callback", QString::number(this->tilesetsHaveCallback)); map.insert("tilesets_have_is_compressed", QString::number(this->tilesetsHaveIsCompressed)); map.insert("set_transparent_pixels_black", QString::number(this->setTransparentPixelsBlack)); + map.insert("preserve_matching_only_data", QString::number(this->preserveMatchingOnlyData)); map.insert("metatile_attributes_size", QString::number(this->metatileAttributesSize)); map.insert("metatile_behavior_mask", Util::toHexString(this->metatileBehaviorMask)); map.insert("metatile_terrain_type_mask", Util::toHexString(this->metatileTerrainTypeMask)); diff --git a/src/project.cpp b/src/project.cpp index 891f709f..bef26614 100644 --- a/src/project.cpp +++ b/src/project.cpp @@ -1925,10 +1925,12 @@ bool Project::readMapGroups() { this->mapConstantsToMapNames.insert(dynamicMapConstant, dynamicMapName); this->mapNames.append(dynamicMapName); - // Save custom JSON data. // Chuck the "connections_include_order" field, this is only for matching. - // TODO: Setting not to do this, on the off chance someone wants this field. - mapGroupsObj.remove("connections_include_order"); + if (!projectConfig.preserveMatchingOnlyData) { + mapGroupsObj.remove("connections_include_order"); + } + + // Preserve any remaining fields for when we save. this->customMapGroupsData = mapGroupsObj; return true; @@ -2429,8 +2431,9 @@ bool Project::readRegionMapSections() { } // Chuck the "name_clone" field, this is only for matching. - // TODO: Setting not to do this, on the off chance someone wants this field. - mapSectionObj.remove("name_clone"); + if (!projectConfig.preserveMatchingOnlyData) { + mapSectionObj.remove("name_clone"); + } // Preserve any remaining fields for when we save. location.custom = mapSectionObj; diff --git a/src/ui/projectsettingseditor.cpp b/src/ui/projectsettingseditor.cpp index fa84f3e0..90951dd7 100644 --- a/src/ui/projectsettingseditor.cpp +++ b/src/ui/projectsettingseditor.cpp @@ -443,6 +443,7 @@ void ProjectSettingsEditor::refresh() { ui->checkBox_OutputCallback->setChecked(projectConfig.tilesetsHaveCallback); ui->checkBox_OutputIsCompressed->setChecked(projectConfig.tilesetsHaveIsCompressed); ui->checkBox_DisableWarning->setChecked(porymapConfig.warpBehaviorWarningDisabled); + ui->checkBox_PreserveMatchingOnlyData->setChecked(projectConfig.preserveMatchingOnlyData); // Radio buttons if (projectConfig.setTransparentPixelsBlack) @@ -524,6 +525,7 @@ void ProjectSettingsEditor::save() { projectConfig.tilesetsHaveIsCompressed = ui->checkBox_OutputIsCompressed->isChecked(); porymapConfig.warpBehaviorWarningDisabled = ui->checkBox_DisableWarning->isChecked(); projectConfig.setTransparentPixelsBlack = ui->radioButton_RenderBlack->isChecked(); + projectConfig.preserveMatchingOnlyData = ui->checkBox_PreserveMatchingOnlyData->isChecked(); // Save spin box settings projectConfig.defaultElevation = ui->spinBox_Elevation->value();