From af25eb1f1f08f6acc5f80fa5f064a4490dbda9d9 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Fri, 15 Mar 2019 16:42:14 +0100 Subject: [PATCH] 3D:: implemented the cool Emerald Mine pattern for 534, and also some Vineyard/Emerald patterns for both 435 and 534. --- landgen.cpp | 6 ++++ reg3.cpp | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 105 insertions(+), 1 deletion(-) diff --git a/landgen.cpp b/landgen.cpp index 75a65c9e..d3b6c6b2 100644 --- a/landgen.cpp +++ b/landgen.cpp @@ -424,6 +424,8 @@ void giantLandSwitch(cell *c, int d, cell *from) { else if(fulltorus) { c->wall = waCavefloor; } + else if(DIM == 3 && hyperbolic && !binarytiling) + c->wall = (c->master->zebraval & 1) ? waCavewall : waCavefloor; else if(euclid && DIM == 3) c->wall = euclid3::get_emerald(c) ? waCavewall : waCavefloor; else if(euclid) { @@ -467,6 +469,8 @@ void giantLandSwitch(cell *c, int d, cell *from) { if(hrand_monster(8000) < 50 + 10 * (items[itEmerald] + yendor::hardness())) { static eMonster emeraldmonsters[4] = { moHedge, moLancer, moFlailer, moMiner }; c->monst = emeraldmonsters[hrand(4)]; + if(c->monst == moHedge && S3 != 3) + c->monst = moFlailer; } if(sphere && c->type != 6 && c->master->fiftyval == 5) { c->monst = moMiner; @@ -615,6 +619,8 @@ void giantLandSwitch(cell *c, int d, cell *from) { int dy = gmod(y, 3); if(dy == 1) c->wall = waVinePlant; } + else if(DIM == 3 && hyperbolic && !binarytiling) + c->wall = (c->master->zebraval & 2) ? waVinePlant : waNone; else if(a4 || sphere || archimedean) c->wall = hrand(100) < 50 ? waNone : waVinePlant; else { diff --git a/reg3.cpp b/reg3.cpp index c9f1c05e..f06f7ac3 100644 --- a/reg3.cpp +++ b/reg3.cpp @@ -343,6 +343,7 @@ namespace reg3 { allh[i] = tailored_alloc (S7); allh[i]->c7 = newCell(S7, allh[i]); allh[i]->fieldval = i; + allh[i]->zebraval = 0; acells.push_back(allh[i]->c7); } @@ -357,6 +358,7 @@ namespace reg3 { int tmul2 = currfp_gmul(tmul, s); if(cell_to_code[code_to_cell[tmul2]] == tmul2) { allh[i]->move(d) = allh[code_to_cell[tmul2]]; + allh[i]->c7->move(d) = allh[i]->move(d)->c7; tmatrices[i].push_back(reg3::adjmoves[d] * iadj * fullmatrices[s] * adj); found++; } @@ -370,9 +372,98 @@ namespace reg3 { for(int i=0; imove(d)->move(e) == allh[i]) + if(allh[i]->move(d)->move(e) == allh[i]) { allh[i]->c.setspin(d, e, false); + allh[i]->c7->c.setspin(d, e, false); + } + create_patterns(); + } + + set plane; + + void make_plane(cellwalker cw) { + if(plane.count(cw)) return; + plane.insert(cw); + for(int i=0; i g(geometry, S7 == 12 ? gField534 : gField435); + // also, strafe needs currentmap + dynamicval c(currentmap, this); + + if(S7 == 12) { + // Emerald in 534 + cell *a = gamestart(); + cell *b; + for(cell *c: allcells()) + if(hr::celldistance(a, c) == 5) { + b = c; + break; + } + for(cell *c: allcells()) + if(hr::celldistance(a, c) > hr::celldistance(b, c)) + c->master->zebraval |= 1; + + // Vineyard in 534 + b = (cellwalker(a, 0) + wstep + rev + wstep).at; + for(cell *c: allcells()) + if(hr::celldistance(a, c) == hr::celldistance(b, c)) + c->master->zebraval |= 2; + } + + if(S7 == 6) { + // Emerald in 534 + cell *a = gamestart(); + for(cell *c: allcells()) + if(hr::celldistance(a, c) > 3) + c->master->zebraval |= 1; + + // Vineyard in 435 + make_plane(cellwalker(gamestart(), 0)); + println(hlog, "plane size = ", isize(plane)); + + set plane_indices; + for(auto cw: plane) plane_indices.insert(cw.at->master->fieldval); + + set nwi; + for(int i=0; imaster->fieldval)) ok = false; + } + if(ok) nwi.insert(i); + } + + int gpow; + + for(int i: nwi) { + int pw = 1; + int at = i; + while(true) { + at = currfp_gmul(at, i); + if(!nwi.count(at)) break; + pw++; + } + if(pw == 4) gpow = i; + } + + int u = 0; + for(int a=0; a<5; a++) { + for(int o: plane_indices) { + int j = code_to_cell[currfp_gmul(u, cell_to_code[o])]; + allcells()[j]->master->zebraval |= 2; + } + u = currfp_gmul(u, gpow); + } + } } void draw() override { @@ -445,6 +536,7 @@ namespace reg3 { if(hyperbolic) { #if CAP_FIELD quotient_map = new hrmap_field3; + h.zebraval = quotient_map->allh[0]->zebraval; #endif dynamicval g(geometry, gBinary3); @@ -590,6 +682,12 @@ namespace reg3 { created->c7 = newCell(S7, created); created->alt = NULL; created->cdata = NULL; + #if CAP_FIELD + if(hyperbolic) { + created->zebraval = quotient_map->allh[fv]->zebraval; + } + else + #endif created->zebraval = hrand(10); created->fieldval = fv; created->distance = parent->distance + 1;