diff --git a/cubiomes b/cubiomes index 6d1a190..e61f905 160000 --- a/cubiomes +++ b/cubiomes @@ -1 +1 @@ -Subproject commit 6d1a190fe63210ce32d08d87388748a73c5ea7e1 +Subproject commit e61f90580cbdd883214a8054670dacae655e59c0 diff --git a/cubiomes-viewer.pro b/cubiomes-viewer.pro index f148e7e..5a6b92b 100644 --- a/cubiomes-viewer.pro +++ b/cubiomes-viewer.pro @@ -20,6 +20,9 @@ greaterThan(QT_MAJOR_VERSION, 5) { DEFINES += QT_DISABLE_DEPRECATED_UP_TO=0x050F00 } else { QMAKE_CXXFLAGS += -std=gnu++11 + gcc { + QMAKE_CXXFLAGS += -Wno-deprecated-copy + } } win32: { @@ -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 { diff --git a/etc/com.github.cubitect.cubiomes-viewer.metainfo.xml b/etc/com.github.cubitect.cubiomes-viewer.metainfo.xml index 71106e7..b0b5e4f 100644 --- a/etc/com.github.cubitect.cubiomes-viewer.metainfo.xml +++ b/etc/com.github.cubitect.cubiomes-viewer.metainfo.xml @@ -13,6 +13,15 @@ + + +

Changes:

+
    +
  • Renamed 1.21.3 to 1.21 WD and 1.21.2 to 1.21.3 to match the Winter Drop
  • +
  • Fixed the World Spawn for 1.21.2+
  • +
+
+

Changes:

diff --git a/src/aboutdialog.h b/src/aboutdialog.h index d03a505..11a774d 100644 --- a/src/aboutdialog.h +++ b/src/aboutdialog.h @@ -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) diff --git a/src/conditiondialog.cpp b/src/conditiondialog.cpp index 13ebd7c..787a4fc 100644 --- a/src/conditiondialog.cpp +++ b/src/conditiondialog.cpp @@ -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(), " ")); diff --git a/src/config.cpp b/src/config.cpp index 40f6bc2..4c98527 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -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; } diff --git a/src/config.h b/src/config.h index 35fdd55..ee169fc 100644 --- a/src/config.h +++ b/src/config.h @@ -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 { diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 0af5343..68e7a3f 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -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(); @@ -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) @@ -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); @@ -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); diff --git a/src/scripts.cpp b/src/scripts.cpp index 1f17d60..50bbe7c 100644 --- a/src/scripts.cpp +++ b/src/scripts.cpp @@ -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) { diff --git a/src/search.cpp b/src/search.cpp index effbdbf..3ab75f1 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -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; diff --git a/src/search.h b/src/search.h index 084e331..52415c7 100644 --- a/src/search.h +++ b/src/search.h @@ -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"), "" diff --git a/src/tabstructures.cpp b/src/tabstructures.cpp index 2f8d4cf..9fb48ac 100644 --- a/src/tabstructures.cpp +++ b/src/tabstructures.cpp @@ -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; @@ -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()) diff --git a/src/world.cpp b/src/world.cpp index 90b06e5..fd6d484 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -379,6 +379,41 @@ void applyHeightShading(unsigned char *rgb, Range r, } } +void Quad::updateBiomeColor() +{ + if (!biomes || !rgb) + return; + int nptype = -1; + if (g->mc >= MC_1_18) nptype = g->bn.nptype; + if (g->mc <= MC_B1_7) nptype = g->bnb.nptype; + if (dim == DIM_OVERWORLD && nptype >= 0) + { // climate parameter + const int *extremes = getBiomeParaExtremes(g->mc); + int cmin = extremes[nptype*2 + 0]; + int cmax = extremes[nptype*2 + 1]; + for (int i = 0; i < r.sx * r.sz; i++) + { + double p = (biomes[i] - cmin) / (double) (cmax - cmin); + uchar col = (p <= 0) ? 0 : (p >= 1.0) ? 0xff : (uchar)(0xff * p); + rgb[3*i+0] = rgb[3*i+1] = rgb[3*i+2] = col; + } + } + else + { + biomesToImage(rgb, g_biomeColors, biomes, r.sx, r.sz, 1, 1); + + if (lopt.mode == LOPT_HEIGHT) + { + int stepbits = 0; // interpolated_step = (1 << stepbits) + if (scale > 16) + { + stepbits = 1; + } + applyHeightShading(rgb, r, g, sn, stepbits, lopt.disp[lopt.mode], false, isdel); + } + } +} + void Quad::run() { if (done || *isdel) @@ -398,7 +433,8 @@ void Quad::run() int y = (scale > 1) ? wi.y >> 2 : wi.y; int x = ti*pixs, z = tj*pixs, w = pixs, h = pixs; - Range r = {scale, x, z, w, h, y, 1}; + r = {scale, x, z, w, h, y, 1}; + biomes = allocCache(g, r); if (!biomes) return; @@ -415,39 +451,8 @@ void Quad::run() biomes[i] = -1; } - rgb = new uchar[w*h * 3]; - int nptype = -1; - if (g->mc >= MC_1_18) nptype = g->bn.nptype; - if (g->mc <= MC_B1_7) nptype = g->bnb.nptype; - if (dim == DIM_OVERWORLD && nptype >= 0) - { // climate parameter - const int *extremes = getBiomeParaExtremes(g->mc); - int cmin = extremes[nptype*2 + 0]; - int cmax = extremes[nptype*2 + 1]; - for (int i = 0; i < w*h; i++) - { - double p = (biomes[i] - cmin) / (double) (cmax - cmin); - uchar col = (p <= 0) ? 0 : (p >= 1.0) ? 0xff : (uchar)(0xff * p); - rgb[3*i+0] = rgb[3*i+1] = rgb[3*i+2] = col; - } - } - else - { - // sync biomeColors - g_mutex.lock(); - g_mutex.unlock(); - biomesToImage(rgb, g_biomeColors, biomes, w, h, 1, 1); - - if (lopt.mode == LOPT_HEIGHT) - { - int stepbits = 0; // interpolated_step = (1 << stepbits) - if (scale > 16) - { - stepbits = 1; - } - applyHeightShading(rgb, r, g, sn, stepbits, lopt.disp[lopt.mode], false, isdel); - } - } + rgb = new uchar[w*h * 3](); + updateBiomeColor(); img = new QImage(rgb, w, h, 3*w, QImage::Format_RGB888); } else if (pixs < 0) @@ -914,25 +919,16 @@ int QWorld::estimateSurface(Pos p) return (int) floor(y); } -static void refreshQuadColor(Quad *q) -{ - QImage *img = q->img; - if (!img) - return; - if (q->lopt.mode <= LOPT_OCEAN_256 || q->g->mc < MC_1_18 || q->dim != 0 || q->g->bn.nptype < 0) - biomesToImage(q->rgb, g_biomeColors, q->biomes, img->width(), img->height(), 1, 1); -} - void QWorld::refreshBiomeColors() { QMutexLocker locker(&g_mutex); for (Level& l : lvb) { for (Quad *q : l.cells) - refreshQuadColor(q); + q->updateBiomeColor(); } for (Quad *q : cachedbiomes) - refreshQuadColor(q); + q->updateBiomeColor(); } void QWorld::clear() diff --git a/src/world.h b/src/world.h index aeefb79..c130206 100644 --- a/src/world.h +++ b/src/world.h @@ -58,6 +58,7 @@ struct Quad : public Scheduled ~Quad(); void run(); + void updateBiomeColor(); WorldInfo wi; int dim; @@ -70,6 +71,7 @@ struct Quad : public Scheduled int blocks; int pixs; int sopt; + Range r; int *biomes; uchar *rgb;