diff --git a/CHANGELOG.md b/CHANGELOG.md
index eed6c36a..df8d85f9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@ The **"Breaking Changes"** listed below are changes that have been made in the d
## [Unreleased]
### Added
- Add `setScale` to the scripting API.
+- Add option to turn off the checkerboard fill for new tilesets.
## [5.0.0] - 2022-10-30
### Breaking Changes
diff --git a/docsrc/manual/settings-and-options.rst b/docsrc/manual/settings-and-options.rst
index 2d85ed0b..bd949c13 100644
--- a/docsrc/manual/settings-and-options.rst
+++ b/docsrc/manual/settings-and-options.rst
@@ -33,6 +33,7 @@ your project root as ``porymap.user.cfg``. You should add this file to your giti
``show_player_view``, 0, global, yes, Display a rectangle for the GBA screen radius
``show_cursor_tile``, 0, global, yes, Display a rectangle around the hovered metatile(s)
``monitor_files``, 1, global, yes, Whether porymap will monitor changes to project files
+ ``tileset_checkerboard_fill``, 1, global, yes, Whether new tilesets will be filled with a checkerboard pattern of metatiles.
``theme``, default, global, yes, The color theme for porymap windows and widgets
``text_editor_goto_line``, , global, yes, The command that will be executed when clicking the button next the ``Script`` combo-box.
``text_editor_open_directory``, , global, yes, The command that will be executed when clicking ``Open Project in Text Editor``.
diff --git a/forms/newtilesetdialog.ui b/forms/newtilesetdialog.ui
index bb7d5939..c582eba0 100644
--- a/forms/newtilesetdialog.ui
+++ b/forms/newtilesetdialog.ui
@@ -7,7 +7,7 @@
0
0
400
- 190
+ 216
@@ -25,7 +25,7 @@
0
0
400
- 190
+ 216
@@ -50,7 +50,7 @@
6
- -
+
-
Qt::Vertical
@@ -74,7 +74,7 @@
380
- 135
+ 161
@@ -89,7 +89,7 @@
0
0
380
- 129
+ 155
@@ -174,11 +174,22 @@
+ -
+
+
+ Checkerboard Fill
+
+
+
+ -
+
+
+
- -
+
-
Qt::Horizontal
diff --git a/include/config.h b/include/config.h
index f7ff9a9d..20b83af9 100644
--- a/include/config.h
+++ b/include/config.h
@@ -56,6 +56,7 @@ public:
this->showBorder = true;
this->showGrid = false;
this->monitorFiles = true;
+ this->tilesetCheckerboardFill = true;
this->theme = "default";
this->textEditorOpenFolder = "";
this->textEditorGotoLine = "";
@@ -75,6 +76,7 @@ public:
void setShowBorder(bool enabled);
void setShowGrid(bool enabled);
void setMonitorFiles(bool monitor);
+ void setTilesetCheckerboardFill(bool checkerboard);
void setTheme(QString theme);
void setTextEditorOpenFolder(const QString &command);
void setTextEditorGotoLine(const QString &command);
@@ -93,6 +95,7 @@ public:
bool getShowBorder();
bool getShowGrid();
bool getMonitorFiles();
+ bool getTilesetCheckerboardFill();
QString getTheme();
QString getTextEditorOpenFolder();
QString getTextEditorGotoLine();
@@ -127,6 +130,7 @@ private:
bool showBorder;
bool showGrid;
bool monitorFiles;
+ bool tilesetCheckerboardFill;
QString theme;
QString textEditorOpenFolder;
QString textEditorGotoLine;
diff --git a/include/ui/newtilesetdialog.h b/include/ui/newtilesetdialog.h
index a292c67e..c2563f21 100644
--- a/include/ui/newtilesetdialog.h
+++ b/include/ui/newtilesetdialog.h
@@ -19,10 +19,12 @@ public:
QString fullSymbolName;
QString friendlyName;
bool isSecondary;
+ bool checkerboardFill;
private slots:
void NameOrSecondaryChanged();
void SecondaryChanged();
+ void FillChanged();
private:
Ui::NewTilesetDialog *ui;
diff --git a/src/config.cpp b/src/config.cpp
index a9ce994e..7dee8cbb 100644
--- a/src/config.cpp
+++ b/src/config.cpp
@@ -228,6 +228,8 @@ void PorymapConfig::parseConfigKeyValue(QString key, QString value) {
this->showGrid = getConfigBool(key, value);
} else if (key == "monitor_files") {
this->monitorFiles = getConfigBool(key, value);
+ } else if (key == "tileset_checkerboard_fill") {
+ this->tilesetCheckerboardFill = getConfigBool(key, value);
} else if (key == "theme") {
this->theme = value;
} else if (key == "text_editor_open_directory") {
@@ -262,6 +264,7 @@ QMap PorymapConfig::getKeyValueMap() {
map.insert("show_border", this->showBorder ? "1" : "0");
map.insert("show_grid", this->showGrid ? "1" : "0");
map.insert("monitor_files", this->monitorFiles ? "1" : "0");
+ map.insert("tileset_checkerboard_fill", this->tilesetCheckerboardFill ? "1" : "0");
map.insert("theme", this->theme);
map.insert("text_editor_open_directory", this->textEditorOpenFolder);
map.insert("text_editor_goto_line", this->textEditorGotoLine);
@@ -311,6 +314,11 @@ void PorymapConfig::setMonitorFiles(bool monitor) {
this->save();
}
+void PorymapConfig::setTilesetCheckerboardFill(bool checkerboard) {
+ this->tilesetCheckerboardFill = checkerboard;
+ this->save();
+}
+
void PorymapConfig::setMainGeometry(QByteArray mainWindowGeometry_, QByteArray mainWindowState_,
QByteArray mapSplitterState_, QByteArray mainSplitterState_) {
this->mainWindowGeometry = mainWindowGeometry_;
@@ -464,6 +472,10 @@ bool PorymapConfig::getMonitorFiles() {
return this->monitorFiles;
}
+bool PorymapConfig::getTilesetCheckerboardFill() {
+ return this->tilesetCheckerboardFill;
+}
+
QString PorymapConfig::getTheme() {
return this->theme;
}
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index e3ee72c6..e9933333 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -1277,12 +1277,14 @@ void MainWindow::on_actionNew_Tileset_triggered() {
for(int i = 0; i < numMetaTiles; ++i) {
Metatile *mt = new Metatile();
for(int j = 0; j < tilesPerMetatile; ++j){
- Tile tile(0, false, false, 0);
- //Create a checkerboard-style dummy tileset
- if(((i / 8) % 2) == 0)
- tile.tileId = ((i % 2) == 0) ? 1 : 2;
- else
- tile.tileId = ((i % 2) == 1) ? 1 : 2;
+ Tile tile = Tile();
+ if (createTilesetDialog->checkerboardFill) {
+ // Create a checkerboard-style dummy tileset
+ if (((i / 8) % 2) == 0)
+ tile.tileId = ((i % 2) == 0) ? 1 : 2;
+ else
+ tile.tileId = ((i % 2) == 1) ? 1 : 2;
+ }
mt->tiles.append(tile);
}
newSet.metatiles.append(mt);
diff --git a/src/ui/newtilesetdialog.cpp b/src/ui/newtilesetdialog.cpp
index a6a6492d..6a57ce5c 100644
--- a/src/ui/newtilesetdialog.cpp
+++ b/src/ui/newtilesetdialog.cpp
@@ -15,8 +15,13 @@ NewTilesetDialog::NewTilesetDialog(Project* project, QWidget *parent) :
QRegularExpressionValidator *validator = new QRegularExpressionValidator(expression);
this->ui->nameLineEdit->setValidator(validator);
+ bool checkerboard = porymapConfig.getTilesetCheckerboardFill();
+ this->ui->fillCheckBox->setChecked(checkerboard);
+ this->checkerboardFill = checkerboard;
+
connect(this->ui->nameLineEdit, &QLineEdit::textChanged, this, &NewTilesetDialog::NameOrSecondaryChanged);
connect(this->ui->typeComboBox, &QComboBox::currentTextChanged, this, &NewTilesetDialog::SecondaryChanged);
+ connect(this->ui->fillCheckBox, &QCheckBox::stateChanged, this, &NewTilesetDialog::FillChanged);
//connect(this->ui->toolButton, &QToolButton::clicked, this, &NewTilesetDialog::ChangeFilePath);
this->SecondaryChanged();
}
@@ -38,3 +43,8 @@ void NewTilesetDialog::NameOrSecondaryChanged() {
this->path = Tileset::getExpectedDir(this->fullSymbolName, this->isSecondary);
this->ui->pathLineEdit->setText(this->path);
}
+
+void NewTilesetDialog::FillChanged() {
+ this->checkerboardFill = this->ui->fillCheckBox->isChecked();
+ porymapConfig.setTilesetCheckerboardFill(this->checkerboardFill);
+}