From 225282a3ebcd0b746184fbd1a4db35e87702d184 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sun, 10 Mar 2019 12:04:29 +0100 Subject: [PATCH] 3d::binary:: make the land barriers more like planes by pushing them by a number depending on btwidth --- binary-tiling.cpp | 16 ++++++++++++---- cell.cpp | 2 +- landgen.cpp | 8 ++++++++ 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/binary-tiling.cpp b/binary-tiling.cpp index 20227ca4..d58a8ddf 100644 --- a/binary-tiling.cpp +++ b/binary-tiling.cpp @@ -87,14 +87,22 @@ namespace binary { if(parent->c7) h->c7 = newCell(t, h); h->cdata = NULL; h->zebraval = side; - if(DIM == 3) { + h->emeraldval = 0; + if(DIM == 3 && h->c7) { + if(!parent->emeraldval) parent->emeraldval = currentmap->gamestart()->land; + eLand z = eLand(parent->emeraldval); int chance = 0; - if(specialland == laCrossroads4) chance = wallchance(parent->c7, deep_ocean_at(parent->c7, parent->c7)); + if(specialland == laCrossroads4) { + eLand x = parent->c7->land; + parent->c7->land = z; + chance = wallchance(parent->c7, deep_ocean_at(parent->c7, parent->c7)); + parent->c7->land = x; + } if(chaosmode) chance = 1000; if(chance && hrand(40000) < chance) - h->c7->land = getNewLand(parent->c7->land); + h->emeraldval = getNewLand(z); else - h->c7->land = parent->c7->land; + h->emeraldval = z; } #if DEBUG_BINARY_TILING xcode[h] = expected_xcode(parent, d); diff --git a/cell.cpp b/cell.cpp index fa957c35..6e4c3dd6 100644 --- a/cell.cpp +++ b/cell.cpp @@ -67,7 +67,7 @@ hrmap_hyperbolic::hrmap_hyperbolic() { binary::xcode[&h] = (1 << 16); binary::rxcode[1<<16] = &h; #endif - h.zebraval = 0, + h.zebraval = 0, h.emeraldval = 0, h.c7 = newCell(DIM == 3 ? S7 : 6, origin); } #endif diff --git a/landgen.cpp b/landgen.cpp index c40821e8..4cd283c3 100644 --- a/landgen.cpp +++ b/landgen.cpp @@ -2452,6 +2452,14 @@ void setdist(cell *c, int d, cell *from) { if(d >= BARLEV) { + if(binarytiling && DIM == 3 && !c->land) { + ld z = vid.binary_width; + cell *cseek = c; + int step = 0; + while(z < 3.999 && step < 10) cseek = cseek->cmove(S7-1), z *= 2; + if(cseek->master->emeraldval) setland(c, eLand(cseek->master->emeraldval)); + } + if(!c->land && from && from->land != laElementalWall && from->land != laHauntedWall && from->land != laOceanWall && from->land != laBarrier && !quotient) { if(!hasbardir(c)) setland(c, from->land);