Add setting to keep data only needed for matching

This commit is contained in:
GriffinR
2025-04-03 13:43:54 -04:00
parent e94fce0c8d
commit 011f6196b5
5 changed files with 27 additions and 7 deletions

View File

@@ -39,7 +39,7 @@
<x>0</x>
<y>0</y>
<width>559</width>
<height>568</height>
<height>589</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_7">
@@ -66,6 +66,16 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_PreserveMatchingOnlyData">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If enabled, Porymap will not discard data like &amp;quot;connections_include_order&amp;quot; or &amp;quot;name_clone&amp;quot;, which serve no purpose other than recreating the original game.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Preserve data only needed to match the original game</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@@ -1084,7 +1094,7 @@
<x>0</x>
<y>0</y>
<width>559</width>
<height>788</height>
<height>840</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_8">

View File

@@ -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;

View File

@@ -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<QString, QString> 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));

View File

@@ -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;

View File

@@ -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();