Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cubiomes
Submodule cubiomes updated 14 files
+45 −0 CMakeLists.txt
+5 −5 README.md
+49 −19 biomenoise.c
+2 −11 biomenoise.h
+1 −1 biomes.c
+6 −5 biomes.h
+0 −30 biometree.c
+55 −50 finders.c
+1 −8 finders.h
+1 −1 makefile
+2 −2 rng.h
+5 −5 tables/btree21wd.h
+7 −6 tests.c
+8 −6 util.c
7 changes: 3 additions & 4 deletions cubiomes-viewer.pro
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ greaterThan(QT_MAJOR_VERSION, 5) {
DEFINES += QT_DISABLE_DEPRECATED_UP_TO=0x050F00
} else {
QMAKE_CXXFLAGS += -std=gnu++11
equals(QMAKE_CXX, g++) {
QMAKE_CXXFLAGS += -Wno-deprecated-copy
}
}

win32: {
Expand Down Expand Up @@ -54,10 +57,6 @@ static_gnu: {
LIBS += -static -static-libgcc -static-libstdc++
}

gcc {
greaterThan(QMAKE_GCC_MAJOR_VERSION, 9): QMAKE_CXXFLAGS += -Wno-deprecated-copy
}

CONFIG(debug, debug|release): {
CUTARGET = debug
} else {
Expand Down
9 changes: 9 additions & 0 deletions etc/com.github.cubitect.cubiomes-viewer.metainfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@
</description>

<releases>
<release version="4.1.2" date="2024-11-10">
<description>
<p>Changes:</p>
<ul>
<li>Renamed 1.21.3 to 1.21 WD and 1.21.2 to 1.21.3 to match the Winter Drop</li>
<li>Fixed the World Spawn for 1.21.2+</li>
</ul>
</description>
</release>
<release version="4.1.0" date="2024-10-07">
<description>
<p>Changes:</p>
Expand Down
2 changes: 1 addition & 1 deletion src/aboutdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#define VERS_MAJOR 4
#define VERS_MINOR 1
#define VERS_PATCH 1 // negative patch number designates a development version
#define VERS_PATCH 2 // 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)
Expand Down
3 changes: 1 addition & 2 deletions src/conditiondialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ ConditionDialog::ConditionDialog(FormConditions *parent, MapView *mapview, Confi
textDescription->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
ui->collapseDescription->init(tr("Description/Notes"), textDescription, true);

const char *p_mcs = mc2str(wi.mc);
QString mcs = tr("MC %1", "Minecraft version").arg(p_mcs ? p_mcs : "?");
QString mcs = tr("MC %1", "Minecraft version").arg(mc2str(wi.mc));
ui->labelMC->setText(mcs);
#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
ui->textEditLua->setTabStopWidth(txtWidth(ui->textEditLua->font(), " "));
Expand Down
2 changes: 1 addition & 1 deletion src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ bool WorldInfo::read(const QString& line)
if (sscanf(p, "#MC: %8[^\n]", buf) == 1)
{
mc = str2mc(buf);
if (mc < 0)
if (mc == MC_UNDEF)
mc = MC_DEFAULT;
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#define PRECOMPUTE48_BUFSIZ ((int64_t)1 << 30)

enum { MC_DEFAULT = MC_1_21_2 };
enum { MC_DEFAULT = MC_1_21_3 };

struct ExtGenConfig
{
Expand Down Expand Up @@ -223,7 +223,7 @@ struct Gen48Config
};

// search type options from combobox
enum { SEARCH_INC = 0, SEARCH_BLOCKS = 1, SEARCH_LIST = 2, SEARCH_48ONLY = 3 };
enum { SEARCH_INC = 0, SEARCH_BLOCKS = 1, SEARCH_LIST = 2, SEARCH_48ONLY = 3, SEARCH_TEXT = 4, SEARCH_RANDOM = 5 };

struct SearchConfig
{
Expand Down
2 changes: 2 additions & 0 deletions src/formsearchcontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ FormSearchControl::FormSearchControl(MainWindow *parent)
ui->comboSearchType->addItem(tr("incremental"), SEARCH_INC);
ui->comboSearchType->addItem(tr("48-bit only"), SEARCH_48ONLY);
ui->comboSearchType->addItem(tr("48-bit family blocks"), SEARCH_BLOCKS);
ui->comboSearchType->addItem(tr("text seeds"), SEARCH_TEXT);
ui->comboSearchType->addItem(tr("random seeds"), SEARCH_RANDOM);
ui->comboSearchType->addItem(tr("seed list from file..."), SEARCH_LIST);

model = new SeedTableModel(ui->results);
Expand Down
17 changes: 4 additions & 13 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ bool MainWindow::getSeed(WorldInfo *wi, bool applyrand)
bool ok = true;
const std::string& mcs = ui->comboBoxMC->currentText().toStdString();
wi->mc = str2mc(mcs.c_str());
if (wi->mc < 0)
if (wi->mc == MC_UNDEF)
{
if (applyrand)
qDebug() << "Unknown MC version: " << mcs.c_str();
Expand All @@ -386,13 +386,6 @@ bool MainWindow::getSeed(WorldInfo *wi, bool applyrand)

bool MainWindow::setSeed(WorldInfo wi, int dim)
{
const char *mcstr = mc2str(wi.mc);
if (!mcstr)
{
qDebug() << "Unknown MC version: " << wi.mc;
return false;
}

if (dim == DIM_OVERWORLD)
dimactions[0]->setChecked(true);
if (dim == DIM_NETHER)
Expand Down Expand Up @@ -440,7 +433,7 @@ bool MainWindow::setSeed(WorldInfo wi, int dim)
ui->comboY->addItem(QString::number(wi.y));
ui->comboY->setCurrentIndex(i);

ui->comboBoxMC->setCurrentText(mcstr);
ui->comboBoxMC->setCurrentText(mc2str(wi.mc));
ui->seedEdit->setText(QString::asprintf("%" PRId64, (int64_t)wi.seed));
getMapView()->setSeed(wi, dim, lopt);

Expand Down Expand Up @@ -703,12 +696,10 @@ void MainWindow::setMCList(bool experimental)
{
if (!experimental && mc != wi.mc)
{
if (mc <= MC_1_0 || mc == MC_1_16_1 || mc == MC_1_19_2 || mc == MC_1_21_3)
if (mc <= MC_1_0 || mc == MC_1_16_1 || mc == MC_1_19_2 || mc == MC_1_21_1 || mc == MC_1_21_WD)
continue;
}
const char *mcs = mc2str(mc);
if (mcs)
mclist.append(mcs);
mclist.append(mc2str(mc));
}
const QString s = mc2str(wi.mc);
ui->comboBoxMC->setEnabled(false);
Expand Down
8 changes: 1 addition & 7 deletions src/scripts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,7 @@ static int l_getStructures(lua_State *L)
return 0;
}

int dim = DIM_OVERWORLD;
if (sconf.properties & STRUCT_NETHER)
dim = DIM_NETHER;
else if (sconf.properties & STRUCT_END)
dim = DIM_END;

env->init4Dim(dim);
env->init4Dim(sconf.dim);

if (styp == End_City)
{
Expand Down
4 changes: 2 additions & 2 deletions src/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1735,10 +1735,10 @@ testCondAt(
{
for (int rx = rx1; rx <= rx2; rx++)
{
if (cond->skipref && rx == at.x >> 4 && rz == at.z >> 4)
continue;
if (isSlimeChunk(env->seed, rx, rz))
{
if (cond->skipref && rx == at.x >> 4 && rz == at.z >> 4)
continue;
if (cond->count == 0)
{
return COND_FAILED;
Expand Down
2 changes: 1 addition & 1 deletion src/search.h
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ static const struct FilterList : private FilterInfo
};

list[F_CHAMBERS] = FilterInfo{
CAT_STRUCT, 1, LOC_RAD, Trial_Chambers, 1, BR_CLUST, MC_1_21, MC_NEWEST, 0, 0, disp++,
CAT_STRUCT, 1, LOC_RAD, Trial_Chambers, 1, BR_CLUST, MC_1_21_1, MC_NEWEST, 0, 0, disp++,
"chambers",
QT_TRANSLATE_NOOP("Filter", "Trial chambers"),
""
Expand Down
88 changes: 88 additions & 0 deletions src/searchthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,32 @@ void SearchMaster::preSearch()
isdone = true;
}


if (searchtype == SEARCH_TEXT)
{
smin = (int64_t)(-1LL << 31);
smax = (1LL << 31) - 1;
seed = sstart;
if (seed < smin)
seed = smin;
prog = seed - smin;
scnt = (smax + 1) * 2;
if ((int64_t)seed > (int64_t)smax)
isdone = true;
}

if (searchtype == SEARCH_RANDOM)
{
smax = MASK48;
seed = sstart = 0;
if (seed < smin)
seed = smin;
prog = seed - smin;
scnt = smax - smin;
if (seed > smax)
isdone = true;
}

if (searchtype == SEARCH_BLOCKS)
{
if (!slist.empty())
Expand Down Expand Up @@ -844,6 +870,21 @@ bool SearchMaster::requestItem(SearchWorker *item)
isdone = true;
}

if (searchtype == SEARCH_TEXT)
{
seed += itemsize;
if ((int64_t)seed > (int64_t)smax)
isdone = true;
}


if (searchtype == SEARCH_RANDOM)
{
seed += itemsize;
if (seed > smax)
isdone = true;
}

if (searchtype == SEARCH_BLOCKS)
{
if (!slist.empty())
Expand Down Expand Up @@ -1056,6 +1097,53 @@ void SearchWorker::run()
}
break;

case SEARCH_TEXT:
while (!*env.stop && getNextItem())
{
seed = sstart;
for (int i = 0; i < scnt; i++)
{
env.setSeed(seed);
if (testTreeAt(origin, &env, PASS_FULL_64, nullptr) == COND_OK)
{
if (!*env.stop)
emit result(seed);
}

if (seed == (1LL << 31) - 1)
{ // done
break;
}
seed++;
}
}
break;

case SEARCH_RANDOM:
uint64_t rng;
while (!*env.stop && getNextItem())
{
seed = sstart;
for (uint64_t i = 0; i < (uint64_t) scnt; i++)
{
setSeed(&rng, seed);
rng = nextLong(&rng);
env.setSeed(rng);
if (testTreeAt(origin, &env, PASS_FULL_64, nullptr) == COND_OK)
{
if (!*env.stop)
emit result(rng);
}

if (seed >= MASK48)
{ // done
break;
}
seed++;
}
}
break;

case SEARCH_BLOCKS:
while (!*env.stop && getNextItem())
{ // seed = ([..] << 48) | low
Expand Down
11 changes: 3 additions & 8 deletions src/tabstructures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,10 @@ void AnalysisStructures::runStructs(Generator *g)
if (!getStructureConfig_override(stype, wi.mc, &sconf))
continue;

int sdim = DIM_OVERWORLD;
if (sconf.properties & STRUCT_NETHER)
sdim = DIM_NETHER;
if (sconf.properties & STRUCT_END)
sdim = DIM_END;
if (dim != DIM_UNDEF && dim != sdim)
if (dim != DIM_UNDEF && dim != sconf.dim)
continue;

getStructs(&st, sconf, wi, sdim, area.x1, area.z1, area.x2, area.z2);
getStructs(&st, sconf, wi, sconf.dim, area.x1, area.z1, area.x2, area.z2);
if (st.empty())
continue;

Expand All @@ -94,7 +89,7 @@ void AnalysisStructures::runStructs(Generator *g)
item->setData(C_X, Qt::DisplayRole, QVariant::fromValue(vp.p.x));
item->setData(C_Z, Qt::DisplayRole, QVariant::fromValue(vp.p.z));
item->setData(0, Qt::UserRole+0, QVariant::fromValue(wi.seed));
item->setData(0, Qt::UserRole+1, QVariant::fromValue(sdim));
item->setData(0, Qt::UserRole+1, QVariant::fromValue(sconf.dim));
item->setData(0, Qt::UserRole+2, QVariant::fromValue(vp.p));
QStringList sinfo = vp.detail();
if (!sinfo.empty())
Expand Down
Loading