Fixes, tweaks and new colors

* added version dependent biome names
* added option for custom biome color overrides
* tweaked biome colors for a slightly better contrast in 1.18
* fixed oceans getting ignored by biome filter for 1.18
* fixed 48-bit search for structures (hopefully better this time)
This commit is contained in:
Cubitect 2021-12-04 22:30:18 +01:00
parent 30bbf9c865
commit d40853e5f8
15 changed files with 351 additions and 172 deletions

@ -1 +1 @@
Subproject commit 0cd6e8134a0d257685867f8a77f5cd6c01ab8353
Subproject commit fa3ed2af5961d6129aceb15974e05402a2db06d8

View File

@ -5,7 +5,7 @@
#define VERS_MAJOR 1
#define VERS_MINOR 11
#define VERS_PATCH 2 // negative patch number designates a development version
#define VERS_PATCH 3 // negative patch number designates a development version
// returns +1 if newer, -1 if older and 0 if equal
inline int cmpVers(int major, int minor, int patch)

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>589</width>
<height>340</height>
<width>609</width>
<height>343</height>
</rect>
</property>
<property name="windowTitle">
@ -43,24 +43,24 @@
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans'; font-size:16pt; font-weight:600;&quot;&gt;Cubiomes-Viewer _MAJOR_._MINOR_._PATCH_&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans';&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans';&quot;&gt;Built: _DATE_&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans';&quot;&gt;URL: &lt;/span&gt;&lt;a href=&quot;https://github.com/Cubitect/cubiomes-viewer&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0057ae;&quot;&gt;https://github.com/Cubitect/cubiomes-viewer&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans';&quot;&gt;License: &lt;/span&gt;&lt;a href=&quot;https://www.gnu.org/licenses/gpl-3.0.en.html&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0057ae;&quot;&gt;GPLv3&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans';&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans'; font-size:12pt; font-weight:600;&quot;&gt;Components and Legal Information&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:12pt; font-weight:600;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans';&quot;&gt;— Minecraft biome and structure generation from &lt;/span&gt;&lt;a href=&quot;https://github.com/Cubitect/cubiomes/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0057ae;&quot;&gt;cubiomes&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'Sans';&quot;&gt;, licensed under &lt;/span&gt;&lt;a href=&quot;https://mit-license.org/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0057ae;&quot;&gt;MIT&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'Sans';&quot;&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans';&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans';&quot;&gt;— Cross platform GUI toolkit: Qt _QT_MAJOR_._QT_MINOR_, available under &lt;/span&gt;&lt;a href=&quot;https://www.qt.io/licensing/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0057ae;&quot;&gt;(L)GPLv3&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'Sans';&quot;&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:16pt; font-weight:600;&quot;&gt;Cubiomes-Viewer _MAJOR_._MINOR_._PATCH_&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans';&quot;&gt;— Dark Qt theme derived from &lt;/span&gt;&lt;a href=&quot;https://github.com/ColinDuquesnoy/QDarkStyleSheet&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0057ae;&quot;&gt;QDarkStyleSheet&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'Sans';&quot;&gt;, licensed under MIT.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans';&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans';&quot;&gt;— Colors and icons are in part modified from &lt;/span&gt;&lt;a href=&quot;https://github.com/toolbox4minecraft/amidst&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0057ae;&quot;&gt;Amidst&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'Sans';&quot;&gt;, licensed under GPLv3.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans';&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;NOT APPROVED BY OR ASSOCIATED WITH MOJANG.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Built: _DATE_&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;URL: &lt;a href=&quot;https://github.com/Cubitect/cubiomes-viewer&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif'; text-decoration: underline; color:#0057ae;&quot;&gt;https://github.com/Cubitect/cubiomes-viewer&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;License: &lt;a href=&quot;https://www.gnu.org/licenses/gpl-3.0.en.html&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif'; text-decoration: underline; color:#0057ae;&quot;&gt;GPLv3&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;Components and Legal Information&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:12pt; font-weight:600;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;— Minecraft biome and structure generation from &lt;a href=&quot;https://github.com/Cubitect/cubiomes/&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif'; text-decoration: underline; color:#0057ae;&quot;&gt;cubiomes&lt;/span&gt;&lt;/a&gt;, licensed under &lt;a href=&quot;https://mit-license.org/&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif'; text-decoration: underline; color:#0057ae;&quot;&gt;MIT&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;— Cross platform GUI toolkit: Qt _QT_MAJOR_._QT_MINOR_, available under &lt;a href=&quot;https://www.qt.io/licensing/&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif'; text-decoration: underline; color:#0057ae;&quot;&gt;(L)GPLv3&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif';&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;— Dark Qt theme derived from &lt;a href=&quot;https://github.com/ColinDuquesnoy/QDarkStyleSheet&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif'; text-decoration: underline; color:#0057ae;&quot;&gt;QDarkStyleSheet&lt;/span&gt;&lt;/a&gt;, licensed under MIT.&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;— Colors and icons are inspired by &lt;a href=&quot;https://github.com/toolbox4minecraft/amidst&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif'; text-decoration: underline; color:#0057ae;&quot;&gt;Amidst&lt;/span&gt;&lt;/a&gt;, licensed under GPLv3.&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif';&quot;&gt;NOT APPROVED BY OR ASSOCIATED WITH MOJANG.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>

