From 4aa73c560c90aa8b961e83c27f5aacc064fe5df6 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Fri, 4 May 2018 02:43:25 +0200 Subject: [PATCH] started the 'Brownian' land --- classes.cpp | 2 ++ classes.h | 8 ++++---- graph.cpp | 4 ++++ landgen.cpp | 36 +++++++++++++++++++++++++++++++++++- 4 files changed, 45 insertions(+), 5 deletions(-) diff --git a/classes.cpp b/classes.cpp index 7a944cc4..4798114a 100644 --- a/classes.cpp +++ b/classes.cpp @@ -1417,6 +1417,7 @@ walltype winf[walltypes] = { { '=', 0x804000, "dock", "A dock."}, { '^', 0xFF8000, "burning dock", "A burning dock."}, { '#', 0xE04030, "ruin wall", ruindesc}, + { '#', 0xA04060, "Brownian generator", NODESC} }; // --- land types --- @@ -1613,6 +1614,7 @@ const landtype linf[landtypes] = { "somehow. In the meantime, its memory has been cleared, since the 'remove faraway cells from the memory'" " option was on." }, + { 0xA04060, "Brownian", NODESCYET} }; vector land_tac = { diff --git a/classes.h b/classes.h index e081290a..adf2294f 100644 --- a/classes.h +++ b/classes.h @@ -120,7 +120,7 @@ enum eItem { itOrbPhasing, itOrbMagnetism, itOrbSlaying }; -static const int walltypes = 108; +static const int walltypes = 109; struct walltype { char glyph; @@ -161,10 +161,10 @@ enum eWall { waNone, waIcewall, waBarrier, waFloorA, waFloorB, waCavewall, waCav waTempBridgeBlocked, waTerraWarrior, waBubble, waArrowTrap, waMercury, waMagma, - waDock, waBurningDock, waRuinWall + waDock, waBurningDock, waRuinWall, waBrownian }; -static const int landtypes = 84; +static const int landtypes = 85; struct landtype { int color; @@ -191,7 +191,7 @@ enum eLand { laNone, laBarrier, laCrossroads, laDesert, laIce, laCaves, laJungle laMirrorOld, laVolcano, laBlizzard, laHunting, laTerracotta, laMercuryRiver, laDual, laSnakeNest, laDocks, laRuins, laMagnetic, - laSwitch, laMemory + laSwitch, laMemory, laBrownian }; enum eGeometry {gNormal, gEuclid, gSphere, gElliptic, gQuotient, gQuotient2, gTorus, gOctagon, g45, g46, g47, gSmallSphere, gTinySphere, gEuclidSquare, gSmallElliptic, gGUARD}; diff --git a/graph.cpp b/graph.cpp index d286e216..3bead6c5 100644 --- a/graph.cpp +++ b/graph.cpp @@ -2656,6 +2656,10 @@ void setcolors(cell *c, int& wcol, int &fcol) { case laWineyard: fcol = 0x006000; break; case laLivefjord: fcol = 0x306030; break; + case laBrownian: + fcol = wcol = gradient(0x002000, 0xFFFFFF, 0, c->landparam, 20); + break; + case laVolcano: { int id = lavatide(c, -1)/4; if(c->wall == waMagma) { diff --git a/landgen.cpp b/landgen.cpp index 63319815..3f4dbbce 100644 --- a/landgen.cpp +++ b/landgen.cpp @@ -106,6 +106,35 @@ eMonster genRuinMonster(cell *c) { return m; } +void start_brownian(cell *c, int d) { + while(true) { + if(c->wall == waBrownian) c->wall = waNone; + c->landparam++; + // snakepile(c, moRedTroll); + // c->wall = waSea; + c->bardir = NOBARRIERS; + if(d == 0) { + if(c->mpdist >= BARLEV) { + c->wall = waBrownian; + return; + } + start_brownian(c, 1); + d = 1; + continue; + } + int q = 0; + cell *good = NULL; + forCellCM(c2, c) + if(c2->mpdist > 7 && (c2->land == laBrownian || c2->land == laNone)) { + q++; + if(q==1 || hrand(q) == 0) good = c2; + } + if(!q) break; + d++; if(d == 7) d = 0; + c = good; + } + } + // the giant switch generating most of the lands... void giantLandSwitch(cell *c, int d, cell *from) { @@ -2113,6 +2142,11 @@ void giantLandSwitch(cell *c, int d, cell *from) { } break; + case laBrownian: + if(c->wall == waBrownian || (d == 9 && hrand(10000) < 5)) + start_brownian(c, 0); + break; + case laMirrored: case laMirrorWall: case laMirrorWall2: @@ -2258,7 +2292,7 @@ void repairLandgen(cell *c) { if(c->wall == waIcewall && c->land != laIce && c->land != laCocytus && c->land != laBlizzard) c->wall = waNone; - if(c->wall == waRed3 && c->land != laRedRock && c->land != laSnakeNest) + if(c->wall == waRed3 && c->land != laRedRock && c->land != laSnakeNest && c->land != laBrownian) c->wall = waNone; if(c->item == itRedGem && c->land != laRedRock)