From c113d3d731203ec6b948c74203e7ae65ba6e4346 Mon Sep 17 00:00:00 2001 From: Cubitect Date: Sun, 28 Nov 2021 12:43:35 +0100 Subject: [PATCH] Updated cubiomes and structures for 1.18. --- cubiomes | 2 +- cubiomes-viewer.pro | 1 - src/aboutdialog.h | 2 +- src/mainwindow.ui | 48 ++++++++++++++++++++++++++++++++++++++------- src/quad.cpp | 43 +++++++++++++++++++++++----------------- src/search.cpp | 23 +++++++++++++--------- src/search.h | 19 ++++++++++-------- 7 files changed, 93 insertions(+), 45 deletions(-) diff --git a/cubiomes b/cubiomes index 71ca41e..18a16f8 160000 --- a/cubiomes +++ b/cubiomes @@ -1 +1 @@ -Subproject commit 71ca41e171749799978f3473a052427c9b9f9c96 +Subproject commit 18a16f800033771898f884eac8d3e62bc776f433 diff --git a/cubiomes-viewer.pro b/cubiomes-viewer.pro index 3bb463c..ace1ab7 100644 --- a/cubiomes-viewer.pro +++ b/cubiomes-viewer.pro @@ -55,7 +55,6 @@ SOURCES += \ HEADERS += \ $$CUPATH/finders.h \ $$CUPATH/generator.h \ - $$CUPATH/javarnd.h \ $$CUPATH/layers.h \ $$CUPATH/util.h \ src/aboutdialog.h \ diff --git a/src/aboutdialog.h b/src/aboutdialog.h index 9aaaca9..c738ff1 100644 --- a/src/aboutdialog.h +++ b/src/aboutdialog.h @@ -5,7 +5,7 @@ #define VERS_MAJOR 1 #define VERS_MINOR 11 -#define VERS_PATCH -1 // negative patch number designates a development version +#define VERS_PATCH 0 // 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/mainwindow.ui b/src/mainwindow.ui index d4c9f1e..3b0cd1f 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -26,7 +26,16 @@ - + + 0 + + + 0 + + + 0 + + 0 @@ -39,10 +48,17 @@ - + + + Show map for this y-level + + + + Show map for this y-level + Y: @@ -229,7 +245,16 @@ Search - + + 0 + + + 0 + + + 0 + + 0 @@ -275,8 +300,8 @@ QToolButton { 0 0 - 1233 - 676 + 1232 + 669 @@ -601,7 +626,16 @@ QSplitter { QFrame::Raised - + + 0 + + + 0 + + + 0 + + 0 @@ -668,7 +702,7 @@ QToolButton:checked { 0 0 1280 - 23 + 22 diff --git a/src/quad.cpp b/src/quad.cpp index ae3e599..603532e 100644 --- a/src/quad.cpp +++ b/src/quad.cpp @@ -51,24 +51,31 @@ void getStructs(std::vector *out, const StructureConfig sconf, if (p.x >= x0 && p.x < x1 && p.z >= z0 && p.z < z1) { - int id = isViableStructurePos(sconf.structType, &g, p.x, p.z); - if (id && sconf.structType == End_City) + int id = isViableStructurePos(sconf.structType, &g, p.x, p.z, 0); + if (!id) + continue; + + if (sconf.structType == End_City) { SurfaceNoise sn; initSurfaceNoiseEnd(&sn, wi.seed); id = isViableEndCityTerrain(&g.en, &sn, p.x, p.z); + if (!id) + continue; + } + else if (g.mc >= MC_1_18) + { + if (!isViableStructureTerrain(sconf.structType, &g, p.x, p.z)) + continue; } - if (id) + VarPos vp = { p, 0 }; + if (sconf.structType == Village) { - VarPos vp = { p, 0 }; - if (sconf.structType == Village) - { - VillageType vt = getVillageType(wi.mc, wi.seed, p.x, p.z, id); - vp.variant = vt.abandoned; - } - out->push_back(vp); + VillageType vt = getVillageType(wi.mc, wi.seed, p.x, p.z, id); + vp.variant = vt.abandoned; } + out->push_back(vp); } } } @@ -810,14 +817,6 @@ void QWorld::draw(QPainter& painter, int vw, int vh, qreal focusx, qreal focusz, painter.drawPixmapFragments(frags.data(), frags.size(), icons[D_STRONGHOLD]); } - for (int li = lvb.size()-1; li >= 0; --li) - { - Level& l = lvb[li]; - if (li == activelv || li == activelv+1) - l.update(cachedbiomes, bx0, bz0, bx1, bz1); - else - l.update(cachedbiomes, 0, 0, 0, 0); - } for (int sopt = D_DESERT; sopt < D_SPAWN; sopt++) { Level& l = lvs[sopt]; @@ -826,6 +825,14 @@ void QWorld::draw(QPainter& painter, int vw, int vh, qreal focusx, qreal focusz, else if (activelv > l.viewlv+1) l.update(cachedstruct, 0, 0, 0, 0); } + for (int li = lvb.size()-1; li >= 0; --li) + { + Level& l = lvb[li]; + if (li == activelv || li == activelv+1) + l.update(cachedbiomes, bx0, bz0, bx1, bz1); + else + l.update(cachedbiomes, 0, 0, 0, 0); + } // start the spawn and stronghold worker thread if this is the first run if (spawn == NULL) diff --git a/src/search.cpp b/src/search.cpp index 8f92c7e..493c7d0 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -467,7 +467,7 @@ L_qm_any: continue; } gen->init4Dim(finfo.dim); - if (!isViableStructurePos(st, &gen->g, pc.x, pc.z)) + if (!isViableStructurePos(st, &gen->g, pc.x, pc.z, 0)) continue; if (st == End_City) { @@ -476,6 +476,11 @@ L_qm_any: &gen->g.en, &gen->sn, pc.x, pc.z)) continue; } + else if (gen->mc >= MC_1_18) + { + if (!isViableStructureTerrain(st, &gen->g, pc.x, pc.z)) + continue; + } xt += pc.x; zt += pc.z; n++; @@ -793,10 +798,10 @@ void findQuadStructs(int styp, Generator *g, QVector *out) getStructurePos(styp, g->mc, g->seed, qr.x+0, qr.z+1, qs+1); getStructurePos(styp, g->mc, g->seed, qr.x+1, qr.z+0, qs+2); getStructurePos(styp, g->mc, g->seed, qr.x+1, qr.z+1, qs+3); - if (isViableStructurePos(styp, g, qs[0].x, qs[0].z) && - isViableStructurePos(styp, g, qs[1].x, qs[1].z) && - isViableStructurePos(styp, g, qs[2].x, qs[2].z) && - isViableStructurePos(styp, g, qs[3].x, qs[3].z)) + if (isViableStructurePos(styp, g, qs[0].x, qs[0].z, 0) && + isViableStructurePos(styp, g, qs[1].x, qs[1].z, 0) && + isViableStructurePos(styp, g, qs[2].x, qs[2].z, 0) && + isViableStructurePos(styp, g, qs[3].x, qs[3].z, 0)) { QuadInfo qinfo; for (int j = 0; j < 4; j++) @@ -827,10 +832,10 @@ void findQuadStructs(int styp, Generator *g, QVector *out) getStructurePos(styp, g->mc, g->seed, qr.x+0, qr.z+1, qs+1); getStructurePos(styp, g->mc, g->seed, qr.x+1, qr.z+0, qs+2); getStructurePos(styp, g->mc, g->seed, qr.x+1, qr.z+1, qs+3); - if (isViableStructurePos(styp, g, qs[0].x, qs[0].z) && - isViableStructurePos(styp, g, qs[1].x, qs[1].z) && - isViableStructurePos(styp, g, qs[2].x, qs[2].z) && - isViableStructurePos(styp, g, qs[3].x, qs[3].z)) + if (isViableStructurePos(styp, g, qs[0].x, qs[0].z, 0) && + isViableStructurePos(styp, g, qs[1].x, qs[1].z, 0) && + isViableStructurePos(styp, g, qs[2].x, qs[2].z, 0) && + isViableStructurePos(styp, g, qs[3].x, qs[3].z, 0)) { QuadInfo qinfo; for (int j = 0; j < 4; j++) diff --git a/src/search.h b/src/search.h index e3f2445..9c128c8 100644 --- a/src/search.h +++ b/src/search.h @@ -300,25 +300,25 @@ static const struct FilterList "Nether biomes after voronoi scaling to 1:1." }; list[F_BIOME_NETHER_4] = FilterInfo{ - CAT_NETHER, 0, 1, 1, 0, 0, 4, 0, MC_1_16, MC_NEWEST, -1, 1, disp++, + CAT_NETHER, 0, 1, 1, 0, 0, 4, 0, MC_1_16, MC_NEWEST, -1, 0, disp++, ":icons/nether.png", "Nether biome filter 1:4", "Nether biomes with normal noise sampling at scale 1:4." }; list[F_BIOME_NETHER_16] = FilterInfo{ - CAT_NETHER, 0, 1, 1, 0, 0, 16, 0, MC_1_16, MC_NEWEST, -1, 1, disp++, + CAT_NETHER, 0, 1, 1, 0, 0, 16, 0, MC_1_16, MC_NEWEST, -1, 0, disp++, ":icons/nether.png", "Nether biome filter 1:16", "Nether biomes, but only sampled at scale 1:16." }; list[F_BIOME_NETHER_64] = FilterInfo{ - CAT_NETHER, 0, 1, 1, 0, 0, 64, 0, MC_1_16, MC_NEWEST, -1, 1, disp++, + CAT_NETHER, 0, 1, 1, 0, 0, 64, 0, MC_1_16, MC_NEWEST, -1, 0, disp++, ":icons/nether.png", "Nether biome filter 1:64", "Nether biomes, but only sampled at scale 1:64." }; list[F_BIOME_NETHER_256] = FilterInfo{ - CAT_NETHER, 0, 1, 1, 0, 0, 256, 0, MC_1_16, MC_NEWEST, -1, 1, disp++, + CAT_NETHER, 0, 1, 1, 0, 0, 256, 0, MC_1_16, MC_NEWEST, -1, 0, disp++, ":icons/nether.png", "Nether biome filter 1:256", "Nether biomes, but only sampled at scale 1:256." @@ -388,14 +388,16 @@ static const struct FilterList CAT_STRUCT, 1, 1, 1, 0, Desert_Pyramid, 1, 1, MC_1_3, MC_NEWEST, 0, 0, disp++, ":icons/desert.png", "Desert pyramid", - "" + "In version 1.18, desert pyramids depend on surface height and may fail to " + "generate near caves/aquifers, rivers and oceans." }; list[F_JUNGLE] = FilterInfo{ - CAT_STRUCT, 1, 1, 1, 0, Jungle_Pyramid, 1, 1, MC_1_3, MC_NEWEST, 0, 0, disp++, + CAT_STRUCT, 1, 1, 1, 0, Jungle_Temple, 1, 1, MC_1_3, MC_NEWEST, 0, 0, disp++, ":icons/jungle.png", "Jungle temple", - "" + "In version 1.18, jungle temples depend on surface height and may fail to " + "generate near caves/aquifers, rivers and oceans." }; list[F_HUT] = FilterInfo{ @@ -423,7 +425,8 @@ static const struct FilterList CAT_STRUCT, 1, 1, 1, 0, Mansion, 1, 1, MC_1_11, MC_NEWEST, 0, 0, disp++, ":icons/mansion.png", "Woodland mansion", - "" + "In version 1.18, mansions depend on surface height and may fail to " + "generate near caves/aquifers, rivers and oceans." }; list[F_RUINS] = FilterInfo{