From 9d88528939db564bde8d25facfa641003040418a Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sat, 14 Dec 2019 12:35:03 +0100 Subject: [PATCH] replaced TEMPLE_EACH with function temple_layer_size() --- bigstuff.cpp | 15 +++++++++++++-- celldrawer.cpp | 2 +- items.cpp | 2 +- landgen.cpp | 10 +++++----- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/bigstuff.cpp b/bigstuff.cpp index 801ff096..df9e49b1 100644 --- a/bigstuff.cpp +++ b/bigstuff.cpp @@ -1661,6 +1661,17 @@ EX int masterAlt(cell *c) { return c->master->alt->distance; } +/** the distance between two layers of Temple of Cthulhu */ +EX int temple_layer_size() { + if(among(geometry, gHoroRec, gHoroHex, gKiteDart3)) return 3; + if(sol) return 6; + if(WDIM == 3 && bt::in()) return 2; + if(geometry == gSpace435) return 4; + if(WDIM == 3 && hyperbolic) return 3; + if(S3 == OINF) return 4; + return 6; + } + EX void moreBigStuff(cell *c) { if((bearsCamelot(c->land) && !euclid && !quotient && !nil) || c->land == laCamelot) @@ -1709,7 +1720,7 @@ EX void moreBigStuff(cell *c) { if(d <= 0) { c->land = laTemple, c->wall = waNone, c->monst = moNone, c->item = itNone; } - if(d % TEMPLE_EACH==0) { + if(d % temple_layer_size()==0) { c->landparam = 0; if(geometry == gSpace534) { int i = 0; @@ -1752,7 +1763,7 @@ EX void moreBigStuff(cell *c) { int q = 0; for(int t=0; ttype; t++) { createMov(c, t); - if(celldistAlt(c->move(t)) % TEMPLE_EACH == 0 && !ishept(c->move(t))) q++; + if(celldistAlt(c->move(t)) % temple_layer_size() == 0 && !ishept(c->move(t))) q++; } if(q == 2) c->wall = waColumn; } diff --git a/celldrawer.cpp b/celldrawer.cpp index 926b3cbf..ca38ce8e 100644 --- a/celldrawer.cpp +++ b/celldrawer.cpp @@ -272,7 +272,7 @@ void celldrawer::setcolors() { int d = showoff ? 0 : (eubinary||c->master->alt) ? celldistAlt(c) : 99; if(chaosmode) fcol = 0x405090; - else if(d % TEMPLE_EACH == 0) + else if(d % temple_layer_size() == 0) fcol = gradient(0x304080, winf[waColumn].color, 0, 0.5, 1); // else if(c->type == 7) // wcol = 0x707070; diff --git a/items.cpp b/items.cpp index ed33ea84..3dbb77ae 100644 --- a/items.cpp +++ b/items.cpp @@ -492,7 +492,7 @@ EX void placeItems(int qty, eItem it) { EX bool cantGetGrimoire(cell *c2, bool verbose IS(true)) { if(chaosmode) return false; if(!eubinary && !c2->master->alt) return false; - if(c2->item == itGrimoire && items[itGrimoire] > celldistAlt(c2)/-TEMPLE_EACH) { + if(c2->item == itGrimoire && items[itGrimoire] > celldistAlt(c2)/-temple_layer_size()) { if(verbose) addMessage(XLAT("You already have this Grimoire! Seek new tomes in the inner circles.")); return true; diff --git a/landgen.cpp b/landgen.cpp index 179fb7e0..d77f4b85 100644 --- a/landgen.cpp +++ b/landgen.cpp @@ -1497,12 +1497,12 @@ EX void giantLandSwitch(cell *c, int d, cell *from) { chaosmode ? -15 * items[itGrimoire]: (eubinary || c->master->alt) ? celldistAlt(c) : 10; // remember: d is negative - if(chaosmode ? hrand(100) < 25 : d % TEMPLE_EACH == 0) { + if(chaosmode ? hrand(100) < 25 : d % temple_layer_size() == 0) { if(hrand_monster(5000) < 20 - 2*d && !c->monst && !peace::on) c->monst = moTentacle, c->mondir = NODIR; } else { - // int d0 = d % TEMPLE_EACH; + // int d0 = d % temple_layer_size(); // if(d0<0) d0=-d0; if(hrand(100) < (peace::on ? 15 : 30) && WDIM == 2) c->wall = waBigStatue; @@ -1512,7 +1512,7 @@ EX void giantLandSwitch(cell *c, int d, cell *from) { c->monst = moCultistLeader; else if(hrand(5000) < 250 && !peace::on) c->item = itGrimoire; - else if(hrand(5000) < 10 && (chaosmode ? items[itGrimoire] >= treasureForLocal() : -d > TEMPLE_EACH * 10) && !peace::on && !inv::on) + else if(hrand(5000) < 10 && (chaosmode ? items[itGrimoire] >= treasureForLocal() : -d > temple_layer_size() * 10) && !peace::on && !inv::on) c->item = itOrbDragon; } } @@ -2013,10 +2013,10 @@ EX void giantLandSwitch(cell *c, int d, cell *from) { if(d >= 8) c->wall = waSea; if(d == 7 && !safety) { bool placecolumn = false; - if(c->landparam % TEMPLE_EACH == 0 && c->landparam <= 24) { + if(c->landparam % temple_layer_size() == 0 && c->landparam <= 24) { int q = 0; forCellEx(c2, c) - if(c2->landparam % TEMPLE_EACH == 0 && !pseudohept(c2)) q++; + if(c2->landparam % temple_layer_size() == 0 && !pseudohept(c2)) q++; placecolumn = q == 2; if(placecolumn && weirdhyperbolic && !BITRUNCATED && hrand(100) >= 50) placecolumn = false;