Added village types + dimension scaling + bb + updated gateways

* added village type selector to filters
* added helper for coordinate multiplication of cross-dimension relative locations
* added 1.18 villages, outposts and bastions to known bounding boxes
* updated end gateways for 1.18
This commit is contained in:
Cubitect 2021-12-07 00:15:54 +01:00
parent 5738afc782
commit 24f75e2758
7 changed files with 500 additions and 381 deletions

@ -1 +1 @@
Subproject commit fa3ed2af5961d6129aceb15974e05402a2db06d8
Subproject commit d22f71f2e2a621fc05bf96a1f6ee21faca85dcf6

View File

@ -335,9 +335,8 @@ FilterDialog::FilterDialog(FormConditions *parent, Config *config, int mcversion
}
}
ui->scrollVariants->setEnabled(cond.variants & (1ULL << 63));
ui->checkStartPiece->setChecked(cond.variants & (1ULL << 63));
ui->checkAbandoned->setChecked(cond.variants & (1ULL << 62));
ui->checkStartPiece->setChecked(cond.variants & Condition::START_PIECE_MASK);
ui->checkAbandoned->setChecked(cond.variants & Condition::ABANDONED_MASK);
for (VariantCheckBox *cb : variantboxes)
{
cb->setChecked(cond.variants & cb->getMask());
@ -374,12 +373,12 @@ void FilterDialog::updateMode()
ui->labelSquareArea->setEnabled(!custom && ft.area);
ui->lineRadius->setEnabled(!custom && ft.area);
ui->labelX1->setEnabled((custom && ft.coord) || !ft.area);
ui->labelZ1->setEnabled((custom && ft.coord) || !ft.area);
ui->labelX1->setEnabled(ft.coord && (custom || !ft.area));
ui->labelZ1->setEnabled(ft.coord && (custom || !ft.area));
ui->labelX2->setEnabled(custom && ft.area);
ui->labelZ2->setEnabled(custom && ft.area);
ui->lineEditX1->setEnabled((custom && ft.coord) || !ft.area);
ui->lineEditZ1->setEnabled((custom && ft.coord) || !ft.area);
ui->lineEditX1->setEnabled(ft.coord && (custom || !ft.area));
ui->lineEditZ1->setEnabled(ft.coord && (custom || !ft.area));
ui->lineEditX2->setEnabled(custom && ft.area);
ui->lineEditZ2->setEnabled(custom && ft.area);
@ -421,6 +420,9 @@ void FilterDialog::updateMode()
ui->tabVariants->setEnabled(false);
}
ui->checkStartPiece->setEnabled(mc >= MC_1_14);
ui->scrollVariants->setEnabled(mc >= MC_1_14 && (cond.variants & Condition::START_PIECE_MASK));
updateBiomeSelection();
QString loc = "";
@ -570,6 +572,16 @@ void FilterDialog::updateBiomeSelection()
int FilterDialog::warnIfBad(Condition cond)
{
const FilterInfo &ft = g_filterinfo.list[cond.type];
if (ui->scrollVariants->isEnabled())
{
if ((cond.variants & ((1ULL << 60) - 1)) == 0)
{
QString text =
"No allowed start pieces specified. Condition can never be true.";
QMessageBox::warning(this, "Invalid condition", text, QMessageBox::Ok);
return QMessageBox::Cancel;
}
}
if (ft.cat == CAT_BIOMES)
{
int w = cond.x2 - cond.x1 + 1;
@ -714,8 +726,9 @@ void FilterDialog::on_buttonOk_clicked()
cond.approx = ui->checkApprox->isChecked();
cond.variants = (1ULL << 63) * ui->checkStartPiece->isChecked();
cond.variants = (1ULL << 62) * ui->checkAbandoned->isChecked();
cond.variants = 0;
cond.variants |= ui->checkStartPiece->isChecked() * Condition::START_PIECE_MASK;
cond.variants |= ui->checkAbandoned->isChecked() * Condition::ABANDONED_MASK;
for (VariantCheckBox *cb : variantboxes)
if (cb->isChecked())
cond.variants |= cb->getMask();
@ -780,3 +793,4 @@ void FilterDialog::on_checkStartPiece_stateChanged(int state)
{
ui->scrollVariants->setEnabled(state);
}

View File

@ -14,353 +14,7 @@
<string>New Filter</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="4" column="0" colspan="2">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<property name="usesScrollButtons">
<bool>false</bool>
</property>
<widget class="QWidget" name="tabBiomes">
<attribute name="title">
<string>Biomes</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4">
<item row="1" column="3">
<widget class="QLineEdit" name="lineY">
<property name="toolTip">
<string>Vertical position in blocks</string>
</property>
<property name="text">
<string>63</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkApprox">
<property name="toolTip">
<string>Enables optimizations that trade accuracy for speed</string>
</property>
<property name="text">
<string>Approximate</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="labelY">
<property name="text">
<string>Sample at height (Y):</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="4">
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollBiomes">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>562</width>
<height>270</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="sizeConstraint">
<enum>QLayout::SetMinAndMaxSize</enum>
</property>
<item>
<layout class="QGridLayout" name="gridLayoutBiomes"/>
</item>
</layout>
</widget>
</widget>
</item>
<item row="2" column="0" colspan="4">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QPushButton" name="buttonUncheck">
<property name="text">
<string>uncheck all</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="buttonInclude">
<property name="text">
<string>include all</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="buttonExclude">
<property name="text">
<string>exclude all</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabTemps">
<attribute name="title">
<string>Temperature Categories</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Select how many entries of each temperature category are required.</string>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayoutTemps"/>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabVariants">
<attribute name="title">
<string>Variant</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="1">
<widget class="QCheckBox" name="checkAbandoned">
<property name="text">
<string>Abandoned</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="checkStartPiece">
<property name="text">
<string>Filter structure start pieces</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QScrollArea" name="scrollVariants">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_2">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>562</width>
<height>303</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QGridLayout" name="gridLayoutVariants"/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QGroupBox" name="groupBoxPosition">
<property name="title">
<string>Location</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="4" column="0">
<widget class="QLabel" name="labelRelative">
<property name="text">
<string>Location is relative to:</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QSpinBox" name="spinBox">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>99</number>
</property>
</widget>
</item>
<item row="4" column="1" colspan="2">
<widget class="QComboBox" name="comboBoxRelative">
<item>
<property name="text">
<string>World origin</string>
</property>
</item>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineRadius">
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QCheckBox" name="buttonArea">
<property name="toolTip">
<string>Specify manual rectangle rather than square</string>
</property>
<property name="text">
<string>Custom area</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="labelSpinBox">
<property name="text">
<string>Instances within area:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelSquareArea">
<property name="text">
<string>Within centred square of side:</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="labelX1">
<property name="toolTip">
<string>Lower bound (inclusive)</string>
</property>
<property name="text">
<string>X&lt;sub&gt;1&lt;/sub&gt;:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditX1">
<property name="toolTip">
<string>Lower bound (inclusive)</string>
</property>
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelZ1">
<property name="toolTip">
<string>Lower bound (inclusive)</string>
</property>
<property name="text">
<string>Z&lt;sub&gt;1&lt;/sub&gt;:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditZ1">
<property name="toolTip">
<string>Lower bound (inclusive)</string>
</property>
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="labelX2">
<property name="toolTip">
<string>Upper bound (inclusive)</string>
</property>
<property name="text">
<string>X&lt;sub&gt;2&lt;/sub&gt;:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditX2">
<property name="toolTip">
<string>Upper bound (inclusive)</string>
</property>
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelZ2">
<property name="toolTip">
<string>Upper bound (inclusive)</string>
</property>
<property name="text">
<string>Z&lt;sub&gt;2&lt;/sub&gt;:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditZ2">
<property name="toolTip">
<string>Upper bound (inclusive)</string>
</property>
<property name="text">
<string>0</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="0" column="0" colspan="2">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="labelMC">
@ -498,7 +152,368 @@
</item>
</layout>
</item>
<item row="6" column="0" rowspan="3" colspan="2">
<item row="1" column="0">
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<widget class="Collapsible" name="collapseDescription" native="true"/>
<widget class="QWidget" name="layoutWidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBoxPosition">
<property name="title">
<string>Location</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="4" column="0">
<widget class="QLabel" name="labelRelative">
<property name="text">
<string>Location is relative to:</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QSpinBox" name="spinBox">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>99</number>
</property>
</widget>
</item>
<item row="4" column="1" colspan="2">
<widget class="QComboBox" name="comboBoxRelative">
<item>
<property name="text">
<string>World origin</string>
</property>
</item>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineRadius">
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QCheckBox" name="buttonArea">
<property name="toolTip">
<string>Specify manual rectangle rather than square</string>
</property>
<property name="text">
<string>Custom area</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="labelSpinBox">
<property name="text">
<string>Instances within area:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelSquareArea">
<property name="text">
<string>Within centred square of side:</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="labelX1">
<property name="toolTip">
<string>Lower bound (inclusive)</string>
</property>
<property name="text">
<string>X&lt;sub&gt;1&lt;/sub&gt;:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditX1">
<property name="toolTip">
<string>Lower bound (inclusive)</string>
</property>
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelZ1">
<property name="toolTip">
<string>Lower bound (inclusive)</string>
</property>
<property name="text">
<string>Z&lt;sub&gt;1&lt;/sub&gt;:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditZ1">
<property name="toolTip">
<string>Lower bound (inclusive)</string>
</property>
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="labelX2">
<property name="toolTip">
<string>Upper bound (inclusive)</string>
</property>
<property name="text">
<string>X&lt;sub&gt;2&lt;/sub&gt;:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditX2">
<property name="toolTip">
<string>Upper bound (inclusive)</string>
</property>
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelZ2">
<property name="toolTip">
<string>Upper bound (inclusive)</string>
</property>
<property name="text">
<string>Z&lt;sub&gt;2&lt;/sub&gt;:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditZ2">
<property name="toolTip">
<string>Upper bound (inclusive)</string>
</property>
<property name="text">
<string>0</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<property name="usesScrollButtons">
<bool>false</bool>
</property>
<widget class="QWidget" name="tabBiomes">
<attribute name="title">
<string>Biomes</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4">
<item row="1" column="3">
<widget class="QLineEdit" name="lineY">
<property name="toolTip">
<string>Vertical position in blocks</string>
</property>
<property name="text">
<string>63</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkApprox">
<property name="toolTip">
<string>Enables optimizations that trade accuracy for speed</string>
</property>
<property name="text">
<string>Approximate</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="labelY">
<property name="text">
<string>Sample at height (Y):</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="4">
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollBiomes">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>568</width>
<height>249</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="sizeConstraint">
<enum>QLayout::SetMinAndMaxSize</enum>
</property>
<item>
<layout class="QGridLayout" name="gridLayoutBiomes"/>
</item>
</layout>
</widget>
</widget>
</item>
<item row="2" column="0" colspan="4">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QPushButton" name="buttonUncheck">
<property name="text">
<string>uncheck all</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="buttonInclude">
<property name="text">
<string>include all</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="buttonExclude">
<property name="text">
<string>exclude all</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabTemps">
<attribute name="title">
<string>Temperature Categories</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Select how many entries of each temperature category are required.</string>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayoutTemps"/>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabVariants">
<attribute name="title">
<string>Variant</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="1">
<widget class="QCheckBox" name="checkAbandoned">
<property name="text">
<string>Abandoned</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="checkStartPiece">
<property name="toolTip">
<string>Allow only structures that start with one of the selected pieces</string>
</property>
<property name="text">
<string>Filter starting piece</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QScrollArea" name="scrollVariants">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_2">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>568</width>
<height>285</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QGridLayout" name="gridLayoutVariants"/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer_2">
@ -520,7 +535,8 @@
</property>
<property name="icon">
<iconset theme="dialog-cancel">
<normaloff>.</normaloff>.</iconset>
<normaloff/>
</iconset>
</property>
</widget>
</item>
@ -531,15 +547,13 @@
</property>
<property name="icon">
<iconset theme="dialog-ok">
<normaloff>.</normaloff>.</iconset>
<normaloff/>
</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0" colspan="2">
<widget class="Collapsible" name="collapseDescription" native="true"/>
</item>
</layout>
</widget>
<customwidgets>

View File

@ -69,11 +69,29 @@ void getStructs(std::vector<VarPos> *out, const StructureConfig sconf,
continue;
}
VarPos vp = { p, 0 };
VarPos vp = VarPos(p);
StructureVariant sv = {};
if (sconf.structType == Village)
{
StructureVariant vt = getVillageType(wi.mc, wi.seed, p.x, p.z, id);
vp.variant = vt.abandoned;
sv = getVillageType(wi.mc, wi.seed, p.x, p.z, id);
vp.variant = sv.abandoned;
}
else if (sconf.structType == Bastion)
{
sv = getBastionType(wi.mc, wi.seed, p.x, p.z);
}
else if (sconf.structType == Outpost && wi.mc >= MC_1_18)
{
sv.sx = sv.sz = 16;
}
if (sv.sx || sv.sz)
{
switch (sv.rotation) {
case 0: vp.sx = +sv.sx; vp.sz = +sv.sz; break;
case 1: vp.sx = -sv.sz; vp.sz = +sv.sx; break;
case 2: vp.sx = -sv.sx; vp.sz = -sv.sz; break;
case 3: vp.sx = +sv.sz; vp.sz = -sv.sx; break;
}
}
out->push_back(vp);
}
@ -701,7 +719,7 @@ void QWorld::draw(QPainter& painter, int vw, int vh, qreal focusx, qreal focusz,
if (showBB && blocks2pix > 1.0)
{
int sx = 0, sz = 0;
int sx = vp.sx, sz = vp.sz;
if (sopt == D_DESERT)
{
sx = 21; sz = 21;

View File

@ -130,7 +130,9 @@ struct Level;
struct VarPos
{
VarPos(Pos p) : p(p),sx(),sz(),variant() {}
Pos p;
int sx, sz;
int variant;
};

View File

@ -116,7 +116,7 @@ int testSeedAt(
int rx1, rz1, rx2, rz2;
int sref;
int sref = -1;
switch (c->type)
{
@ -133,11 +133,11 @@ int testSeedAt(
rz2 = ((c->z2 << sref) + at.z) >> sref;
break;
default:
sref = 0;
sref = -1;
break;
}
if (sref)
if (sref >= 0)
{
// helper condition -
// iterating over an area at a given scale with recursion
@ -171,6 +171,20 @@ int testSeedAt(
}
}
}
else if (c->type == F_SCALE_TO_NETHER)
{
states[sav] = COND_OK;
cpos[sav].x = cpos[rel].x / 8;
cpos[sav].z = cpos[rel].z / 8;
st = testCondAt(cpos[sav], cpos+sav, c, pass, gen, abort);
}
else if (c->type == F_SCALE_TO_OVERWORLD)
{
states[sav] = COND_OK;
cpos[sav].x = cpos[rel].x * 8;
cpos[sav].z = cpos[rel].z * 8;
st = testCondAt(cpos[sav], cpos+sav, c, pass, gen, abort);
}
else
{
st = testCondAt(cpos[rel], cpos+sav, c, pass, gen, abort);
@ -310,6 +324,8 @@ testCondAt(
case F_REFERENCE_256:
case F_REFERENCE_512:
case F_REFERENCE_1024:
case F_SCALE_TO_NETHER:
case F_SCALE_TO_OVERWORLD:
// helper conditions should not reach here
//exit(1);
return COND_OK;
@ -462,8 +478,29 @@ L_qm_any:
if (pass == PASS_FULL_64 || (pass == PASS_FULL_48 && !finfo.dep64))
{
if (*abort) return COND_FAILED;
if (st == Village && cond->variants)
{
int vv[] = {
plains, desert, savanna, taiga, snowy_tundra,
// plains village variant covers meadows
};
int vn = sizeof(vv) / sizeof(int);
int i;
for (i = 0; i < vn; i++)
{
StructureVariant vt = getVillageType(
gen->mc, gen->seed, pc.x, pc.z, vv[i]);
if (cond->villageOk(gen->mc, vt))
break;
}
if (i >= vn) // no suitable village variants here
continue;
}
gen->init4Dim(finfo.dim);
if (!isViableStructurePos(st, &gen->g, pc.x, pc.z, 0))
int id = isViableStructurePos(st, &gen->g, pc.x, pc.z, 0);
if (!id)
continue;
if (st == End_City)
{
@ -472,7 +509,17 @@ L_qm_any:
&gen->g.en, &gen->sn, pc.x, pc.z))
continue;
}
else if (gen->mc >= MC_1_18)
else if (st == Village)
{
if (cond->variants)
{
StructureVariant vt = getVillageType(
gen->mc, gen->seed, pc.x, pc.z, id);
if (!cond->villageOk(gen->mc, vt))
continue;
}
}
if (gen->mc >= MC_1_18)
{
if (!isViableStructureTerrain(st, &gen->g, pc.x, pc.z))
continue;

View File

@ -94,7 +94,9 @@ enum
F_REFERENCE_256,
F_REFERENCE_512,
F_REFERENCE_1024,
F_BIOME_4, // differs from F_BIOME_4_RIVER, as this may include oceans
F_BIOME_4, // differs from F_BIOME_4_RIVER, since this may include oceans
F_SCALE_TO_NETHER,
F_SCALE_TO_OVERWORLD,
// new filters should be added here at the end to keep some downwards compatibility
FILTER_MAX,
};
@ -126,7 +128,7 @@ static const struct FilterList
"Example - \"Double Swamp Hut\":"
"</p><table>"
"<tr><td>[1]</td><td width=\"10\"/><td>"
"Reference Point with scale 1:512 for a square of side 3."
"Reference point with scale 1:512 for a square of side 3."
"</td></tr><tr><td/><td/><td>"
"(traverses the structure regions for the range -1024 to 1023)"
"</td></tr><tr><td>[2]</td><td/><td>"
@ -142,39 +144,51 @@ static const struct FilterList
list[F_REFERENCE_1] = FilterInfo{
CAT_HELPER, 0, 1, 1, 0, 0, 1, 0, MC_1_0, MC_NEWEST, 0, 0, disp++,
":icons/reference.png",
"Reference Point 1:1",
"Reference point 1:1",
ref_desc
};
list[F_REFERENCE_16] = FilterInfo{
CAT_HELPER, 0, 1, 1, 0, 0, 16, 0, MC_1_0, MC_NEWEST, 0, 0, disp++,
":icons/reference.png",
"Reference Point 1:16",
"Reference point 1:16",
ref_desc
};
list[F_REFERENCE_64] = FilterInfo{
CAT_HELPER, 0, 1, 1, 0, 0, 64, 0, MC_1_0, MC_NEWEST, 0, 0, disp++,
":icons/reference.png",
"Reference Point 1:64",
"Reference point 1:64",
ref_desc
};
list[F_REFERENCE_256] = FilterInfo{
CAT_HELPER, 0, 1, 1, 0, 0, 256, 0, MC_1_0, MC_NEWEST, 0, 0, disp++,
":icons/reference.png",
"Reference Point 1:256",
"Reference point 1:256",
ref_desc
};
list[F_REFERENCE_512] = FilterInfo{
CAT_HELPER, 0, 1, 1, 0, 0, 512, 0, MC_1_0, MC_NEWEST, 0, 0, disp++,
":icons/reference.png",
"Reference Point 1:512",
"Reference point 1:512",
ref_desc
};
list[F_REFERENCE_1024] = FilterInfo{
CAT_HELPER, 0, 1, 1, 0, 0, 1024, 0, MC_1_0, MC_NEWEST, 0, 0, disp++,
":icons/reference.png",
"Reference Point 1:1024",
"Reference point 1:1024",
ref_desc
};
list[F_SCALE_TO_NETHER] = FilterInfo{
CAT_HELPER, 0, 0, 0, 0, 0, 1, 0, MC_1_0, MC_NEWEST, 0, 0, disp++,
":icons/portal.png",
"Coordinate factor x/8",
"Divides relative location by 8, from Overworld to Nether."
};
list[F_SCALE_TO_OVERWORLD] = FilterInfo{
CAT_HELPER, 0, 0, 0, 0, 0, 1, 0, MC_1_0, MC_NEWEST, 0, 0, disp++,
":icons/portal.png",
"Coordinate factor x*8",
"Multiplies relative location by 8, from Nether to Overworld."
};
list[F_QH_IDEAL] = FilterInfo{
CAT_QUAD, 0, 1, 1, 0, Swamp_Hut, 512, 0, MC_1_4, MC_NEWEST, 0, 0, disp++,
@ -519,7 +533,10 @@ struct Condition
int pad; // unused
uint64_t variants;
enum { // variant flags
START_PIECE_MASK = (1ULL << 63),
ABANDONED_MASK = (1ULL << 62),
};
static int toVariantBit(int biome, int variant) {
int bit = 0;
switch (biome) {
@ -542,6 +559,13 @@ struct Condition
case 5: *biome = snowy_tundra; break;
}
}
inline bool villageOk(int mc, StructureVariant sv) {
if ((variants & ABANDONED_MASK) && !sv.abandoned) return false;
if (mc < MC_1_14) return true;
if (!(variants & START_PIECE_MASK)) return true;
uint64_t mask = 1ULL << toVariantBit(sv.biome, sv.variant);
return mask & variants;
}
};
struct StructPos