mirror of
https://github.com/Cubitect/cubiomes-viewer.git
synced 2025-01-07 03:17:01 +08:00
Patch 4.1.2
* Renamed 1.21.3 -> 1.21 WD and 1.21.2 -> 1.21.3 to match the Winter Drop * fixed spawn for 1.21.2+ (#340) * fixed height map not getting applied after biome color change
This commit is contained in:
parent
6b880619ee
commit
025b91cb0f
2
cubiomes
2
cubiomes
@ -1 +1 @@
|
||||
Subproject commit 6d1a190fe63210ce32d08d87388748a73c5ea7e1
|
||||
Subproject commit e61f90580cbdd883214a8054670dacae655e59c0
|
@ -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 {
|
||||
|
@ -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>
|
||||
|
@ -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)
|
||||
|
@ -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(), " "));
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -1735,10 +1735,10 @@ L_qm_any:
|
||||
{
|
||||
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;
|
||||
|
@ -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"),
|
||||
""
|
||||
|
@ -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())
|
||||
|
@ -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()
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user