From cafe34ad48bf89e9fabeced609e8c7df4ccb1bd9 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Fri, 29 Dec 2017 14:20:38 +0100 Subject: [PATCH] fixed circle/horocycle/equidistant-based lands in euclid4 --- bigstuff.cpp | 39 ++++++++++++++++++++++++++------------- complex.cpp | 12 ++++++++++-- init.cpp | 3 +-- 3 files changed, 37 insertions(+), 17 deletions(-) diff --git a/bigstuff.cpp b/bigstuff.cpp index d9aaae71..7d519009 100644 --- a/bigstuff.cpp +++ b/bigstuff.cpp @@ -42,25 +42,36 @@ int celldistAltRelative(cell *c) { int euclidAlt(short x, short y) { if(specialland == laTemple || specialland == laClearing) { - return max(int(x), x+y); + if(euclid6) + return max(int(x), x+y); + else if(nontruncated) + return x + abs(y); + else + return max(x, y); } else if(specialland == laCaribbean || specialland == laWhirlpool || specialland == laMountain) { - return - min( - min(max(int(-x), -x-y) + 3, - max(int(x+y), int(y)) + 3), - max(int(x), int(-y)) + 3 - ); + if(euclid6) + return + min( + min(max(int(-x), -x-y) + 3, + max(int(x+y), int(y)) + 3), + max(int(x), int(-y)) + 3 + ); + else if(nontruncated) + return 3 - min(abs(x-y), abs(x+y)); + else + return 3 - min(abs(x), abs(y)); } else if(specialland == laPrincessQuest) return eudist(x-EPX, y-EPY); - else return eudist(x-20, y-10); + else return eudist(x-(a4 ? 21 : 20), y-10); } const int NOCOMPASS = 1000000; int compassDist(cell *c) { - if(c->master->alt) return celldistAlt(c); + if(sphere || quotient) return 0; + if(euclid || c->master->alt) return celldistAlt(c); if(isHaunted(c->land) || c->land == laGraveyard) return getHauntedDepth(c); return NOCOMPASS; } @@ -70,7 +81,8 @@ cell *findcompass(cell *c) { if(d == NOCOMPASS) return NULL; while(inscreenrange(c)) { - generateAlts(c->master); + if(!euclid && !sphere && !quotient) + generateAlts(c->master); forCellEx(c2, c) if(compassDist(c2) < d) { c = c2; d = compassDist(c2); @@ -238,14 +250,14 @@ void generateTreasureIsland(cell *c) { if((euclid || (c->master->alt && c2->master->alt)) && celldistAlt(c2) < celldistAlt(c)) { ctab[qc++] = c2; qlo = i; qhi = i; - while(true) { + while(true && qc < MAX_EDGE) { qlo--; c2 = createMovR(c, qlo); if(!euclid && !c2->master->alt) break; if(celldistAlt(c2) >= celldistAlt(c)) break; ctab[qc++] = c2; } - while(true) { + while(true && qc < MAX_EDGE) { qhi++; c2 = createMovR(c, qhi); if(!euclid && !c2->master->alt) break; @@ -812,7 +824,8 @@ void setLandEuclid(cell *c) { } if(specialland == laIvoryTower || specialland == laDungeon) { int x, y; - tie(x,y) = cell_to_pair(c); y -= 5; + tie(x,y) = cell_to_pair(c); y = -5 - y; + if(specialland == laDungeon) y = -10 - y; if(y == 0) {setland(c, laBarrier); if(ishept(c)) setland(c, laAlchemist); } else if(y<0) setland(c, laAlchemist); diff --git a/complex.cpp b/complex.cpp index 12eb099c..dbb60a23 100644 --- a/complex.cpp +++ b/complex.cpp @@ -3395,7 +3395,7 @@ namespace dungeon { if(torus) return; int x, y; tie(x, y) = cell_to_pair(c); - string tab[] = { + string tab6[] = { ".####...", "L...L...", ".L..L...", @@ -3403,13 +3403,21 @@ namespace dungeon { "........", "........" }; + string tab4[] = { + "L####L..", + "L....L..", + "L....L..", + "L....L..", + "........", + "........" + }; int y0 = y; if(y>32768) y0 -= 65536; y0 += 5; y0 %= 12; if(y0<0) y0+=12; if(y0 >= 6) { y0 -= 6; x += 4; } - char ch = tab[y0][(x+(y+1)/2)&7]; + char ch = euclid6 ? tab6[y0][(x+(y+1)/2)&7] : tab4[y0][x&7]; if(ch == '#') c->wall = waPlatform; diff --git a/init.cpp b/init.cpp index 7d3e7d96..ba916450 100644 --- a/init.cpp +++ b/init.cpp @@ -352,8 +352,7 @@ void addMessage(string s, char spamtype = 0); #define ALPHA (M_PI*2/S7) #define S7 ginf[geometry].sides #define S3 ginf[geometry].vertex -#define weirdhyperbolic (S7 > 7 || S3 > 3) -#define weirdhyperbolic (S7 > 7 || S3 > 3) +#define weirdhyperbolic ((S7 > 7 || S3 > 3) && hyperbolic) #define stdhyperbolic (S7 == 7 && S3 == 3) #define cgclass (ginf[geometry].cclass)