Skip to content

Commit

Permalink
Added some bounding boxes and quad structure fix
Browse files Browse the repository at this point in the history
1) added bounding box outline to map view for some structures
2) added quad-structure indicators to map view
3) added spawn area to quad-structure dialog
4) fixed some incorrect values for quad-monument area
5) fixed end gateways for 1.17
  • Loading branch information
Cubitect committed Jul 21, 2021
1 parent 9179eed commit 4805092
Show file tree
Hide file tree
Showing 19 changed files with 420 additions and 292 deletions.
2 changes: 1 addition & 1 deletion cubiomes
Submodule cubiomes updated 1 files
+7 −2 finders.c
2 changes: 2 additions & 0 deletions src/configdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ ConfigDialog::~ConfigDialog()
void ConfigDialog::initSettings(Config *config)
{
ui->checkSmooth->setChecked(config->smoothMotion);
ui->checkBBoxes->setChecked(config->showBBoxes);
ui->checkRestore->setChecked(config->restoreSession);
ui->checkAutosave->setChecked(config->autosaveCycle != 0);
if (config->autosaveCycle)
Expand All @@ -36,6 +37,7 @@ void ConfigDialog::initSettings(Config *config)
Config ConfigDialog::getSettings()
{
conf.restoreSession = ui->checkRestore->isChecked();
conf.showBBoxes = ui->checkBBoxes->isChecked();
conf.autosaveCycle = ui->checkAutosave->isChecked() ? ui->spinAutosave->value() : 0;
conf.smoothMotion = ui->checkSmooth->isChecked();
conf.uistyle = ui->comboStyle->currentIndex();
Expand Down
51 changes: 25 additions & 26 deletions src/configdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@
<ui version="4.0">
<class>ConfigDialog</class>
<widget class="QDialog" name="ConfigDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>411</width>
<height>252</height>
</rect>
</property>
<property name="windowTitle">
<string>Preferences</string>
</property>
Expand All @@ -18,14 +10,14 @@
<normaloff>:/icons/map.png</normaloff>:/icons/map.png</iconset>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="8" column="0">
<item row="10" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Maximum number of matching seeds:</string>
</property>
</widget>
</item>
<item row="9" column="0" colspan="2">
<item row="11" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
Expand All @@ -35,15 +27,15 @@
</property>
</widget>
</item>
<item row="7" column="0">
<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="6" column="0">
<item row="8" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Seeds per thread search item:</string>
Expand All @@ -60,17 +52,10 @@
</property>
</widget>
</item>
<item row="7" column="1">
<item row="9" column="1">
<widget class="QLineEdit" name="lineQueueSize"/>
</item>
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="checkRestore">
<property name="text">
<string>Restore previous session at launch</string>
</property>
</widget>
</item>
<item row="6" column="1">
<item row="8" column="1">
<widget class="QComboBox" name="cboxItemSize">
<property name="iconSize">
<size>
Expand All @@ -80,17 +65,17 @@
</property>
</widget>
</item>
<item row="8" column="1">
<item row="10" column="1">
<widget class="QLineEdit" name="lineMatching"/>
</item>
<item row="4" column="0">
<item row="6" column="0">
<widget class="QCheckBox" name="checkAutosave">
<property name="text">
<string>Autosave every:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<item row="6" column="1">
<widget class="QSpinBox" name="spinAutosave">
<property name="suffix">
<string> min</string>
Expand All @@ -106,14 +91,14 @@
</property>
</widget>
</item>
<item row="5" column="0">
<item row="7" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>GUI style:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<item row="7" column="1">
<widget class="QComboBox" name="comboStyle">
<property name="iconSize">
<size>
Expand All @@ -133,6 +118,20 @@
</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>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
Expand Down
53 changes: 49 additions & 4 deletions src/formgen48.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,48 @@
#include <QFileDialog>
#include <QFileInfo>
#include <QMessageBox>
#include <QSpinBox>
#include <QList>

#include <set>

class SetSpinBox : public QSpinBox
{
public:
SetSpinBox(QWidget *parent)
: QSpinBox(parent)
{
std::set<int> vset;
for (int i = 0, n = sizeof(g_qm_90) / sizeof(int64_t); i < n; i++)
vset.insert(qmonumentQual(g_qm_90[i]));
for (int v : vset)
vlist.push_back(v);

setRange(vlist.front(), vlist.last());
setValue(vlist.front());
}
virtual ~SetSpinBox() {}

virtual void stepBy(int steps) override
{
int val = value();
int idx = 0;
for (int i = 0, n = vlist.size(); i < n; i++)
{
if (vlist[i] > val)
break;
idx = i;
}
idx += steps;
if (idx < 0)
idx = 0;
if (idx >= vlist.size())
idx = vlist.size() - 1;
setValue(vlist[idx]);
}

QList<int> vlist;
};

FormGen48::FormGen48(MainWindow *parent)
: QWidget(parent)
Expand All @@ -29,7 +70,10 @@ FormGen48::FormGen48(MainWindow *parent)
connect(ui->lineEditX2, SIGNAL(editingFinished()), SLOT(onChange()));
connect(ui->lineEditZ2, SIGNAL(editingFinished()), SLOT(onChange()));

connect(ui->spinMonumentArea, SIGNAL(editingFinished()), SLOT(onChange()));
spinMonumentArea = new SetSpinBox(this);
ui->tabQuadM->layout()->addWidget(spinMonumentArea);

connect(spinMonumentArea, SIGNAL(editingFinished()), SLOT(onChange()));
connect(ui->lineSalt, SIGNAL(editingFinished()), SLOT(onChange()));
connect(ui->lineListSalt, SIGNAL(editingFinished()), SLOT(onChange()));

Expand All @@ -45,6 +89,7 @@ FormGen48::FormGen48(MainWindow *parent)
FormGen48::~FormGen48()
{
delete ui;
delete spinMonumentArea;
}

bool FormGen48::setList48(QString path, bool quiet)
Expand Down Expand Up @@ -89,7 +134,7 @@ void FormGen48::setSettings(const Gen48Settings& gen48, bool quiet)
{
ui->tabWidget->setCurrentIndex(gen48.mode);
ui->comboLow20->setCurrentIndex(gen48.qual);
ui->spinMonumentArea->setValue(gen48.qmarea);
spinMonumentArea->setValue(gen48.qmarea);
ui->lineSalt->setText(QString::number(gen48.salt));
ui->lineListSalt->setText(QString::number(gen48.listsalt));
ui->lineEditX1->setText(QString::number(gen48.x1));
Expand All @@ -113,7 +158,7 @@ Gen48Settings FormGen48::getSettings(bool resolveauto)

s.mode = ui->tabWidget->currentIndex();
s.qual = ui->comboLow20->currentIndex();
s.qmarea = ui->spinMonumentArea->value();
s.qmarea = spinMonumentArea->value();
s.salt = ui->lineSalt->text().toLongLong();
s.listsalt = ui->lineListSalt->text().toLongLong();
s.manualarea = ui->radioManual->isChecked();
Expand Down Expand Up @@ -238,7 +283,7 @@ void FormGen48::updateAutoUi()
if (isqh)
ui->comboLow20->setCurrentIndex(cond.type - F_QH_IDEAL);
else if (isqm)
ui->spinMonumentArea->setValue((int) ceil( 58*58*4 * (cond.type == F_QM_95 ? 0.95 : 0.90) ));
spinMonumentArea->setValue((int) ceil( 58*58*4 * (cond.type == F_QM_95 ? 0.95 : 0.90) ));
}
if (ui->radioAuto->isChecked())
{
Expand Down
2 changes: 2 additions & 0 deletions src/formgen48.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class FormGen48;
}

class MainWindow;
class SetSpinBox;

class FormGen48 : public QWidget
{
Expand Down Expand Up @@ -52,6 +53,7 @@ private slots:
private:
MainWindow *parent;
Ui::FormGen48 *ui;
SetSpinBox *spinMonumentArea;

// main condition for "auto" mode (updated when conditions change)
Condition cond;
Expand Down
Loading

0 comments on commit 4805092

Please sign in to comment.