View File

@ -1,13 +1,21 @@
#include "configdialog.h"
#include "ui_configdialog.h"
#include "cutil.h"
#include <QThread>
#include <QFileInfo>
#include <QFileDialog>
ConfigDialog::ConfigDialog(QWidget *parent, Config *config) :
QDialog(parent),
ui(new Ui::ConfigDialog)
{
ui->setupUi(this);
QFont mono = QFont("Monospace", 9);
mono.setStyleHint(QFont::TypeWriter);
ui->buttonBiomeColor->setFont(mono);
ui->lineQueueSize->setValidator(new QIntValidator(1, 9999, ui->lineQueueSize));
ui->lineMatching->setValidator(new QIntValidator(1, 99999999, ui->lineMatching));
for (int i = 0; i < 16; i++)
@ -32,6 +40,8 @@ void ConfigDialog::initSettings(Config *config)
ui->cboxItemSize->setCurrentText(QString::number(config->seedsPerItem));
ui->lineQueueSize->setText(QString::number(config->queueSize));
ui->lineMatching->setText(QString::number(config->maxMatching));
setBiomeColorPath(config->biomeColorPath);
}
Config ConfigDialog::getSettings()
@ -52,6 +62,51 @@ Config ConfigDialog::getSettings()
return conf;
}
void ConfigDialog::setBiomeColorPath(QString path)
{
unsigned char cols[256][3];
initBiomeColors(cols);
QPalette pal = this->palette();
conf.biomeColorPath = path;
if (path.isEmpty())
{
ui->buttonBiomeColor->setText("...");
}
else
{
QFileInfo finfo(path);
QFile file(path);
int n = -1;
if (file.open(QIODevice::ReadOnly))
{
char buf[32*1024];
qint64 siz = file.read(buf, sizeof(buf)-1);
file.close();
if (siz >= 0)
{
buf[siz] = 0;
n = parseBiomeColors(cols, buf);
}
}
if (n >= 0)
{
QString txt = QString::asprintf("[%d biomes] ", n) + finfo.baseName();
ui->buttonBiomeColor->setText(txt);
}
else
{
ui->buttonBiomeColor->setText(finfo.baseName());
pal.setColor(QPalette::ButtonText, QColor(Qt::red));
}
}
ui->buttonBiomeColor->setPalette(pal);
}
void ConfigDialog::on_buttonBox_clicked(QAbstractButton *button)
{
if (ui->buttonBox->buttonRole(button) == QDialogButtonBox::ResetRole)
@ -60,3 +115,20 @@ void ConfigDialog::on_buttonBox_clicked(QAbstractButton *button)
initSettings(&conf);
}
}
void ConfigDialog::on_buttonBiomeColor_clicked()
{
QFileInfo finfo(conf.biomeColorPath);
QString fnam = QFileDialog::getOpenFileName(this, "Load biome color map", finfo.absolutePath(), "Text files (*.txt);;Any files (*)");
if (!fnam.isNull())
{
conf.biomeColorPath = fnam;
setBiomeColorPath(fnam);
}
}
void ConfigDialog::on_buttonClear_clicked()
{
conf.biomeColorPath.clear();
setBiomeColorPath("");
}

View File

@ -24,9 +24,15 @@ public:
Config getSettings();
void setBiomeColorPath(QString path);
private slots:
void on_buttonBox_clicked(QAbstractButton *button);
void on_buttonBiomeColor_clicked();
void on_buttonClear_clicked();
private:
Ui::ConfigDialog *ui;
Config conf;

View File

