diff --git a/forms/projectsettingseditor.ui b/forms/projectsettingseditor.ui
index 34504fb5..0769ac7b 100644
--- a/forms/projectsettingseditor.ui
+++ b/forms/projectsettingseditor.ui
@@ -331,6 +331,9 @@
16
+
+ true
+
-
@@ -388,6 +391,9 @@
16
+
+ true
+
-
@@ -421,6 +427,9 @@
16
+
+ true
+
-
@@ -448,6 +457,9 @@
16
+
+ true
+
diff --git a/include/ui/projectsettingseditor.h b/include/ui/projectsettingseditor.h
index 83fe741e..5ba85813 100644
--- a/include/ui/projectsettingseditor.h
+++ b/include/ui/projectsettingseditor.h
@@ -49,6 +49,7 @@ private slots:
void dialogButtonClicked(QAbstractButton *button);
void choosePrefabsFileClicked(bool);
void importDefaultPrefabsClicked(bool);
+ void updateAttributeLimits(const QString &attrSize);
void markEdited();
};
diff --git a/src/ui/projectsettingseditor.cpp b/src/ui/projectsettingseditor.cpp
index ae64053e..3afc77d1 100644
--- a/src/ui/projectsettingseditor.cpp
+++ b/src/ui/projectsettingseditor.cpp
@@ -36,6 +36,7 @@ void ProjectSettingsEditor::connectSignals() {
connect(ui->button_ChoosePrefabs, &QAbstractButton::clicked, this, &ProjectSettingsEditor::choosePrefabsFileClicked);
connect(ui->button_ImportDefaultPrefabs, &QAbstractButton::clicked, this, &ProjectSettingsEditor::importDefaultPrefabsClicked);
connect(ui->comboBox_BaseGameVersion, &QComboBox::currentTextChanged, this, &ProjectSettingsEditor::promptRestoreDefaults);
+ connect(ui->comboBox_AttributesSize, &QComboBox::currentTextChanged, this, &ProjectSettingsEditor::updateAttributeLimits);
// Record that there are unsaved changes if any of the settings are modified
for (auto combo : ui->centralwidget->findChildren())
@@ -71,12 +72,19 @@ void ProjectSettingsEditor::initUi() {
ui->spinBox_Elevation->setMaximum(15);
ui->spinBox_FillMetatile->setMaximum(Project::getNumMetatilesTotal() - 1);
+}
- // TODO: These need to be subclassed (or changed to line edits) to handle larger values
- ui->spinBox_BehaviorMask->setMaximum(UINT_MAX);
- ui->spinBox_EncounterTypeMask->setMaximum(UINT_MAX);
- ui->spinBox_LayerTypeMask->setMaximum(UINT_MAX);
- ui->spinBox_TerrainTypeMask->setMaximum(UINT_MAX);
+void ProjectSettingsEditor::updateAttributeLimits(const QString &attrSize) {
+ QMap limits {
+ {"1", 0xFF},
+ {"2", 0xFFFF},
+ {"4", 0xFFFFFFFF},
+ };
+ uint32_t max = limits.value(attrSize, UINT_MAX);
+ ui->spinBox_BehaviorMask->setMaximum(max);
+ ui->spinBox_EncounterTypeMask->setMaximum(max);
+ ui->spinBox_LayerTypeMask->setMaximum(max);
+ ui->spinBox_TerrainTypeMask->setMaximum(max);
}
void ProjectSettingsEditor::createProjectPathsTable() {
@@ -151,6 +159,7 @@ void ProjectSettingsEditor::refresh() {
ui->comboBox_DefaultSecondaryTileset->setTextItem(projectConfig.getDefaultSecondaryTileset());
ui->comboBox_BaseGameVersion->setTextItem(projectConfig.getBaseGameVersionString());
ui->comboBox_AttributesSize->setTextItem(QString::number(projectConfig.getMetatileAttributesSize()));
+ this->updateAttributeLimits(ui->comboBox_AttributesSize->currentText());
// Set check box states
ui->checkBox_UsePoryscript->setChecked(projectConfig.getUsePoryScript());