@ -2,6 +2,14 @@
<ui version="4.0">
<class>ConfigDialog</class>
<widget class="QDialog" name="ConfigDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>433</width>
<height>435</height>
</rect>
</property>
<property name="windowTitle">
<string>Preferences</string>
</property>
@ -10,11 +18,132 @@
<normaloff>:/icons/map.png</normaloff>:/icons/map.png</iconset>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="10" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Maximum number of matching seeds:</string>
<item row="3" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Search</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Size of search item queue:
(limits usable threads)</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Seeds per thread search item:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Maximum number of matching seeds:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineMatching"/>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="cboxItemSize">
<property name="iconSize">
<size>
<width>0</width>
<height>16</height>
</size>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineQueueSize"/>
</item>
</layout>
</widget>
</item>
<item row="0" column="0" rowspan="2" colspan="2">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Interface</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="1">
<widget class="QPushButton" name="buttonBiomeColor">
<property name="text">
<string>[none]</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QComboBox" name="comboStyle">
<property name="iconSize">
<size>
<width>0</width>
<height>16</height>
</size>
</property>
<item>
<property name="text">
<string>System</string>
</property>
</item>
<item>
<property name="text">
<string>Dark</string>
</property>
</item>
</widget>
</item>
<item row="3" column="0" colspan="3">
<widget class="QCheckBox" name="checkBBoxes">
<property name="text">
<string>Outline known bounding boxes</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>GUI style:</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<widget class="QCheckBox" name="checkSmooth">
<property name="toolTip">
<string>Simulate innertia for the map view</string>
</property>
<property name="text">
<string>Smooth map motion</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Biome color customization:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="buttonClear">
<property name="maximumSize">
<size>
<width>20</width>
<height>16777215</height>
</size>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/clear.png</normaloff>:/icons/clear.png</iconset>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="11" column="0" colspan="2">
@ -27,109 +156,43 @@
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Size of search item queue:
(limits usable threads)</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Seeds per thread search item:</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="checkSmooth">
<property name="toolTip">
<string>Simulate innertia for the map view</string>
</property>
<property name="text">
<string>Smooth map motion</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QLineEdit" name="lineQueueSize"/>
</item>
<item row="8" column="1">
<widget class="QComboBox" name="cboxItemSize">
<property name="iconSize">
<size>
<width>0</width>
<height>16</height>
</size>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QLineEdit" name="lineMatching"/>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="checkAutosave">
<property name="text">
<string>Autosave every:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QSpinBox" name="spinAutosave">
<property name="suffix">
<string> min</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>120</number>
</property>
<property name="value">
<number>10</number>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>GUI style:</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QComboBox" name="comboStyle">
<property name="iconSize">
<size>
<width>0</width>
<height>16</height>
</size>
</property>
<item>
<property name="text">
<string>System</string>
</property>
</item>
<item>
<property name="text">
<string>Dark</string>
</property>
</item>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="checkBBoxes">
<property name="text">
<string>Outline known bounding boxes</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="checkRestore">
<property name="text">
<string>Restore previous session at launch</string>
<item row="4" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Session</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0" rowspan="2" colspan="3">
<widget class="QCheckBox" name="checkRestore">
<property name="text">
<string>Restore previous session at launch</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="checkAutosave">
<property name="text">
<string>Autosave every:</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QSpinBox" name="spinAutosave">
<property name="suffix">
<string> min</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>120</number>
</property>
<property name="value">
<number>10</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>

View File

@ -18,7 +18,7 @@ inline const char* struct2str(int stype)
switch (stype)
{
case Desert_Pyramid: return "desert_pyramid";
case Jungle_Pyramid: return "jungle_pyramid";
case Jungle_Temple: return "jungle_temple";
case Swamp_Hut: return "swamp_hut";
case Igloo: return "igloo";
case Village: return "village";

View File

@ -15,7 +15,7 @@
#define SETUP_BIOME_CHECKBOX(B) do {\
biomecboxes[B] = new QCheckBox(#B);\
biomecboxes[B] = new QCheckBox(biome2str(mc, B));\
ui->gridLayoutBiomes->addWidget(biomecboxes[B], (B) % 128, (B) / 128);\
biomecboxes[B]->setTristate(true);\
} while (0)
@ -35,10 +35,10 @@ static QString getTip(int mc, int layer, int id)
QString tip = "Generates any of:";
for (int j = 0; j < 64; j++)
if (mL & (1ULL << j))
tip += QString("\n") + biome2str(j);
tip += QString("\n") + biome2str(mc, j);
for (int j = 0; j < 64; j++)
if (mM & (1ULL << j))
tip += QString("\n") + biome2str(128+j);
tip += QString("\n") + biome2str(mc, 128+j);
return tip;
}
@ -490,12 +490,12 @@ void FilterDialog::updateBiomeSelection()
for (int j = 0; j < 64; j++)
{
if (mL & (1ULL << j))
tip += QString("\n") + biome2str(j);
tip += QString("\n") + biome2str(mc, j);
}
for (int j = 0; j < 64; j++)
{
if (mM & (1ULL << j))
tip += QString("\n") + biome2str(j+128);
tip += QString("\n") + biome2str(mc, j+128);
}
cb->setToolTip(tip);
}

View File

@ -312,6 +312,7 @@ void MainWindow::saveSettings()
settings.setValue("config/seedsPerItem", config.seedsPerItem);
settings.setValue("config/queueSize", config.queueSize);
settings.setValue("config/maxMatching", config.maxMatching);
settings.setValue("config/biomeColorPath", config.biomeColorPath);
settings.setValue("world/saltOverride", g_extgen.saltOverride);
for (int st = 0; st < FEATURE_NUM; st++)
@ -382,6 +383,10 @@ void MainWindow::loadSettings()
config.seedsPerItem = settings.value("config/seedsPerItem", config.seedsPerItem).toInt();
config.queueSize = settings.value("config/queueSize", config.queueSize).toInt();
config.maxMatching = settings.value("config/maxMatching", config.maxMatching).toInt();
config.biomeColorPath = settings.value("config/biomeColorPath", config.biomeColorPath).toString();
if (!config.biomeColorPath.isEmpty())
onBiomeColorChange();
ui->mapView->setShowBB(config.showBBoxes);
ui->mapView->setSmoothMotion(config.smoothMotion);
@ -725,9 +730,36 @@ void MainWindow::on_actionPreferences_triggered()
{
autosaveTimer.stop();
}
if (!config.biomeColorPath.isEmpty() || !oldConfig.biomeColorPath.isEmpty())
{
onBiomeColorChange();
}
}
}
void MainWindow::onBiomeColorChange()
{
QFile file(config.biomeColorPath);
if (file.open(QIODevice::ReadOnly))
{
char buf[32*1024];
qint64 siz = file.read(buf, sizeof(buf)-1);
file.close();
if (siz >= 0)
{
buf[siz] = 0;
initBiomeColors(biomeColors);
parseBiomeColors(biomeColors, buf);
}
}
else
{
initBiomeColors(biomeColors);
}
ui->mapView->refresh();
}
void MainWindow::on_actionGo_to_triggered()
{
GotoDialog *dialog = new GotoDialog(this, ui->mapView->getX(), ui->mapView->getZ(), ui->mapView->getScale());
@ -972,7 +1004,7 @@ void MainWindow::on_buttonAnalysis_clicked()
if (cnt <= 0)
continue;
const char *s;
if (!(s = biome2str(id)))
if (!(s = biome2str(wi.mc, id)))
continue;
QTreeWidgetItem* item =
new QTreeWidgetItem(item_cat, QTreeWidgetItem::UserType + id);

View File

@ -104,6 +104,7 @@ private slots:
void onSelectedSeedChanged(uint64_t seed);
void onSearchStatusChanged(bool running);
void onStyleChanged(int style);
void onBiomeColorChange();
void copyCoord();
void copyTeleportCommand();

View File

@ -818,7 +818,7 @@ QToolButton:checked {
</action>
<action name="actionExtGen">
<property name="text">
<string>World settings...</string>
<string>Advanced world settings...</string>
</property>
</action>
</widget>

View File

@ -22,8 +22,6 @@ bool MapOverlay::event(QEvent *e)
void MapOverlay::paintEvent(QPaintEvent *)
{
QPainter painter(this);
const char *bname = biome2str(id);
if (bname)
{
QString s = QString::asprintf("%s [%d,%d]", bname, pos.x, pos.z);
@ -78,6 +76,17 @@ void MapView::deleteWorld()
world = NULL;
}
void MapView::refresh()
{
if (world)
{
WorldInfo wi = world->wi;
int dim = world->dim;
delete world;
world = new QWorld(wi, dim);
}
}
void MapView::setSeed(WorldInfo wi, int dim)
{
prevx = focusx = getX();
@ -203,7 +212,7 @@ void MapView::paintEvent(QPaintEvent *)
qreal bz = (cur.y() - height()/2.0) / blocks2pix + fz;
Pos p = {(int)bx, (int)bz};
overlay->pos = p;
overlay->id = world->getBiome(p);
overlay->bname = biome2str(world->wi.mc, world->getBiome(p));
if (QThreadPool::globalInstance()->activeThreadCount() > 0 || velx || velz)
updatecounter = 2;

View File

@ -12,7 +12,7 @@ class MapOverlay : public QWidget
public:
explicit MapOverlay(QWidget *parent = nullptr)
: QWidget(parent),pos{},id(-1) {}
: QWidget(parent),pos{},bname(nullptr) {}
~MapOverlay() {}
public slots:
@ -21,7 +21,7 @@ public slots:
public:
Pos pos;
int id;
const char *bname;
};
class MapView : public QWidget
@ -37,6 +37,7 @@ public:
qreal getScale() const { return 1.0 / blocks2pix; }
void deleteWorld();
void refresh();
void setSeed(WorldInfo wi, int dim);
void setView(qreal x, qreal z, qreal scale = 0);

View File

@ -459,27 +459,24 @@ L_qm_any:
continue;
if (pc.x < x1 || pc.x > x2 || pc.z < z1 || pc.z > z2)
continue;
if (pass < PASS_FULL_48 || (pass == PASS_FAST_48 && finfo.dim == 0))
if (pass == PASS_FULL_64 || (pass == PASS_FULL_48 && !finfo.dep64))
{
xt += pc.x;
zt += pc.z;
n++;
continue;
}
gen->init4Dim(finfo.dim);
if (!isViableStructurePos(st, &gen->g, pc.x, pc.z, 0))
continue;
if (st == End_City)
{
gen->setSurfaceNoise();
if (!isViableEndCityTerrain(
&gen->g.en, &gen->sn, pc.x, pc.z))
continue;
}
else if (gen->mc >= MC_1_18)
{
if (!isViableStructureTerrain(st, &gen->g, pc.x, pc.z))
if (*abort) return COND_FAILED;
gen->init4Dim(finfo.dim);
if (!isViableStructurePos(st, &gen->g, pc.x, pc.z, 0))
continue;
if (st == End_City)
{
gen->setSurfaceNoise();
if (!isViableEndCityTerrain(
&gen->g.en, &gen->sn, pc.x, pc.z))
continue;
}
else if (gen->mc >= MC_1_18)
{
if (!isViableStructureTerrain(st, &gen->g, pc.x, pc.z))
continue;
}
}
xt += pc.x;
zt += pc.z;
@ -492,14 +489,13 @@ L_qm_any:
cent->x = xt / n;
cent->z = zt / n;
if (pass != PASS_FULL_64 && finfo.dep64)
{ // some non-exhaustive structure clusters do not
// have known center positions with 48-bit seeds
if (cond->count != (1+rx2-rx1) * (1+rz2-rz1))
return COND_MAYBE_POS_INVAL;
return COND_MAYBE_POS_VALID;
}
return COND_OK;
if (pass == PASS_FULL_64 || (pass == PASS_FULL_48 && !finfo.dep64))
return COND_OK;
// some non-exhaustive structure clusters do not
// have known center positions with 48-bit seeds
if (cond->count != (1+rx2-rx1) * (1+rz2-rz1))
return COND_MAYBE_POS_INVAL;
return COND_MAYBE_POS_VALID;
}
return COND_FAILED;
@ -741,11 +737,8 @@ L_noise_biome:
return COND_MAYBE_POS_VALID;
// the Nether and End require only the 48-bit seed
// (except voronoi uses the full 64-bits)
if (pass == PASS_FULL_48)
{
if (s == 0 || finfo.dim == 0)
return COND_MAYBE_POS_VALID;
}
if (pass == PASS_FULL_48 && finfo.dep64)
return COND_MAYBE_POS_VALID;
rx1 = ((cond->x1 << s) + at.x) >> s;
rz1 = ((cond->z1 << s) + at.z) >> s;
rx2 = ((cond->x2 << s) + at.x) >> s;

View File

@ -58,6 +58,7 @@ struct Config
int seedsPerItem;
int queueSize;
int maxMatching;
QString biomeColorPath;
Config() { reset(); }
@ -71,6 +72,7 @@ struct Config
seedsPerItem = 64;
queueSize = QThread::idealThreadCount();
maxMatching = 65536;
biomeColorPath = "";
}
};