From 6de0f0a8aac4e6ccd163184763e6e0acbacb53a7 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Tue, 28 Aug 2018 17:17:34 +0200 Subject: [PATCH] instead of nonbitrunc, gp::on and irr::on, there is one variable, variation --- achievement.cpp | 25 ++-- archimedean.cpp | 17 +-- barriers.cpp | 78 ++++++------ bigstuff.cpp | 36 +++--- cell.cpp | 56 ++++---- classes.h | 3 + complex.cpp | 48 +++---- config.cpp | 22 ++-- control.cpp | 2 +- debug.cpp | 2 +- fieldpattern.cpp | 10 +- floorshapes.cpp | 30 ++--- game.cpp | 14 +- geom-exp.cpp | 65 +++++----- geometry.cpp | 14 +- geometry2.cpp | 42 +++--- goldberg.cpp | 54 ++++---- graph.cpp | 60 ++++----- help.cpp | 12 +- heptagon.cpp | 16 +-- hud.cpp | 20 +-- hyper.h | 44 ++++--- hyperpoint.cpp | 6 +- hypgraph.cpp | 12 +- init.cpp | 2 +- irregular.cpp | 13 +- landgen.cpp | 60 ++++----- landlock.cpp | 50 ++++---- mapeditor.cpp | 18 ++- menus.cpp | 7 +- monstergen.cpp | 4 +- pattern2.cpp | 297 +++++++++++++++++++++---------------------- polygons.cpp | 70 +++++----- quit.cpp | 3 +- rogueviz-kohonen.cpp | 2 +- rogueviz.cpp | 4 +- savemem.cpp | 4 +- scores.cpp | 11 +- shmup.cpp | 6 +- system.cpp | 86 +++++++------ textures.cpp | 17 +-- tour.cpp | 21 ++- yendor.cpp | 6 +- 43 files changed, 691 insertions(+), 678 deletions(-) diff --git a/achievement.cpp b/achievement.cpp index 3fda22a5..4fd95a3f 100644 --- a/achievement.cpp +++ b/achievement.cpp @@ -77,11 +77,11 @@ vector achievementsReceived; bool wrongMode(char flags) { if(cheater) return true; if(flags == rg::global) return false; - if(nonbitrunc != (flags == rg::bitrunc)) return true; - if(gp::on) return true; - if(irr::on) return true; + if(CHANGED_VARIATION != (flags == rg::special_variation)) return true; + if(GOLDBERG) return true; + if(IRREGULAR) return true; - if((geometry != gNormal) != (flags == rg::geometry)) return true; + if((geometry != gNormal) != (flags == rg::special_geometry)) return true; if(shmup::on != (flags == rg::shmup)) return true; #if CAP_DAILY @@ -146,10 +146,10 @@ void achievement_collection(eItem it, int prevgold, int newgold) { int q = items[it]; if(it == itTreat && q == 50 && (geometry == gSphere || geometry == gElliptic)) - achievement_gain("HALLOWEEN1", rg::geometry); + achievement_gain("HALLOWEEN1", rg::special_geometry); if(it == itTreat && q == 100 && (geometry == gSphere || geometry == gElliptic)) - achievement_gain("HALLOWEEN2", rg::geometry); + achievement_gain("HALLOWEEN2", rg::special_geometry); if(q == 1) { if(it == itDiamond) achievement_gain("DIAMOND1"); @@ -217,7 +217,7 @@ void achievement_collection(eItem it, int prevgold, int newgold) { // 32 if(it == itHolyGrail) { - if(q == 1) achievement_gain("GRAIL2"), achievement_gain("GRAILH", rg::bitrunc); + if(q == 1) achievement_gain("GRAIL2"), achievement_gain("GRAILH", rg::special_variation); if(q == 3) achievement_gain("GRAIL3"); if(q == 8) achievement_gain("GRAIL4"); } @@ -459,7 +459,7 @@ void achievement_count(const string& s, int current, int prev) { if(s == "LIGHTNING" && current-prev >= 10) achievement_gain("LIGHTNING3"); if(s == "MIRAGE" && current >= 35 && geometry == gEuclid) - achievement_gain("MIRAGE", rg::geometry); + achievement_gain("MIRAGE", rg::special_geometry); if(s == "ORB" && current >= 10) achievement_gain("ORB3"); if(s == "BUG" && current >= 1000) @@ -493,7 +493,7 @@ void achievement_score(int cat, int number) { return; } else if(geometry) return; - if(nonbitrunc) return; + if(CHANGED_VARIATION) return; if(randomPatternsMode) return; if(shmup::on && cat != LB_PURE_TACTICS_SHMUP && cat != LB_PURE_TACTICS_COOP) return; if(yendor::on && cat != LB_YENDOR_CHALLENGE) return; @@ -597,7 +597,7 @@ void achievement_final(bool really_final) { int specialcode = 0; if(shmup::on) specialcode++; if(chaosmode) specialcode+=2; - if(nonbitrunc) specialcode+=4; + if(PURE) specialcode+=4; if(numplayers() > 1) specialcode+=8; if(inv::on) specialcode+=16; @@ -608,8 +608,7 @@ void achievement_final(bool really_final) { } if(geometry) return; - if(gp::on) return; - if(irr::on) return; + if(NONSTDVAR) return; // determine the correct leaderboard ID for 'total score' // or return if no leaderboard for the current mode @@ -684,7 +683,7 @@ void achievement_victory(bool hyper) { #ifdef HAVE_ACHIEVEMENTS if(cheater) return; if(geometry) return; - if(nonbitrunc) return; + if(CHANGED_VARIATION) return; if(randomPatternsMode) return; if(hyper && shmup::on) return; if(yendor::on) return; diff --git a/archimedean.cpp b/archimedean.cpp index c1e55232..85a5b100 100644 --- a/archimedean.cpp +++ b/archimedean.cpp @@ -673,14 +673,14 @@ void draw() { int id = id_of(h); int S = isize(current.triangles[id]); - if(!nonbitrunc || id < 2*current.N) { + if(BITRUNCATED || id < 2*current.N) { if(!dodrawcell(h->c7)) continue; drawcell(h->c7, V, 0, false); } for(int i=0; icmove(i); - if(nonbitrunc && id >= 2*current.N && h->move(i) && id_of(h->move(i)) >= 2*current.N) continue; + if(PURE && id >= 2*current.N && h->move(i) && id_of(h->move(i)) >= 2*current.N) continue; enqueue(h->move(i), V * adjcell_matrix(h, i)); } idx++; @@ -786,9 +786,7 @@ int readArgs() { printf("error: %s\n", at.errormsg.c_str()); } else { - targetgeometry = gArchimedean; - if(targetgeometry != geometry) - stop_game_and_switch_mode(rg::geometry); + set_geometry(gArchimedean); current = at; showstartmenu = false; } @@ -805,16 +803,13 @@ auto hook = #endif int archimedean_tiling::support_threecolor() { - // if(nonbitrunc) return (isize(faces) == 3 && invert[0] && invert[1] && invert[2] && faces[0] % 2 == 0 && faces[1] % 2 == 0 && faces[2] % 2 == 0) ? 2 : tilegroup[N*2] > 1 ? 1 : 0; - // for(int i: faces) if(faces[i] % 2) return tilegroup[N*2] > 1 ? 1 : 0; return 2; } int archimedean_tiling::support_football() { - // if(!nonbitrunc) return 2; return have_ph ? 1 : (isize(faces) == 3 && invert[0] && invert[1] && invert[2] && faces[1] % 2 == 0 && faces[2] % 2 == 0) ? 2 : @@ -840,7 +835,7 @@ bool linespattern(cell *c) { int threecolor(int id) { if(current.have_ph) return !pseudohept(id); - else if(nonbitrunc) + else if(PURE) return current.tilegroup[id]; else { if(current.support_threecolor() == 2) return id < current.N * 2 ? (id&1) : 2; @@ -961,8 +956,8 @@ bool symbol_editing; void enable(archimedean_tiling& arct) { stop_game(); - if(geometry != gArchimedean) targetgeometry = gArchimedean, stop_game_and_switch_mode(rg::geometry); - nonbitrunc = true; need_reset_geometry = true; gp::on = false; irr::on = false; + set_geometry(gArchimedean); + set_variation(eVariation::pure); patterns::whichPattern = patterns::PAT_NONE; #if CAP_TEXTURE if(texture::config.tstate == texture::tsActive && texture::cgroup == cpThree) diff --git a/barriers.cpp b/barriers.cpp index 616cd18f..4ccf3c72 100644 --- a/barriers.cpp +++ b/barriers.cpp @@ -12,19 +12,19 @@ bool checkBarriersFront(cellwalker bb, int q, bool cross) { if(bb.at->mpdist < BARLEV) return false; if(bb.at->mpdist == BUGLEV) return false; if(bb.at->bardir != NODIR) return false; - if(bb.spin == (nonbitrunc ? 3 : 0)) {q--; if(!q) return true; } + if(bb.spin == (PURE ? 3 : 0)) {q--; if(!q) return true; } if(!cross) for(int i=0; i<7; i++) { cellwalker bb2 = bb + i + wstep; if(bb2.at->bardir != NODIR) return false; - if(!nonbitrunc) { + if(!PURE) { bb2 = bb2 + 4 + wstep; if(bb2.at->bardir != NODIR) return false; } } bb += wstep; - if(!nonbitrunc) { bb = bb + 3 + wstep + 3 + wstep; } + if(!PURE) { bb = bb + 3 + wstep + 3 + wstep; } return checkBarriersBack(bb, q); } @@ -50,19 +50,19 @@ bool checkBarriersBack(cellwalker bb, int q, bool cross) { if(!cross) for(int i=0; i<7; i++) { cellwalker bb2 = bb + i + wstep; if(bb2.at->bardir != NODIR) return false; - if(!nonbitrunc) { + if(!PURE) { bb2 = bb2 + 4 + wstep; if(bb2.at->bardir != NODIR) return false; } } - bb = bb + 3 + wstep + (nonbitrunc ? 5 : 4) + wstep + 3; + bb = bb + 3 + wstep + (PURE ? 5 : 4) + wstep + 3; return checkBarriersFront(bb, q); } // warp coasts use a different algorithm when has_nice_dual() is on bool warped_version(eLand l1, eLand l2) { - return (has_nice_dual() && (l1 == laWarpCoast || l1 == laWarpSea || l2 == laWarpSea || l2 == laWarpCoast)) || ((AS3==4) && !nonbitrunc); + return (has_nice_dual() && (l1 == laWarpCoast || l1 == laWarpSea || l2 == laWarpSea || l2 == laWarpCoast)) || (VALENCE == 3); } bool checkBarriersNowall(cellwalker bb, int q, int dir, eLand l1=laNone, eLand l2=laNone) { @@ -94,7 +94,7 @@ bool checkBarriersNowall(cellwalker bb, int q, int dir, eLand l1=laNone, eLand l if(warped_version(l1, l2)) { bb = bb + wstep + (2*dir) + wstep + dir; } - else if(AS3==4) { + else if(VALENCE > 3) { bb = bb + dir + wstep + dir; dir = -dir; swap(l1, l2); @@ -155,7 +155,7 @@ void setland(cell *c, eLand l) { void extendcheck(cell *c) { return; - if(!nonbitrunc && c->landparam == 0 && c->barleft != NOWALLSEP) { + if(BITRUNCATED && c->landparam == 0 && c->barleft != NOWALLSEP) { raiseBuggyGeneration(c, "extend error"); } } @@ -173,7 +173,7 @@ void extendBarrierFront(cell *c) { cellwalker bb(c, c->bardir); setbarrier(bb.at); bb += wstep; - if(!nonbitrunc) { + if(BITRUNCATED) { bb.at->barleft = c->barleft; bb.at->barright = c->barright; setbarrier(bb.at); @@ -209,7 +209,7 @@ void extendBarrierFront(cell *c) { extendBarrier(bb.at); for(int a=-3; a<=3; a++) if(a) { - bb.at = c; bb.spin = c->bardir; bb += (nonbitrunc?-a:a); bb += wstep; + bb.at = c; bb.spin = c->bardir; bb += (PURE?-a:a); bb += wstep; setland(bb.at, a > 0 ? c->barright : c->barleft); } } @@ -221,8 +221,8 @@ void extendBarrierBack(cell *c) { extendcheck(c); cellwalker bb(c, c->bardir); setbarrier(bb.at); - bb = bb + 3 + wstep + (nonbitrunc?5:4); - setland(bb.at, nonbitrunc ? c->barleft : c->barright); + bb = bb + 3 + wstep + (PURE?5:4); + setland(bb.at, PURE ? c->barleft : c->barright); bb = bb + wstep + 3; bb.at->bardir = bb.spin; bb.at->barleft = c->barright; @@ -233,7 +233,7 @@ void extendBarrierBack(cell *c) { //printf("[D heat %d]\n", (ht^11)); // needed for CR2 to work - if(!nonbitrunc) { + if(BITRUNCATED) { auto bb2 = bb + wstep; bb2.at->barleft = c->barright; bb2.at->barright = c->barleft; @@ -257,7 +257,7 @@ void extendNowall(cell *c) { cw += wstep; setland(cw.at, c->barright); } - else if(AS3 == 4) { + else if(VALENCE > 3) { auto cw2 = cw + wstep; setland(cw2.at, c->barright); cw2.at->barleft = NOWALLSEP_USED; @@ -270,7 +270,7 @@ void extendNowall(cell *c) { if(warpv) { cw0 = cw + (2*i) + wstep; } - else if(AS3==4) { + else if(VALENCE > 3) { cw0 = cw + i + wstep + i; } else { @@ -279,7 +279,7 @@ void extendNowall(cell *c) { } if(cw0.at->barleft != NOWALLSEP_USED) { cw0.at->barleft = NOWALLSEP; - if(AS3 == 4 && nonbitrunc) { + if(VALENCE > 3) { cw0.at->barright = c->barright; cw0.at->bardir = cw0.spin; setland(cw0.at, c->land); @@ -304,7 +304,7 @@ void extendNowall(cell *c) { bool gotit = false; void extendCR5(cell *c) { - if(nonbitrunc) return; + if(!BITRUNCATED) return; // if(c->barright == laCrossroads5) extendCR5(c); eLand forbidden = c->barleft; eLand forbidden2 = laNone; @@ -366,14 +366,14 @@ void extendBarrier(cell *c) { if(firstmirror && c->barleft == laMirror && hrand(100) < 60) { cellwalker cw(c, c->bardir); - if(!nonbitrunc) cw += wstep; + if(BITRUNCATED) cw += wstep; if(cw.at->land != laMirrorWall) if(buildBarrier6(cw, 1)) return; } - if(firstmirror && (nonbitrunc?c->barleft == laMirror : c->barright == laMirror) && hrand(100) < 60) { + if(firstmirror && (PURE?c->barleft == laMirror : c->barright == laMirror) && hrand(100) < 60) { cellwalker cw(c, c->bardir); - if(nonbitrunc) { + if(PURE) { cw = cw - 3 + wstep - 3; } else { @@ -388,7 +388,7 @@ void extendBarrier(cell *c) { ) { cellwalker cw(c, c->bardir); - if(nonbitrunc) { + if(PURE) { cw += wstep; if(isbar4(cw.at)) { cw = cw + wstep + 3 + wstep - 1 + wstep; @@ -451,7 +451,7 @@ bool buildBarrier6(cellwalker cw, int type) { if(buggyGeneration) return true; - if(!nonbitrunc) { + if(BITRUNCATED) { b[0] = cw + wstep; b[1] = cw + 1 + wstep + 3 + wstep; b[2] = cw + 4 + wstep; @@ -481,18 +481,18 @@ bool buildBarrier6(cellwalker cw, int type) { } if(type == 1) { - if(!(nonbitrunc?checkBarriersFront:checkBarriersBack)(b[1], 6, true)) return false; - if(!(nonbitrunc?checkBarriersFront:checkBarriersBack)(b[2], 6, true)) return false; + if(!(PURE?checkBarriersFront:checkBarriersBack)(b[1], 6, true)) return false; + if(!(PURE?checkBarriersFront:checkBarriersBack)(b[2], 6, true)) return false; } else { - if(!(nonbitrunc?checkBarriersFront:checkBarriersBack)(b[0], 6, true)) return false; - if(!(nonbitrunc?checkBarriersFront:checkBarriersBack)(b[3], 6, true)) return false; + if(!(PURE?checkBarriersFront:checkBarriersBack)(b[0], 6, true)) return false; + if(!(PURE?checkBarriersFront:checkBarriersBack)(b[3], 6, true)) return false; } for(int d=0; d<4; d++) { b[d].at->bardir = b[d].spin; - if(nonbitrunc) { + if(PURE) { b[0].at->barleft = laMirrored, b[0].at->barright = laMirrored2; b[1].at->barleft = laMirror, b[1].at->barright = laMirrored; b[2].at->barleft = laMirrored2, b[2].at->barright = laMirrored; @@ -505,17 +505,17 @@ bool buildBarrier6(cellwalker cw, int type) { b[3].at->barleft = laMirrored2, b[3].at->barright = laMirrored; } - (nonbitrunc?extendBarrierFront:extendBarrierBack)(b[d].at); + (PURE?extendBarrierFront:extendBarrierBack)(b[d].at); } - if(nonbitrunc && false) { + if(PURE && false) { for(int z=0; z<4; z++) b[z].at->item = eItem(1+z+4*type); for(int a=0; a<4; a++) extendBarrierBack((b[a]+wstep).at); } - if(!nonbitrunc) { + if(BITRUNCATED) { setland((cw+1).cpeek(), laMirrorWall); setland((cw+2).cpeek(), laMirrored); setland((cw+3).cpeek(), laMirrorWall2); @@ -565,9 +565,9 @@ bool buildBarrier4(cell *c, int d, int mode, eLand ll, eLand lr) { cellwalker cd(c, d); cellwalker b1 = cd; - cellwalker b2 = nonbitrunc ? cd + wstep : cd + wstep + 3 + wstep + 3 + wstep; - cellwalker b3 = nonbitrunc ? cd - 1 + wstep + 3 : cd + wstep + 4 + wstep + 4; - cellwalker b4 = nonbitrunc ? cd + 1 + wstep - 3 : cd + wstep - 4 + wstep - 4; + cellwalker b2 = PURE ? cd + wstep : cd + wstep + 3 + wstep + 3 + wstep; + cellwalker b3 = PURE ? cd - 1 + wstep + 3 : cd + wstep + 4 + wstep + 4; + cellwalker b4 = PURE ? cd + 1 + wstep - 3 : cd + wstep - 4 + wstep - 4; if(mode == 0) { if(!((checkBarriersBack(b1) && checkBarriersBack(b2)))) return false; @@ -598,16 +598,16 @@ bool buildBarrier4(cell *c, int d, int mode, eLand ll, eLand lr) { c= b4.at; d=b4.spin; c->bardir = d, c->barleft = ll, c->barright = xr; extendBarrierFront(c); - if(!nonbitrunc) for(int a=-3; a<=3; a++) if(a) { + if(BITRUNCATED) for(int a=-3; a<=3; a++) if(a) { setland((b1+a).cpeek(), a > 0 ? lr : ll); setland((b2+a).cpeek(), a > 0 ? xr : xl); setland((b3+a).cpeek(), a > 0 ? lr : xl); setland((b4+a).cpeek(), a > 0 ? xr : ll); } - if(nonbitrunc) setbarrier(b1.at), setbarrier(b2.at), setbarrier(b3.at), setbarrier(b4.at); + if(PURE) setbarrier(b1.at), setbarrier(b2.at), setbarrier(b3.at), setbarrier(b4.at); - if(!nonbitrunc) { + if(BITRUNCATED) { cell *cp; cp = (b1+wstep).at; cp->barleft = ll; cp->barright = lr; setbarrier(cp); @@ -746,11 +746,11 @@ bool buildBarrierNowall(cell *c, eLand l2, int forced_dir) { for(int j=0; jtype; j++) swap(ds[j], ds[hrand(j+1)]); for(int i=0; itype; i++) { - int d = forced_dir != NODIR ? forced_dir : (AS3>3 && nonbitrunc && !gp::on) ? (2+(i&1)) : ds[i]; -/* if(warpv && gp::on) { + int d = forced_dir != NODIR ? forced_dir : (VALENCE>3) ? (2+(i&1)) : ds[i]; +/* if(warpv && GOLDBERG) { d = hrand(c->type); */ if(warpv && c->move(d) && c->move(d)->mpdist < c->mpdist) continue; - if(gp::on && a4 && c->move(d) && c->move(d)->mpdist <= c->mpdist) continue; + if(GOLDBERG && a4 && c->move(d) && c->move(d)->mpdist <= c->mpdist) continue; /* } else d = (S3>3 && !warpv) ? (2+(i&1)) : dtab[i]; */ diff --git a/bigstuff.cpp b/bigstuff.cpp index af177525..c38fb9c7 100644 --- a/bigstuff.cpp +++ b/bigstuff.cpp @@ -47,7 +47,7 @@ int euclidAlt(short x, short y) { if(specialland == laTemple || specialland == laClearing) { if(euclid6) return max(int(x), x+y); - else if(nonbitrunc) + else if(PURE) return x + abs(y); else return max(x, y); @@ -60,7 +60,7 @@ int euclidAlt(short x, short y) { max(int(x+y), int(y)) + 3), max(int(x), int(-y)) + 3 ); - else if(nonbitrunc) + else if(PURE) return 3 - min(abs(x-y), abs(x+y)); else return 3 - min(abs(x), abs(y)); @@ -107,7 +107,7 @@ void generateAlts(heptagon *h, int levs, bool link_cdata) { if(!h->alt) return; preventbarriers(h->c7); for(int i=0; ic7->move(i)); - if(gp::on) + if(GOLDBERG) for(int i=0; ic7); for(int i=0; ialt, i)->alt = h->alt->alt; @@ -165,7 +165,7 @@ heptagon *createAlternateMap(cell *c, int rad, hstate firststate, int special) { if(weirdhyperbolic) { if(c->bardir == NOBARRIERS) return NULL; forCellEx(c1, c) if(c1->bardir == NOBARRIERS) return NULL; - if(irr::on) + if(IRREGULAR) for(int i=0; imaster, i)->c7->bardir != NODIR) return NULL; @@ -623,7 +623,7 @@ void buildEquidistant(cell *c) { if(c->landparam > 30 && b == laOcean && !generatingEquidistant && hrand(10) < 5 && chance) buildAnotherEquidistant(c); - if(c->landparam > HAUNTED_RADIUS+5 && b == laGraveyard && !generatingEquidistant && hrand(100) < (nonbitrunc?25:5) && items[itBone] >= 10 && chance) + if(c->landparam > HAUNTED_RADIUS+5 && b == laGraveyard && !generatingEquidistant && hrand(100) < (PURE?25:5) && items[itBone] >= 10 && chance) buildAnotherEquidistant(c); } @@ -755,7 +755,7 @@ void setLandSphere(cell *c) { c->land = laElementalWall, c->barleft = laEEarth, c->barright = laEFire; else if(y < 0) c->land = laElementalWall, c->barleft = laEAir, c->barright = laEWater; - if(c->land == laElementalWall && (c->type != 6 || gp::on)) + if(c->land == laElementalWall && (c->type != 6 || GOLDBERG)) c->wall = getElementalWall(hrand(2) ? c->barleft : c->barright); } if(!torus) @@ -766,7 +766,7 @@ void setLandSphere(cell *c) { else if(x == 0 || (specialland == laCrossroads3 && getHemisphere(c, 2) == 0)) setland(c, laBarrier), c->wall = waBarrier; else setland(c, specialland); - if(specialland == laCrossroads3 && c->type != 6 && c->master->fiftyval == 1 && !gp::on) + if(specialland == laCrossroads3 && c->type != 6 && c->master->fiftyval == 1 && !GOLDBERG) c->wall = waBigTree; } if(specialland == laIvoryTower || specialland == laEndorian || specialland == laDungeon || specialland == laOcean || specialland == laMountain) { @@ -970,7 +970,7 @@ int wallchance(cell *c, bool deepOcean) { l == laHaunted ? 0 : (l == laGraveyard && !deepOcean) ? 0 : // (l == laGraveyard && items[itBone] >= 10) ? 120 : - l == laOcean ? (deepOcean ? (nonbitrunc ? 250 : 2000) : 0) : + l == laOcean ? (deepOcean ? (PURE ? 250 : 2000) : 0) : l == laDragon ? 120 : 50; } @@ -981,8 +981,8 @@ bool horo_ok() { } bool gp_wall_test() { - if(gp::on) return hrand(gp::dist_3()) == 0; - if(irr::on) return hrand(irr::cellcount * 3) < isize(irr::cells_of_heptagon); + if(GOLDBERG) return hrand(gp::dist_3()) == 0; + if(IRREGULAR) return hrand(irr::cellcount * 3) < isize(irr::cells_of_heptagon); return true; } @@ -1018,7 +1018,7 @@ void buildBigStuff(cell *c, cell *from) { // buildgreatwalls - if(celldist(c) < 3 && !gp::on) { + if(celldist(c) < 3 && !GOLDBERG) { if(top_land && c == cwt.at->master->move(3)->c7) { buildBarrierStrong(c, 6, true, top_land); } @@ -1059,7 +1059,7 @@ void buildBigStuff(cell *c, cell *from) { else if(weirdhyperbolic) ; // non-Nowall barriers not implemented yet in weird hyperbolic - else if(c->land == laCrossroads2 && !nonbitrunc) + else if(c->land == laCrossroads2 && BITRUNCATED) buildCrossroads2(c); else if(c->land == laPrairie && c->LHU.fi.walldist == 0 && !euclid) { @@ -1119,16 +1119,14 @@ void buildBigStuff(cell *c, cell *from) { if(h) clearing::bpdata[h].root = NULL; } - bool alts_okay = (S3 == 3 || (nonbitrunc && !gp::on)); - - if(alts_okay && c->land == laStorms && ctof(c) && hrand(2000) < 1000 && horo_ok() && !randomPatternsMode) { + if(stdhyperbolic && c->land == laStorms && ctof(c) && hrand(2000) < 1000 && horo_ok() && !randomPatternsMode) { heptagon *h = createAlternateMap(c, 2, hsA); if(h) h->alt->emeraldval = hrand(2); } if(c->land == laOcean && ctof(c) && deepOcean && !generatingEquidistant && !peace::on && horo_ok() && (quickfind(laWhirlpool) || ( - hrand(2000) < (nonbitrunc ? 500 : 1000) && !tactic::on && !yendor::on))) + hrand(2000) < (PURE ? 500 : 1000) && !tactic::on && !yendor::on))) createAlternateMap(c, 2, hsA); if(c->land == laCaribbean && horo_ok() && ctof(c) && !c->master->alt) @@ -1235,7 +1233,7 @@ void moreBigStuff(cell *c) { } if(q == 1) buildCamelotWall(c); // towers of Camelot - if(q == 0 && !nonbitrunc) { + if(q == 0 && BITRUNCATED) { c->monst = moKnight; c->wall = waTower; forCellEx(c2, c) { @@ -1260,7 +1258,7 @@ void moreBigStuff(cell *c) { } if(d == 1) { // roughly as many knights as table cells - if(hrand(nonbitrunc ? 2618 : 1720) < 1000) + if(hrand(PURE ? 2618 : 1720) < 1000) c->monst = moKnight; if(!eubinary) for(int i=0; imaster->move(i)); for(int i=0; itype; i++) @@ -1294,7 +1292,7 @@ void moreBigStuff(cell *c) { c->land = laTemple, c->wall = waNone, c->monst = moNone, c->item = itNone; } if(d % TEMPLE_EACH==0) { - if(weirdhyperbolic && nonbitrunc) { + if(weirdhyperbolic && !BITRUNCATED) { if(hrand(100) < 50) c->wall = waColumn; } else if(pseudohept(c)) diff --git a/cell.cpp b/cell.cpp index 11aaf4d5..89ce5a6a 100644 --- a/cell.cpp +++ b/cell.cpp @@ -62,7 +62,7 @@ hrmap_hyperbolic::hrmap_hyperbolic() { h.cdata = NULL; h.alt = NULL; h.distance = 0; - isnonbitrunc = nonbitrunc; + mvar = variation; if(binarytiling) { #if DEBUG_BINARY_TILING binary::xcode.clear(); @@ -73,7 +73,7 @@ hrmap_hyperbolic::hrmap_hyperbolic() { h.zebraval = 0, h.c7 = newCell(6, origin); } - else if(irr::on) + else if(IRREGULAR) irr::link_start(origin); else h.c7 = newCell(S7, origin); @@ -94,10 +94,10 @@ vector siblings; struct hrmap_spherical : hrmap { heptagon *dodecahedron[12]; - bool isnonbitrunc; + eVariation mvar; hrmap_spherical() { - isnonbitrunc = nonbitrunc; + mvar = variation; for(int i=0; i ph(nonbitrunc, isnonbitrunc); + dynamicval ph(variation, mvar); for(int i=0; i void build_euclidean_moves(cell *c, int vec, const T& builder) { int x, y; tie(x,y) = vec_to_pair(vec); - c->type = a4 ? (nonbitrunc || ((x^y^1) & 1) ? 4 : 8) : 6; + c->type = a4 ? (PURE || ((x^y^1) & 1) ? 4 : 8) : 6; if(c->type == 4) { - int m = nonbitrunc ? 1 : 2; + int m = PURE ? 1 : 2; builder(euclid_getvec(+1,+0), 0, 2 * m); builder(euclid_getvec(+0,+1), 1, 3 * m); builder(euclid_getvec(-1,+0), 2, 0 * m); @@ -723,7 +723,7 @@ struct hrmap_quotient : hrmap { h->fieldval = S7*i; h->rval0 = h->rval1 = 0; h->cdata = NULL; h->distance = 0; - if(!irr::on) h->c7 = newCell(S7, h); + if(!IRREGULAR) h->c7 = newCell(S7, h); } for(int j=0; jmove[j]->alt = createStep(allh[i]->alt, j); */ } - if(irr::on) { + if(IRREGULAR) { irr::link_start(allh[0]); for(int i=0; imove(d)) return c->move(d); - else if(irr::on) { + else if(IRREGULAR) { irr::link_cell(c, d); } - else if(nonbitrunc && gp::on) { + else if(GOLDBERG) { gp::extend_map(c, d); if(!c->move(d)) { printf("extend failed to create for %p/%d\n", c, d); exit(1); } } - else if(nonbitrunc && archimedean) { + else if(PURE && archimedean) { if(arcm::id_of(c->master) <= arcm::current.N * 2) { heptspin hs = heptspin(c->master, d) + wstep + 2 + wstep + 1; c->c.connect(d, hs.at->c7, hs.spin, hs.mirrored); } else c->c.connect(d, c, d, false); } - else if(nonbitrunc || archimedean) { + else if(PURE || archimedean) { heptagon *h2 = createStep(c->master, d); c->c.connect(d, h2->c7,c->master->c.spin(d),false); } @@ -906,12 +906,12 @@ void clearcell(cell *c) { heptagon deletion_marker; template void subcell(cell *c, const T& t) { - if(gp::on) { + if(GOLDBERG) { forCellEx(c2, c) if(c2->move(0) == c && c2 != c2->master->c7) { subcell(c2, t); } } - else if(!nonbitrunc && !archimedean && !binarytiling) + else if(BITRUNCATED && !archimedean && !binarytiling) forCellEx(c2, c) t(c2); t(c); } @@ -921,7 +921,7 @@ void clearHexes(heptagon *at) { delete at->cdata; at->cdata = NULL; } - if(irr::on) irr::clear_links(at); + if(IRREGULAR) irr::clear_links(at); else if(at->c7) subcell(at->c7, clearcell); } @@ -980,7 +980,7 @@ void verifycell(cell *c) { for(int i=0; imove(i); if(c2) { - if(!masterless && !nonbitrunc && c == c->master->c7) verifycell(c2); + if(!masterless && BITRUNCATED && c == c->master->c7) verifycell(c2); if(c2->move(c->c.spin(i)) && c2->move(c->c.spin(i)) != c) { printf("cell error %p:%d [%d] %p:%d [%d]\n", c, i, c->type, c2, c->c.spin(i), c2->type); exit(1); @@ -990,7 +990,7 @@ void verifycell(cell *c) { } void verifycells(heptagon *at) { - if(gp::on || irr::on || archimedean) return; + if(GOLDBERG || IRREGULAR || archimedean) return; for(int i=0; imove(i) && at->move(i)->move(at->c.spin(i)) && at->move(i)->move(at->c.spin(i)) != at) { printf("hexmix error %p [%d s=%d] %p %p\n", at, i, at->c.spin(i), at->move(i), at->move(i)->move(at->c.spin(i))); } @@ -1036,9 +1036,9 @@ int celldist(cell *c) { if(masterless) return eudist(decodeId(c->master)); if(sphere) return celldistance(c, currentmap->gamestart()); - if(irr::on) return irr::celldist(c, false); + if(IRREGULAR) return irr::celldist(c, false); if(binarytiling || archimedean || ctof(c)) return c->master->distance; - if(gp::on) return gp::compute_dist(c, celldist); + if(GOLDBERG) return gp::compute_dist(c, celldist); int dx[MAX_S3]; for(int u=0; umaster->distance; @@ -1065,9 +1065,9 @@ int celldistAlt(cell *c) { return celldist(c) - 3; } if(!c->master->alt) return 0; - if(irr::on) return irr::celldist(c, true); + if(IRREGULAR) return irr::celldist(c, true); if(ctof(c)) return c->master->alt->distance; - if(gp::on) return gp::compute_dist(c, celldistAlt); + if(GOLDBERG) return gp::compute_dist(c, celldistAlt); int dx[MAX_S3]; dx[0] = 0; for(int u=0; umaster->alt == NULL) return ALTDIST_UNKNOWN; @@ -1425,14 +1425,14 @@ map, int> saved_distances; int celldistance(cell *c1, cell *c2) { int d = 0; - if((masterless) && (euclid6 || (euclid4 && nonbitrunc))) { + if((masterless) && (euclid6 || (euclid4 && PURE))) { if(!torus) return eudist(decodeId(c1->master) - decodeId(c2->master)); else if(torus && torusconfig::torus_mode == 0) return torusmap()->dists[torusconfig::vec_to_id(decodeId(c1->master)-decodeId(c2->master))]; } - if(geometry == gFieldQuotient && !gp::on) + if(geometry == gFieldQuotient && !GOLDBERG) return currfp.getdist(fieldpattern::fieldval(c1), fieldpattern::fieldval(c2)); if(sphere || quotient || torus) { @@ -1450,7 +1450,7 @@ int celldistance(cell *c1, cell *c2) { return 64; } - if(gp::on || masterless || irr::on || archimedean || binarytiling) { + if(NONSTDVAR || masterless || archimedean || binarytiling) { if(saved_distances.count(make_pair(c1,c2))) return saved_distances[make_pair(c1,c2)]; @@ -1495,7 +1495,7 @@ int celldistance(cell *c1, cell *c2) { if(ac == xtgt) return d; ac = chosenDown(ac, 1, 1, celldist); if(ac == tgt) return d+2; - if(!nonbitrunc) { + if(BITRUNCATED) { ac = chosenDown(ac, 1, 1, celldist); if(ac == tgt) { if(chosenDown(ac0, 1, 0, celldist) == diff --git a/classes.h b/classes.h index 288eb8c3..4c086ff2 100644 --- a/classes.h +++ b/classes.h @@ -203,6 +203,8 @@ enum eGeometry { enum eGeometryClass { gcHyperbolic, gcEuclid, gcSphere }; +enum class eVariation { bitruncated, pure, goldberg, irregular, dual }; + struct geometryinfo { const char* name; const char* shortname; @@ -226,6 +228,7 @@ static const int SEE_ALL = 50; static const int FORBIDDEN = -1; extern eGeometry geometry; +extern eVariation variation; extern geometryinfo ginf[gGUARD]; diff --git a/complex.cpp b/complex.cpp index c57ed10a..f385fb95 100644 --- a/complex.cpp +++ b/complex.cpp @@ -767,7 +767,7 @@ namespace clearing { } int d = celldistAlt(c); - if(nonbitrunc) { + if(PURE) { for(int i=0; imaster->c7) { c->wall = ((gp::param.second == 0 || gp::param.first == gp::param.second) && hrand(2)) ? waMirror : waCloud; return true; @@ -1068,7 +1068,7 @@ namespace mirror { c->wall = hrand(2) ? waMirror : waCloud; return true; } - if(binarytiling || irr::on) { + if(binarytiling || IRREGULAR) { // mirrors not supported if(is_mirrorland(c)) { c->item = itShard; @@ -1076,7 +1076,7 @@ namespace mirror { } return false; } - if(nonbitrunc?pseudohept(c):!ishept(c)) { + if(PURE?pseudohept(c):!ishept(c)) { c->wall = hrand(2) ? waMirror : waCloud; return true; } @@ -1183,7 +1183,7 @@ namespace mirror { cw.mirrored = !cw.mirrored; cell *c = cw.at; - if(gp::on) { + if(GOLDBERG) { for(int i=0; itype; i++) { heptspin hs(cw.at->master, cw.spin, cw.mirrored); hs = hs + i + wstep + i - (gp::param.first == gp::param.second ? 1 : 0); @@ -1204,7 +1204,7 @@ namespace mirror { create_archimedean(cw, cpid, false); return; } - if(gp::on && !(S7 & 1)) { + if(GOLDBERG && !(S7 & 1)) { for(int i=0; itype; i++) { heptspin hs(cw.at->master, cw.spin, cw.mirrored); hs = hs + i + wstep + 1 + wstep + 1 + (S7/2) - i + 1; @@ -1212,7 +1212,7 @@ namespace mirror { } return; } - if(gp::on && (S7 & 1)) { + if(GOLDBERG && (S7 & 1)) { for(int i=0; itype; i++) { heptspin hs(cw.at->master, cw.spin, cw.mirrored); hs = hs + i + wstep + (S7/2) + wstep - 2 + wstep + (S7/2) - i; @@ -1220,17 +1220,17 @@ namespace mirror { } return; } - if(nonbitrunc && !(S7 & 1)) { + if(PURE && !(S7 & 1)) { for(int i=0; itype; i++) createMirror(cw + i + wstep + 1 + wstep + 1 + (S7/2) - i, cpid); return; } - if(nonbitrunc && (S7 & 1) && (S3 == 4)) { + if(PURE && (S7 & 1) && (S3 == 4)) { for(int i=0; itype; i++) createMirror(cw + i + wstep + 1 + wstep - (S7/2) + wstep - (S7/2) - i, cpid); return; } - if(nonbitrunc && (S7 & 1)) { + if(PURE && (S7 & 1)) { for(int i=0; itype; i++) createMirror(cw + i + wstep + (S7/2) + wstep - 2 + wstep + (S7/2) - i, cpid); return; @@ -1416,9 +1416,9 @@ namespace mirror { v.push_back(1); stepcount++; if(stepcount > 10000) { printf("failhep\n"); return cw; } } - if(nonbitrunc && (cw+wstep).at == cwcopy.at) + if(PURE && (cw+wstep).at == cwcopy.at) v.pop_back(); - if(nonbitrunc && (cw+3+wstep).at->land == laMirrored && (cw+2+wstep).at->land == laMirrorWall) { + if(PURE && (cw+3+wstep).at->land == laMirrored && (cw+2+wstep).at->land == laMirrorWall) { cw += wmirror; auto p = traceback(v, cw); if(p.first) return p.second; @@ -1921,7 +1921,7 @@ namespace heat { cell *c = playerpos(i); if(!c) continue; double xrate = (c->land == laCocytus && shmup::on) ? rate/3 : rate; - if(nonbitrunc) xrate *= 1.7; + if(PURE) xrate *= 1.7; // todo-variation if(!shmup::on) xrate /= FIX94; if(isIcyLand(c)) HEAT(c) += (markOrb(itOrbWinter) ? -1.2 : 1.2) * xrate; @@ -1936,7 +1936,7 @@ namespace heat { for(int i=0; iland == laCocytus && shmup::on) ? 1/3. : 1; - if(nonbitrunc) xrate *= 1.7; + if(PURE) xrate *= 1.7; // todo-variation if(!shmup::on) xrate /= FIX94; if(c->cpdist > gr && !doall) break; @@ -2623,7 +2623,7 @@ namespace sword { } void shuffle(int i) { - sword::angle[i] = euclid ? S7*hrand(6) : nonbitrunc ? 3*hrand(S14)+1 : hrand(S42); + sword::angle[i] = euclid ? S7*hrand(6) : PURE ? 3*hrand(S14)+1 : hrand(S42); } void reset() { @@ -2808,7 +2808,7 @@ namespace prairie { c->LHU.fi.rval = (y&15); } else if(sphere) { - c->LHU.fi.rval = celldistance(c, cwt.at) + 8 - (nonbitrunc ? 2 : 3); + c->LHU.fi.rval = celldistance(c, cwt.at) + 8 - (PURE ? 2 : 3); } else if(weirdhyperbolic) { c->LHU.fi.rval = max(celldist(c), 15); @@ -2870,8 +2870,8 @@ namespace prairie { } } - #define RLOW (sphere?(nonbitrunc?7:6):nonbitrunc?4:2) - #define RHIGH (sphere?(nonbitrunc?8:9):nonbitrunc?11:13) + #define RLOW (sphere?(PURE?7:6):PURE?4:2) + #define RHIGH (sphere?(PURE?8:9):PURE?11:13) bool no_worms(cell *c) { int rv = c->LHU.fi.rval; @@ -3036,7 +3036,7 @@ namespace prairie { else if(!enter && isriver(cwt.at)) enter = cwt.at; if(isize(tchoices)) { if(lasttreasure && lasttreasure->item == itGreenGrass) { - if(celldistance(lasttreasure, cwt.at) >= (nonbitrunc ? 7 : 10)) { + if(celldistance(lasttreasure, cwt.at) >= (PURE ? 7 : 10)) { lasttreasure->item = itNone; forCellEx(c2, lasttreasure) if(c2->item == itGreenGrass) c2->item = itNone; } @@ -3199,14 +3199,14 @@ namespace windmap { // cw.spin = 0; neighbors.emplace_back(); auto &v = neighbors.back(); - if((gp::on || irr::on) && !sphere) + if(sphere && STDVAR) + for(int l=0; ltype; l++) v.push_back(getId(cw+l+wstep)); + else for(int l=0; lmaster, cw.spin); hs = hs + l + wstep; v.push_back(getId(cellwalker(hs.at->c7, hs.spin))); } - else - for(int l=0; ltype; l++) v.push_back(getId(cw+l+wstep)); } int N = isize(samples); @@ -3463,7 +3463,7 @@ namespace halloween { else if(CHANCE(5) && itr >= 60) { dragoncount++; } - else if(dragoncount && !nonbitrunc && !mcount) { + else if(dragoncount && BITRUNCATED && !mcount) { bool fill = false; for(int i=0; i<4; i++) if(!dragoncells[i] || dragoncells[i]->monst) diff --git a/config.cpp b/config.cpp index f0c9ce12..700ed6af 100644 --- a/config.cpp +++ b/config.cpp @@ -239,7 +239,7 @@ void initConfig() { addsaver(hardcore, "mode-hardcore", false); addsaver(chaosmode, "mode-chaos"); addsaver(inv::on, "mode-Orb Strategy"); - addsaver(nonbitrunc, "mode-heptagonal", false); + addsaverenum(variation, "mode-variation", eVariation::bitruncated); addsaver(peace::on, "mode-peace"); addsaver(peace::otherpuzzles, "mode-peace-submode"); addsaverenum(specialland, "land for special modes"); @@ -257,14 +257,12 @@ void initConfig() { addsaver(vid.stretch, "stretch", 1); addsaver(vid.binary_width, "binary-tiling-width", 1); - addsaver(gp::on, "goldberg", false); addsaver(gp::param.first, "goldberg-x", gp::param.first); addsaver(gp::param.second, "goldberg-y", gp::param.second); addsaver(nohud, "no-hud", false); addsaver(nofps, "no-fps", false); - addsaver(irr::on, "irregular", false); addsaver(irr::density, "irregular-density", 2); addsaver(irr::cellcount, "irregular-cellcount", 150); addsaver(irr::quality, "irregular-quality", .2); @@ -288,7 +286,7 @@ void initConfig() { } bool inSpecialMode() { - return chaosmode || nonbitrunc || peace::on || + return chaosmode || !BITRUNCATED || peace::on || #if CAP_TOUR tour::on || #endif @@ -306,7 +304,7 @@ bool have_current_settings() { if(tour::on) modecount += 10; #endif if(chaosmode) modecount += 10; - if(nonbitrunc) modecount += 10; + if(!BITRUNCATED) modecount += 10; if(peace::on) modecount += 10; if(yendor::on) modecount += 10; if(tactic::on) modecount += 10; @@ -329,8 +327,7 @@ void resetModes(char leave) { if(shmup::on != (leave == rg::shmup)) stop_game_and_switch_mode(rg::shmup); if(inv::on != (leave == rg::inv)) stop_game_and_switch_mode(rg::inv); if(chaosmode != (leave == rg::chaos)) stop_game_and_switch_mode(rg::chaos); - if(gp::on != (leave == rg::gp)) stop_game_and_switch_mode(rg::gp); - if(nonbitrunc != (leave == rg::bitrunc)) stop_game_and_switch_mode(rg::bitrunc); + if(peace::on != (leave == rg::peace)) stop_game_and_switch_mode(rg::peace); #if CAP_TOUR if(tour::on != (leave == rg::tour)) stop_game_and_switch_mode(rg::tour); @@ -346,10 +343,8 @@ void resetModes(char leave) { firstland = laIce; specialland = laIce; stop_game_and_switch_mode(); } - if(geometry != gNormal && leave != rg::geometry) { - targetgeometry = gNormal; - stop_game_and_switch_mode(rg::geometry); - } + set_geometry(gNormal); + set_variation(eVariation::bitruncated); pmodel = mdDisk; vid.alpha = 1; vid.scale = 1; vid.xposition = vid.yposition = 0; @@ -443,7 +438,7 @@ void loadOldConfig(FILE *f) { shmup::loadConfig(f); - aa = rug::renderonce; bb = rug::rendernogl; cc = nonbitrunc; dd = chaosmode; + aa = rug::renderonce; bb = rug::rendernogl; dd = chaosmode; int ee = vid.steamscore; #if CAP_RUG double rs = 2/rug::model_distance; @@ -451,7 +446,8 @@ void loadOldConfig(FILE *f) { double rs = 0; #endif err=fscanf(f, "%d%d%d%d%lf%d%d", &aa, &bb, &rug::texturesize, &cc, &rs, &ee, &dd); - rug::renderonce = aa; rug::rendernogl = bb; nonbitrunc = cc; chaosmode = dd; vid.steamscore = ee; + rug::renderonce = aa; rug::rendernogl = bb; + chaosmode = dd; vid.steamscore = ee; #if CAP_RUG rug::model_distance = 2/rs; #endif diff --git a/control.cpp b/control.cpp index 923a8791..dad030a9 100644 --- a/control.cpp +++ b/control.cpp @@ -978,7 +978,7 @@ void show() { dialog::addItem(XLAT("spherical VR"), 'v'); dialog::add_action([] () { - if(!sphere) { targetgeometry = gSphere; restart_game(rg::geometry); } + if(!sphere) set_geometry(gSphere); mode = 0; fullcenter(); mode = 2; sensitivity = 1; stereo::mode = stereo::sLR; stereo::ipd = 0.2; diff --git a/debug.cpp b/debug.cpp index 877bdc53..b22bc36c 100644 --- a/debug.cpp +++ b/debug.cpp @@ -334,7 +334,7 @@ void debugScreen() { dialog::addSelItem("pathdist", its(mouseover->pathdist), 0); dialog::addSelItem("celldistAlt", mouseover->master->alt ? its(celldistAlt(mouseover)) : "--", 0); dialog::addSelItem("temporary", its(mouseover->listindex), 0); - if(gp::on) + if(GOLDBERG) dialog::addSelItem("whirl", gp::disp(gp::get_local_info(mouseover).relative), 0); if(archimedean) dialog::addSelItem("ID", its(arcm::id_of(mouseover->master)), 0); diff --git a/fieldpattern.cpp b/fieldpattern.cpp index 0c3198a6..571a55b5 100644 --- a/fieldpattern.cpp +++ b/fieldpattern.cpp @@ -386,7 +386,7 @@ struct fpattern { dists[at] = i; for(int q=0; q &shv, int col, PPR prio = PPR::DEFAULT) { if(!c) queuepolyat(V, shv[0], col, prio); - else if(gp::on) { + else if(GOLDBERG) { int id = gp::get_plainshape_id(c); queuepolyat(V, shv[id], col, prio); } - else if(irr::on) { + else if(IRREGULAR) { int id = irr::cellindex[c]; if(id < 0 || id >= isize(shv)) { return; @@ -620,9 +620,9 @@ void draw_shapevec(cell *c, const transmatrix& V, const vector &shv, i else if(archimedean) { queuepolyat(V, shv[arcm::id_of(c->master)], col, prio); } - else if((euclid || gp::on) && ishex1(c)) + else if((euclid || GOLDBERG) && ishex1(c)) queuepolyat(V * pispin, shv[0], col, prio); - else if(!(S7&1) && nonbitrunc) { + else if(!(S7&1) && PURE) { auto si = patterns::getpatterninfo(c, patterns::PAT_COLORING, 0); if(si.id == 8) si.dir++; transmatrix D = applyPatterndir(c, si); diff --git a/game.cpp b/game.cpp index 0bbf729c..c3d8e6a5 100644 --- a/game.cpp +++ b/game.cpp @@ -2183,7 +2183,7 @@ void killMonster(cell *c, eMonster who, flagtype deathflags) { for(int i=0; itype; i++) { cell *c2 = c->move(i); if(c2 && c2->item == itCompass) toomany = true; - if(c2 && !nonbitrunc) for(int j=0; jtype; j++) + if(c2 && BITRUNCATED) for(int j=0; jtype; j++) if(c2->move(j) && c2->move(j)->item == itCompass) toomany = true; } @@ -3187,10 +3187,10 @@ void toggleGates(cell *c, eWall type, int rad) { void toggleGates(cell *ct, eWall type) { playSound(ct, "click"); numgates = 0; - if(type == waClosePlate && nonbitrunc && !gp::on) + if(type == waClosePlate && PURE) toggleGates(ct, type, 2); else - toggleGates(ct, type, (gp::on && !sphere && !a4) ? gp::dist_3() : 3); + toggleGates(ct, type, (GOLDBERG && !sphere && !a4) ? gp::dist_3() : 3); if(numgates && type == waClosePlate) playSound(ct, "closegate"); if(numgates && type == waOpenPlate) @@ -4300,7 +4300,7 @@ void moveWorm(cell *c) { addMessage(XLAT("The sandworm explodes!")); playSound(NULL, "explosion"); if(geometry == gZebraQuotient) - achievement_gain("ZEBRAWORM", rg::geometry); + achievement_gain("ZEBRAWORM", rg::special_geometry); } return; } @@ -6936,11 +6936,11 @@ ld circlesizeD[10000]; int lastsize; bool sizes_known() { - return euclid || (geometry == gNormal && !gp::on && !irr::on); + return euclid || (geometry == gNormal && STDVAR); } void computeSizes() { - lastsize = nonbitrunc ? 44 : 76; + lastsize = PURE ? 44 : 76; circlesize[0] = 1; @@ -6948,7 +6948,7 @@ void computeSizes() { for(int i=1; i<100; i++) circlesize[i] = 6 * i; } - else if(!nonbitrunc) { + else if(BITRUNCATED) { circlesize[1] = 1*7; circlesize[2] = 2*7; circlesize[3] = 4*7; diff --git a/geom-exp.cpp b/geom-exp.cpp index 49cceb73..4fd5b48b 100644 --- a/geom-exp.cpp +++ b/geom-exp.cpp @@ -73,15 +73,15 @@ void showQuotientConfig() { else if(uni == 'p') nextPrime(gxcur); else if(uni == 'x' || uni == '\n') { - targetgeometry = gxcur.base; stop_game_and_switch_mode(rg::geometry); + set_geometry(gxcur.base); enableFieldChange(); - targetgeometry = gFieldQuotient; stop_game_and_switch_mode(rg::geometry); + set_geometry(gFieldQuotient); start_game(); } else if(uni == 'c') { - targetgeometry = gEuclid; stop_game_and_switch_mode(rg::geometry); + set_geometry(gEuclid); fieldpattern::quotient_field_changed = false; - targetgeometry = gFieldQuotient; stop_game_and_switch_mode(rg::geometry); + set_geometry(gFieldQuotient); start_game(); } else if(doexiton(sym, uni)) @@ -188,23 +188,23 @@ void showTorusConfig() { else if(uni == 't') torus_bitrunc = !torus_bitrunc; else if((uni == 'a' || uni == '\n') && torusconfig::newqty >= 3 && valid) { - targetgeometry = gNormal; stop_game_and_switch_mode(rg::geometry); + set_geometry(gNormal); torusconfig::torus_mode = torusconfig::newmode; torusconfig::qty = torusconfig::newqty; torusconfig::dy = torusconfig::newdy; torusconfig::sdx = torusconfig::newsdx; torusconfig::sdy = torusconfig::newsdy; torusconfig::activate(); - if((square && torus_bitrunc) != nonbitrunc) stop_game_and_switch_mode(rg::bitrunc); - targetgeometry = gTorus; stop_game_and_switch_mode(rg::geometry); + set_geometry(gTorus); + set_variation((torus_bitrunc || !square) ? eVariation::bitruncated : eVariation::pure); start_game(); } else if(uni == 'c') { - targetgeometry = gEuclid; stop_game_and_switch_mode(rg::geometry); + set_geometry(gEuclid); torusconfig::torus_mode = torusconfig::tmSingle; torusconfig::qty = torusconfig::def_qty; torusconfig::dy = torusconfig::def_dy; - targetgeometry = gTorus; stop_game_and_switch_mode(rg::geometry); + set_geometry(gTorus); start_game(); } else if(uni == 'z') editScale(); @@ -218,7 +218,7 @@ void showTorusConfig() { dialog::display(); } -string bitruncnames[2] = {" (b)", " (n)"}; +string bitruncnames[5] = {" (b)", " (n)", " (g)", " (i)", " (d)"}; void validity_info() { int vccolors[4] = {0xFF0000, 0xFF8000, 0xFFFF00, 0x00FF00}; @@ -260,10 +260,10 @@ void showEuclideanMenu() { int ts = ginf[geometry].sides; int tv = ginf[geometry].vertex; int tq = ginf[geometry].quotientstyle; - int nom = (nonbitrunc ? tv : tv+ts) * ((tq & qNONORIENTABLE) ? 2 : 4); + int nom = (BITRUNCATED ? tv+ts : tv) * ((tq & qNONORIENTABLE) ? 2 : 4); int denom = (2*ts + 2*tv - ts * tv); - if(gp::on) { + if(GOLDBERG) { denom *= 2; nom = nom / tv * (2*tv + ts * (gp::area-1)); if(nom % 2 == 0) nom /= 2, denom /= 2; @@ -290,11 +290,8 @@ void showEuclideanMenu() { dialog::addSelItem(XLAT("width"), fts(vid.binary_width), 'v'); else if(archimedean) dialog::addSelItem(XLAT("variations"), XLAT("Not implemented."), 'v'); - else { - dialog::addBoolItem(XLAT("variations"), nonbitrunc, 'v'); - dialog::lastItem().value = gp::operation_name(); - } - + else + dialog::addSelItem(XLAT("variations"), gp::operation_name(), 'v'); dialog::addBreak(25); validity_info(); @@ -303,8 +300,8 @@ void showEuclideanMenu() { int worldsize; int gar = - gp::on ? gp::area - 1 : - nonbitrunc ? 0 : + GOLDBERG ? gp::area - 1 : + PURE ? 0 : 2; switch(geometry) { @@ -389,11 +386,11 @@ void showEuclideanMenu() { keyhandler = [] (int sym, int uni) { dialog::handleNavigation(sym, uni); if(uni >= 'a' && uni < 'a'+gGUARD) { - targetgeometry = eGeometry(uni - 'a'); + eGeometry targetgeometry = eGeometry(uni - 'a'); if(targetgeometry == gArchimedean) pushScreen(arcm::show); else { - stop_game_and_switch_mode(geometry == targetgeometry ? rg::nothing : rg::geometry); + set_geometry(targetgeometry); start_game(); } } @@ -410,12 +407,12 @@ void showEuclideanMenu() { #endif }; } + else if(euclid4) { + set_variation(PURE ? eVariation::bitruncated : eVariation::pure); + start_game(); + } else // if(S3 == 3) gp::configure(); - /* else { - stop_game_and_switch_mode(rg::bitrunc); - start_game(); - } */ } else if(uni == '2' || sym == SDLK_F1) gotoHelp(euchelp); else if(uni == '3') { viewdists = !viewdists; if(viewdists) popScreenAll(); } @@ -438,7 +435,7 @@ void showEuclideanMenu() { torusconfig::newsdx = torusconfig::sdx, torusconfig::newsdy = torusconfig::sdy, torusconfig::newmode = torusconfig::torus_mode, - torus_bitrunc = nonbitrunc, + torus_bitrunc = PURE, pushScreen(showTorusConfig); else if(geometry == gFieldQuotient) pushScreen(showQuotientConfig); @@ -450,7 +447,7 @@ void showEuclideanMenu() { else { dialog::init(XLAT("experiment with geometry")); - dialog::addSelItem(XLAT("geometry"), XLAT(ginf[geometry].name) + XLAT(bitruncnames[nonbitrunc]), '5'); + dialog::addSelItem(XLAT("geometry"), XLAT(ginf[geometry].name) + XLAT(bitruncnames[int(variation)]), '5'); dialog::addBreak(50); generateLandList([] (eLand l) { return land_validity(l).flags & lv::appears_in_geom_exp; }); @@ -552,9 +549,7 @@ int read_geom_args() { fgeomextras[current_extra].current_prime_id = b; enableFieldChange(); - if(geometry != gFieldQuotient) { - targetgeometry = gFieldQuotient; stop_game_and_switch_mode(rg::geometry); - } + set_geometry(gFieldQuotient); } else if(argis("-cs")) { shift(); cheat(); @@ -586,19 +581,17 @@ int read_geom_args() { torusconfig::dy = torusconfig::sdy; torusconfig::activate(); } - TOGGLE('7', nonbitrunc, stop_game_and_switch_mode(rg::bitrunc)) + TOGGLE('7', PURE, set_variation(PURE ? eVariation::bitruncated : eVariation::pure)) else if(argis("-geo")) { PHASEFROM(2); - shift(); targetgeometry = (eGeometry) argi(); - if(targetgeometry != geometry) - stop_game_and_switch_mode(rg::geometry); + shift(); + set_geometry((eGeometry) argi()); } else if(argis("-gp")) { PHASEFROM(2); - stop_game_and_switch_mode(rg::nothing); shift(); gp::param.first = argi(); shift(); gp::param.second = argi(); - stop_game_and_switch_mode(rg::gp); + set_variation(eVariation::goldberg); } else if(argis("-fi")) { fieldpattern::info(); diff --git a/geometry.cpp b/geometry.cpp index 048cf823..7982d446 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -52,7 +52,7 @@ void precalc() { // dynamicval g(geometry, gNormal); // precalc(); } // for(int i=0; i(4 * gp::scale, 1); return wall_height; } diff --git a/geometry2.cpp b/geometry2.cpp index 3db0457a..1c3b95eb 100644 --- a/geometry2.cpp +++ b/geometry2.cpp @@ -20,12 +20,12 @@ void fixelliptic(hyperpoint& h) { } transmatrix master_relative(cell *c, bool get_inverse) { - if(irr::on) { + if(IRREGULAR) { int id = irr::cellindex[c]; ld alpha = 2 * M_PI / S7 * irr::periodmap[c->master].base.spin; return get_inverse ? irr::cells[id].rpusher * spin(-alpha-master_to_c7_angle()): spin(alpha + master_to_c7_angle()) * irr::cells[id].pusher; } - else if(gp::on) { + else if(GOLDBERG) { if(c == c->master->c7) { return spin((get_inverse?-1:1) * master_to_c7_angle()); } @@ -36,7 +36,7 @@ transmatrix master_relative(cell *c, bool get_inverse) { return T; } } - else if(!nonbitrunc && !euclid) { + else if(BITRUNCATED && !euclid) { for(int d=0; dmaster->c7->move(d) == c) return (get_inverse?invhexmove:hexmove)[d]; return Id; @@ -196,11 +196,11 @@ transmatrix calc_relative_matrix_help(cell *c, heptagon *h1) { transmatrix gm = Id; heptagon *h2 = c->master; transmatrix where = Id; - if(gp::on && c != c->master->c7) { + if(GOLDBERG && c != c->master->c7) { auto li = gp::get_local_info(c); where = gp::Tf[li.last_dir][li.relative.first&31][li.relative.second&31][fix6(li.total_dir)]; } - else if(!nonbitrunc) for(int d=0; dc7->move(d) == c) + else if(BITRUNCATED) for(int d=0; dc7->move(d) == c) where = hexmove[d]; // always add to last! while(h1 != h2) { @@ -278,7 +278,7 @@ void virtualRebase(cell*& base, T& at, bool tohex, const U& check) { at = bestV * at; } else { - if(tohex && !nonbitrunc) for(int d=0; dc.spin(d)*2*M_PI/S6) * invhexmove[d]; double newz = check(V2 *at) [2]; @@ -343,12 +343,12 @@ void virtualRebaseSimple(heptagon*& base, transmatrix& at) { } double cellgfxdist(cell *c, int i) { - if(gp::on || irr::on) return hdist0(tC0(calc_relative_matrix(c->move(i), c, i))); - return nonbitrunc ? tessf * gp::scale : (c->type == 6 && (i&1)) ? hexhexdist : crossf; + if(NONSTDVAR) return hdist0(tC0(calc_relative_matrix(c->move(i), c, i))); + return !BITRUNCATED ? tessf * gp::scale : (c->type == 6 && (i&1)) ? hexhexdist : crossf; } transmatrix cellrelmatrix(cell *c, int i) { - if(gp::on) return calc_relative_matrix(c->move(i), c, i); + if(NONSTDVAR) return calc_relative_matrix(c->move(i), c, i); double d = cellgfxdist(c, i); return ddspin(c, i) * xpush(d) * iddspin(c->move(i), c->c.spin(i), euclid ? 0 : M_PI); } @@ -356,7 +356,7 @@ transmatrix cellrelmatrix(cell *c, int i) { double randd() { return (rand() + .5) / (RAND_MAX + 1.); } hyperpoint randomPointIn(int t) { - if(irr::on || gp::on || archimedean) { + if(NONSTDVAR || archimedean) { // Let these geometries be less confusing. // Also easier to implement ;) return xspinpush0(2 * M_PI * randd(), asinh(randd() / 20)); @@ -364,7 +364,7 @@ hyperpoint randomPointIn(int t) { while(true) { hyperpoint h = xspinpush0(2*M_PI*(randd()-.5)/t, asinh(randd())); double d = - nonbitrunc ? tessf : t == 6 ? hexhexdist : crossf; + PURE ? tessf : t == 6 ? hexhexdist : crossf; if(hdist0(h) < hdist0(xpush(-d) * h)) return spin(2*M_PI/t * (rand() % t)) * h; } @@ -375,8 +375,8 @@ hyperpoint get_horopoint(ld y, ld x) { } hyperpoint get_corner_position(cell *c, int cid, ld cf) { - if(gp::on) return gp::get_corner_position(c, cid, cf); - if(irr::on) { + if(GOLDBERG) return gp::get_corner_position(c, cid, cf); + if(IRREGULAR) { auto& vs = irr::cells[irr::cellindex[c]]; return mid_at_actual(vs.vertices[cid], 3/cf); } @@ -400,10 +400,10 @@ hyperpoint get_corner_position(cell *c, int cid, ld cf) { auto& t = ac.get_triangle(c->master, cid-1); return xspinpush0(-t.first, t.second * 3 / cf * (ac.real_faces == 0 ? 0.999 : 1)); } - if(nonbitrunc) { + if(PURE) { return ddspin(c,cid,M_PI/S7) * xpush0(hcrossf * 3 / cf); } - if(!nonbitrunc) { + if(BITRUNCATED) { if(!ishept(c)) return ddspin(c,cid,M_PI/S6) * xpush0(hexvdist * 3 / cf); else @@ -413,14 +413,14 @@ hyperpoint get_corner_position(cell *c, int cid, ld cf) { } hyperpoint nearcorner(cell *c, int i) { - if(gp::on) { + if(GOLDBERG) { cellwalker cw(c, i); cw += wstep; transmatrix cwm = calc_relative_matrix(cw.at, c, i); if(elliptic && cwm[2][2] < 0) cwm = centralsym * cwm; return cwm * C0; } - if(irr::on) { + if(IRREGULAR) { auto& vs = irr::cells[irr::cellindex[c]]; hyperpoint nc = vs.jpoints[vs.neid[i]]; return mid_at(C0, nc, .94); @@ -454,7 +454,7 @@ hyperpoint nearcorner(cell *c, int i) { } hyperpoint farcorner(cell *c, int i, int which) { - if(gp::on) { + if(GOLDBERG) { cellwalker cw(c, i); int hint = cw.spin; cw += wstep; @@ -467,7 +467,7 @@ hyperpoint farcorner(cell *c, int i, int which) { if(which == 1) return cwm * get_corner_position(li1, (cw-1).spin); } - if(irr::on) { + if(IRREGULAR) { auto& vs = irr::cells[irr::cellindex[c]]; int neid = vs.neid[i]; int spin = vs.spin[i]; @@ -500,8 +500,8 @@ hyperpoint midcorner(cell *c, int i, ld v) { hyperpoint get_warp_corner(cell *c, int cid) { // midcorner(c, cid, .5) but sometimes easier versions exist - if(gp::on) return gp::get_corner_position(c, cid, 2); - if(irr::on || archimedean) return midcorner(c, cid, .5); + if(GOLDBERG) return gp::get_corner_position(c, cid, 2); + if(IRREGULAR || archimedean) return midcorner(c, cid, .5); return ddspin(c,cid,M_PI/S7) * xpush0(tessf/2); } diff --git a/goldberg.cpp b/goldberg.cpp index 7abfea71..7124720c 100644 --- a/goldberg.cpp +++ b/goldberg.cpp @@ -1,5 +1,4 @@ namespace hr { namespace gp { - bool on; loc param(1, 0); hyperpoint next; @@ -578,7 +577,7 @@ namespace hr { namespace gp { void compute_geometry() { center_locs.clear(); - if(on) { + if(GOLDBERG) { int x = param.first; int y = param.second; area = ((2*x+y) * (2*x+y) + y*y*3) / 4; @@ -626,11 +625,12 @@ namespace hr { namespace gp { } string operation_name() { - if(!gp::on) { - if(irr::on) return XLAT("irregular"); - else if(nonbitrunc) return XLAT("OFF"); - else return XLAT("bitruncated"); - } + if(IRREGULAR) + return XLAT("irregular"); + else if(PURE) + return XLAT("OFF"); + else if(BITRUNCATED) + return XLAT("bitruncated"); else if(param == loc(1, 0)) return XLAT("OFF"); else if(param == loc(1, 1) && S3 == 3) @@ -657,18 +657,15 @@ namespace hr { namespace gp { auto g = screens; if(xy.first == 0 && xy.second == 0) xy.first = 1; if(xy.first == 1 && xy.second == 0) { - if(irr::on) stop_game_and_switch_mode(rg::bitrunc); - if(gp::on) stop_game_and_switch_mode(rg::bitrunc); - if(!nonbitrunc) stop_game_and_switch_mode(rg::bitrunc); + stop_game(); set_variation(eVariation::pure); } else if(xy.first == 1 && xy.second == 1 && S3 == 3) { - if(gp::on) stop_game_and_switch_mode(rg::bitrunc); - if(nonbitrunc) stop_game_and_switch_mode(rg::bitrunc); + stop_game(); set_variation(eVariation::bitruncated); } else { - if(nonbitrunc) stop_game_and_switch_mode(rg::bitrunc); + if(param != xy) need_reset_geometry = true; param = xy; - stop_game_and_switch_mode(rg::gp); + stop_game(); set_variation(eVariation::goldberg); } start_game(); screens = g; @@ -702,13 +699,13 @@ namespace hr { namespace gp { } #endif if(min_quality == 0 && min_quality_chess == 0) { - dialog::addBoolItem(XLAT("OFF"), param == loc(1,0) && !irr::on, 'a'); + dialog::addBoolItem(XLAT("OFF"), param == loc(1,0) && !IRREGULAR, 'a'); dialog::lastItem().value = "GP(1,0)"; } if(min_quality_chess == 0) - dialog::addBoolItem(XLAT("bitruncated"), param == loc(1,1) && !nonbitrunc, 'b'); - dialog::lastItem().value = S3 == 3 ? "GP(1,1)" : XLAT(nonbitrunc ? "OFF" : "ON"); + dialog::addBoolItem(XLAT("bitruncated"), param == loc(1,1) && BITRUNCATED, 'b'); + dialog::lastItem().value = S3 == 3 ? "GP(1,1)" : XLAT(BITRUNCATED ? "ON" : "OFF"); if(min_quality == 0 || min_quality_chess) { dialog::addBoolItem(XLAT(S3 == 3 ? "chamfered" : "expanded"), param == loc(2,0), 'c'); @@ -720,7 +717,7 @@ namespace hr { namespace gp { dialog::lastItem().value = "GP(3,0)"; } else { - dialog::addBoolItem(XLAT("rectified"), param == loc(1,1) && nonbitrunc, 'd'); + dialog::addBoolItem(XLAT("rectified"), param == loc(1,1) && GOLDBERG, 'd'); dialog::lastItem().value = "GP(1,1)"; } @@ -736,13 +733,13 @@ namespace hr { namespace gp { else if((config.first-config.second)%2 && min_quality_chess) dialog::addInfo(XLAT("This pattern needs x-y divisible by 2")); else - dialog::addBoolItem(XLAT("select"), param == internal_representation(config) && !irr::on, 'f'); + dialog::addBoolItem(XLAT("select"), param == internal_representation(config) && !IRREGULAR, 'f'); if(irr::supports(geometry)) { - dialog::addBoolItem(XLAT("irregular"), irr::on, 'i'); + dialog::addBoolItem(XLAT("irregular"), IRREGULAR, 'i'); dialog::add_action([=] () { if(min_quality && !irr::bitruncations_requested) irr::bitruncations_requested++; - if(!irr::on) irr::visual_creator(); + if(!IRREGULAR) irr::visual_creator(); }); } @@ -757,8 +754,11 @@ namespace hr { namespace gp { whirl_set(loc(1, 0)); else if(uni == 'b') { if(S3 == 4) { - if(nonbitrunc || gp::on) - restart_game(rg::bitrunc); + if(!BITRUNCATED) { + stop_game(); + set_variation(eVariation::bitruncated); + start_game(); + } } else whirl_set(loc(1, 1)); @@ -783,8 +783,8 @@ namespace hr { namespace gp { } loc univ_param() { - if(on) return param; - else if(nonbitrunc) return loc(1,0); + if(GOLDBERG) return param; + else if(PURE) return loc(1,0); else return loc(1,1); } @@ -864,14 +864,14 @@ namespace hr { namespace gp { } array get_masters(cell *c) { - if(gp::on) { + if(GOLDBERG) { auto li = get_local_info(c); be_in_triangle(li); auto cm = c->master; int i = li.last_dir; return make_array(cm, createStep(cm, i), createStep(cm, fix7(i+1))); } - else if(irr::on) + else if(IRREGULAR) return irr::get_masters(c); else return make_array(c->move(0)->master, c->move(2)->master, c->move(4)->master); diff --git a/graph.cpp b/graph.cpp index 43b1d2ef..f73ef756 100644 --- a/graph.cpp +++ b/graph.cpp @@ -158,8 +158,8 @@ void drawSpeed(const transmatrix& V) { } int ctof(cell *c) { - if(irr::on) return irr::ctof(c); - if(nonbitrunc && !gp::on) return 1; + if(IRREGULAR) return irr::ctof(c); + if(PURE) return 1; // if(euclid) return 0; if(!c) return 1; if(binarytiling) return c->type == 7; @@ -239,7 +239,7 @@ ld displayspin(cell *c, int d) { auto& t1 = arcm::current.get_triangle(c->master, d-1); return -(t1.first + M_PI / c->type); } - else if(irr::on) { + else if(IRREGULAR) { auto id = irr::cellindex[c]; auto& vs = irr::cells[id]; if(d < 0 || d >= c->type) return 0; @@ -259,8 +259,8 @@ ld displayspin(cell *c, int d) { double hexshiftat(cell *c) { if(binarytiling) return 0; - if(ctof(c) && S7==6 && S3 == 4 && !nonbitrunc) return hexshift + 2*M_PI/S7; - if(ctof(c) && (S7==8 || S7 == 4) && S3 == 3 && !nonbitrunc) return hexshift + 2*M_PI/S7; + if(ctof(c) && S7==6 && S3 == 4 && BITRUNCATED) return hexshift + 2*M_PI/S7; + if(ctof(c) && (S7==8 || S7 == 4) && S3 == 3 && BITRUNCATED) return hexshift + 2*M_PI/S7; if(hexshift && ctof(c)) return hexshift; return 0; } @@ -299,17 +299,17 @@ void drawPlayerEffects(const transmatrix& V, cell *c, bool onplayer) { int& ang = angle[multi::cpid]; ang %= S42; - transmatrix Vnow = gmatrix[c] * rgpushxto0(inverse(gmatrix[c]) * tC0(V)) * (irr::on ? ddspin(c,0,M_PI) : spin(-hexshiftat(c))); + transmatrix Vnow = gmatrix[c] * rgpushxto0(inverse(gmatrix[c]) * tC0(V)) * (IRREGULAR ? ddspin(c,0,M_PI) : spin(-hexshiftat(c))); #if CAP_QUEUE if(!masterless) for(int a=0; amondir)); } - else if(gp::on || irr::on) { + else if(NONSTDVAR) { transmatrix T = calc_relative_matrix(c->move(c->mondir), c, c->mondir); Vb = Vb * T * rspintox(tC0(inverse(T))) * xpush(tentacle_length); } @@ -2121,7 +2121,7 @@ bool drawMonster(const transmatrix& Vparam, int ct, cell *c, int col) { } // if(ctof(c) && !masterless) Vb = Vb * xpush(hexhexdist - hcrossf); - // return nonbitrunc ? tessf * gp::scale : (c->type == 6 && (i&1)) ? hexhexdist : crossf; + // return (!BITRUNCATED) ? tessf * gp::scale : (c->type == 6 && (i&1)) ? hexhexdist : crossf; return drawMonsterTypeDH(m, c, Vb, col, darkhistory, footphase); } @@ -2392,7 +2392,7 @@ int countMinesAround(cell *c) { } transmatrix applyPatterndir(cell *c, const patterns::patterninfo& si) { - if(gp::on || irr::on || binarytiling) return Id; + if(NONSTDVAR || binarytiling) return Id; transmatrix V = ddspin(c, si.dir, M_PI); if(si.reflect) V = V * Mirror; return V * iddspin(c, 0, M_PI); @@ -2419,7 +2419,7 @@ void set_towerfloor(cell *c, cellfunction *cf = coastvalEdge) { if(i == 9) j = 4; if(i == 10) j = 5; if(i == 13) j = 6; - if(nonbitrunc) { + if(PURE) { if(i == 7) j = 7; if(i == 11) j = 8; if(i == 15) j = 9; @@ -2442,7 +2442,7 @@ void set_zebrafloor(cell *c) { auto si = patterns::getpatterninfo(c, patterns::PAT_ZEBRA, patterns::SPF_SYM0123); int j; - if(nonbitrunc) j = 4; + if(PURE) j = 4; else if(si.id >=4 && si.id < 16) j = 2; else if(si.id >= 16 && si.id < 28) j = 1; else if(si.id >= 28 && si.id < 40) j = 3; @@ -2464,7 +2464,7 @@ void set_reptile_floor(cell *c, const transmatrix& V, int col, bool nodetails = int j; if(!wmescher) j = 4; - else if(nonbitrunc) j = 0; + else if(!BITRUNCATED) j = 0; else if(si.id < 4) j = 0; else if(si.id >=4 && si.id < 16) j = 1; else if(si.id >= 16 && si.id < 28) j = 2; @@ -2523,7 +2523,7 @@ void draw_reptile(cell *c, const transmatrix &V, int col) { } void set_emeraldfloor(cell *c) { - if(!masterless && !nonbitrunc) { + if(!masterless && BITRUNCATED) { auto si = patterns::getpatterninfo(c, patterns::PAT_EMERALD, patterns::SPF_SYM0123); int j = -1; @@ -3096,13 +3096,13 @@ bool noAdjacentChasms(cell *c) { // does the current geometry allow nice duals bool has_nice_dual() { - if(irr::on) return irr::bitruncations_performed > 0; + if(IRREGULAR) return irr::bitruncations_performed > 0; if(archimedean) return geosupport_football() >= 2; if(binarytiling) return false; - if(!nonbitrunc) return true; - if((S7 & 1) == 0) return true; - if(!gp::on) return false; + if(BITRUNCATED) return true; if(a4) return false; + if((S7 & 1) == 0) return true; + if(PURE) return false; return (gp::param.first + gp::param.second * 2) % 3 == 0; } @@ -3112,7 +3112,7 @@ bool is_nice_dual(cell *c) { } bool use_swapped_duals() { - return (masterless && !a4) || gp::on; + return (masterless && !a4) || GOLDBERG; } void floorShadow(cell *c, const transmatrix& V, int col) { @@ -3199,7 +3199,7 @@ bool placeSidewall(cell *c, int i, int sidepar, const transmatrix& V, int col) { transmatrix V2 = V * ddspin(c, i); - if(gp::on || irr::on || binarytiling || archimedean) { + if(binarytiling || archimedean || NONSTDVAR) { draw_shapevec(c, V2, qfi.fshape->gpside[sidepar][i], col, prio); return false; } @@ -3785,7 +3785,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { auto si = patterns::getpatterninfo0(c); #endif - bool eoh = euclid || nonbitrunc; + bool eoh = euclid || !BITRUNCATED; if(drawing_usershape_on(c, mapeditor::sgFloor)) mapeditor::drawtrans = V * applyPatterndir(c, si); @@ -3834,7 +3834,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { onleft = !onleft; if(c->type == 6 && d != -1 && c->move(d)->barleft == laMirror) onleft = !onleft; - if(nonbitrunc) onleft = !onleft; + if(PURE) onleft = !onleft; if(d == -1) { for(d=0; dtype; d++) @@ -4061,7 +4061,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { case laSwitch: set_floor(shSwitchFloor); - if(ctof(c) && !gp::on && !irr::on && !archimedean && !binarytiling) for(int i=0; itype; i++) + if(ctof(c) && STDVAR && !archimedean && !binarytiling) for(int i=0; itype; i++) queuepoly(Vf * ddspin(c, i, M_PI/S7) * xpush(rhexf), shSwitchDisk, darkena(minf[active_switch()].color, fd, 0xFF)); break; @@ -4252,7 +4252,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { if(pseudohept(c) && ( c->land == laRedRock || vid.darkhepta || - (c->land == laClearing && nonbitrunc))) { + (c->land == laClearing && !BITRUNCATED))) { queuepoly((*Vdp), shHeptaMarker, wmblack ? 0x80808080 : 0x00000080); } @@ -4673,7 +4673,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { calcAirdir(c2); // printf("airdir = %d\n", airdir); transmatrix V0 = ddspin(c, i, M_PI); - double ph = ticks / (nonbitrunc?150:75.0) + airdir * M_PI / (S21+.0); + double ph = ticks / (PURE?150:75.0) + airdir * M_PI / (S21+.0); int aircol = 0x8080FF00 | int(32 + 32 * -cos(ph)); @@ -4718,7 +4718,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { transmatrix V0 = spin(hdir); - double ldist = nonbitrunc ? crossf : c->type == 6 ? .2840 : 0.3399; + double ldist = PURE ? crossf : c->type == 6 ? .2840 : 0.3399; poly_outline = OUTLINE_TRANS; queuepoly((*Vdp)*V0*xpush(ldist*(2*ph1-1)), shDisk, aircol); @@ -4734,7 +4734,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { if(vid.grid) { dynamicval lw(vid.linewidth, vid.linewidth); - if(gp::on) vid.linewidth *= gp::scale * 2; + if(GOLDBERG) vid.linewidth *= gp::scale * 2; // sphere: 0.3948 // sphere heptagonal: 0.5739 @@ -5082,7 +5082,7 @@ void drawFlashes() { kill = tim > 300; int partcol = darkena(f.color, 0, max(255 - tim*255/300, 0)); poly_outline = OUTLINE_DEFAULT; - ld gps = gp::on ? gp::scale * 1.6 : 1; + ld gps = GOLDBERG ? gp::scale * 1.6 : 1; queuepoly(V * spin(f.angle) * xpush(f.spd * tim * gps / 50000.), shParticle[f.size], partcol); } @@ -5206,7 +5206,7 @@ void drawthemap() { mmspatial = vid.monmode == 4 || vid.monmode == 5; DEBB(DF_GRAPH, (debugfile,"draw the map\n")); - fanframe = ticks / (nonbitrunc ? 1000. : 500. ); // (nonbitrunc ? 300 : 150.0) / M_PI; + fanframe = ticks / (PURE ? 1000. : 500. ); for(int m=0; mitem != itOrb37) + if(S7 != 7 || !BITRUNCATED) if(c->item != itOrb37) help += "\n\n" + other_geometry() + forbidden_unmarked(); } } diff --git a/heptagon.cpp b/heptagon.cpp index bbc92a9f..87433ed2 100644 --- a/heptagon.cpp +++ b/heptagon.cpp @@ -78,7 +78,7 @@ heptagon *buildHeptagon(heptagon *parent, int d, hstate s, int pard = 0, int fix heptagon *h = buildHeptagon1(tailored_alloc (S7), parent, d, s, pard, fixdistance); if(binarytiling || archimedean) return h; if(parent->c7) { - if(irr::on) + if(IRREGULAR) irr::link_next(parent, d); else h->c7 = newCell(S7, h); @@ -104,7 +104,7 @@ heptagon *buildHeptagon(heptagon *parent, int d, hstate s, int pard = 0, int fix if(pard == 0) { h->dm4 = parent->dm4+1; if(fixdistance != COMPUTE) h->distance = fixdistance; - else if(S3 == 4 && !nonbitrunc) { + else if(S3 == 4 && BITRUNCATED) { h->distance = parent->distance + 2; if(h->c.spin(0) == 2 || (h->c.spin(0) == 3 && S7 <= 5)) h->distance = min(h->distance, createStep(h->move(0), 0)->distance + 3); @@ -128,7 +128,7 @@ heptagon *buildHeptagon(heptagon *parent, int d, hstate s, int pard = 0, int fix ); } else if(parent->s == hsOrigin) h->distance = parent->distance + gp::dist_2(); - else if(S3 == 4 && gp::on && h->c.spin(0) == S7-2 && h->move(0)->c.spin(0) >= S7-2 && h->move(0)->move(0)->s != hsOrigin) { + else if(S3 == 4 && GOLDBERG && h->c.spin(0) == S7-2 && h->move(0)->c.spin(0) >= S7-2 && h->move(0)->move(0)->s != hsOrigin) { heptspin hs(h, 0); hs += wstep; int d1 = hs.at->distance; @@ -138,7 +138,7 @@ heptagon *buildHeptagon(heptagon *parent, int d, hstate s, int pard = 0, int fix int d0 = hs.at->distance; h->distance = gp::solve_triangle(dm, d0, d1, gp::operator* (gp::param, gp::loc(-1,1))); } - else if(S3 == 4 && gp::on && h->c.spin(0) == S7-1 && among(h->move(0)->c.spin(0), S7-2, S7-3) && h->move(0)->move(0)->s != hsOrigin) { + else if(S3 == 4 && GOLDBERG && h->c.spin(0) == S7-1 && among(h->move(0)->c.spin(0), S7-2, S7-3) && h->move(0)->move(0)->s != hsOrigin) { heptspin hs(h, 0); hs += wstep; int d0 = hs.at->distance; @@ -148,11 +148,11 @@ heptagon *buildHeptagon(heptagon *parent, int d, hstate s, int pard = 0, int fix int d1 = hs.at->distance; h->distance = gp::solve_triangle(dm, d0, d1, gp::operator* (gp::param, gp::loc(1,1))); } - else if(S3 == 4 && gp::on && h->c.spin(0) >= 2 && h->c.spin(0) <= S7-2) { + else if(S3 == 4 && GOLDBERG && h->c.spin(0) >= 2 && h->c.spin(0) <= S7-2) { h->distance = parent->distance + gp::dist_2(); } else if(h->c.spin(0) == S7-2) { - if(!gp::on) + if(!GOLDBERG) h->distance = parent->distance + gp::dist_1(); else { int d0 = parent->distance; @@ -162,7 +162,7 @@ heptagon *buildHeptagon(heptagon *parent, int d, hstate s, int pard = 0, int fix } } else if(h->c.spin(0) == S7-3 && h->move(0)->s == hsB) { - if(!gp::on) { + if(!GOLDBERG) { h->distance = createStep(h->move(0), (h->c.spin(0)+2)%S7)->distance + gp::dist_3(); } else { @@ -172,7 +172,7 @@ heptagon *buildHeptagon(heptagon *parent, int d, hstate s, int pard = 0, int fix h->distance = gp::solve_triangle(dm, d0, d1, gp::operator* (gp::param, gp::loc(1,1))); } } - else if(h->c.spin(0) == S7-1 && S3 == 4 && gp::on) { + else if(h->c.spin(0) == S7-1 && S3 == 4 && GOLDBERG) { h->distance = parent->distance + gp::dist_1(); } else h->distance = parent->distance + gp::dist_2(); diff --git a/hud.cpp b/hud.cpp index 832f2470..3f4f7605 100644 --- a/hud.cpp +++ b/hud.cpp @@ -356,22 +356,26 @@ void drawStats() { int d = celldistance(ac[i], cwt.at); if(d >= 0 && d < 64) qty[d]++; } - if(geometry == gNormal && !gp::on) - for(int i=nonbitrunc?6:8; i<=15; i++) - qty[i] = - nonbitrunc ? - 3*qty[i-1] - qty[i-2] - : qty[i-1] + qty[i-2] + qty[i-3] - qty[i-4]; + + if(geometry == gNormal && BITRUNCATED) + for(int i=8; i<=15; i++) + qty[i] = qty[i-1] + qty[i-2] + qty[i-3] - qty[i-4]; + + if(geometry == gNormal && PURE) + for(int i=6; i<=15; i++) + qty[i] = 3*qty[i-1] - qty[i-2]; + if(geometry == gEuclid) for(int i=8; i<=15; i++) qty[i] = 6*i; for(int i=0; i<64; i++) if(qty[i]) dialog::addInfo(its(qty[i]), distcolors[i&7]); - if(geometry == gNormal && !nonbitrunc) { + + if(geometry == gNormal && BITRUNCATED) { dialog::addBreak(200); dialog::addHelp("a(d+4) = a(d+3) + a(d+2) + a(d+1) - a(d)"); dialog::addInfo("a(d) ~ 1.72208ᵈ", forecolor); } - if(geometry == gNormal && nonbitrunc && !gp::on) { + if(geometry == gNormal && PURE) { dialog::addBreak(200); dialog::addHelp("a(d+2) = 3a(d+1) - a(d+2)"); dialog::addInfo("a(d) ~ 2.61803ᵈ", forecolor); diff --git a/hyper.h b/hyper.h index 5216a3b0..0fea4c38 100644 --- a/hyper.h +++ b/hyper.h @@ -84,8 +84,8 @@ void addMessage(string s, char spamtype = 0); #define S3 ginf[geometry].vertex #define hyperbolic_37 (S7 == 7 && S3 == 3 && !binarytiling) #define hyperbolic_not37 ((S7 > 7 || S3 > 3 || binarytiling) && hyperbolic) -#define weirdhyperbolic ((S7 > 7 || S3 > 3 || gp::on || irr::on || binarytiling || archimedean) && hyperbolic) -#define stdhyperbolic (S7 == 7 && S3 == 3 && !gp::on && !irr::on && !binarytiling && !archimedean) +#define weirdhyperbolic ((S7 > 7 || S3 > 3 || !STDVAR || binarytiling || archimedean) && hyperbolic) +#define stdhyperbolic (S7 == 7 && S3 == 3 && STDVAR && !binarytiling && !archimedean) #define binarytiling (geometry == gBinaryTiling) #define archimedean (geometry == gArchimedean) @@ -119,7 +119,6 @@ void addMessage(string s, char spamtype = 0); #define stdeuc (geometry == gNormal || geometry == gEuclid || geometry == gEuclidSquare) #define smallsphere (S7 < 5) #define bigsphere (S7 == 5) -#define ap4 (a4 && nonbitrunc) #define euclid4 (masterless && a4) #define euclid6 (masterless && !a4) @@ -134,6 +133,18 @@ void addMessage(string s, char spamtype = 0); #define MAX_S3 4 #define MAX_S84 240 +#define GOLDBERG (variation == eVariation::goldberg) +#define IRREGULAR (variation == eVariation::irregular) +#define PURE (variation == eVariation::pure) +#define BITRUNCATED (variation == eVariation::bitruncated) + +#define CHANGED_VARIATION (!BITRUNCATED) + +#define STDVAR (PURE || BITRUNCATED) +#define NONSTDVAR (!STDVAR) + +#define VALENCE (BITRUNCATED ? 3 : AS3) + #define NUMWITCH 7 // achievements @@ -620,9 +631,6 @@ namespace rg { static const char chaos = 'C'; static const char tactic = 't'; static const char tour = 'T'; - static const char geometry = 'g'; // change targetgeometry first - static const char bitrunc = '7'; - static const char gp = 'w'; // change gp::param first static const char yendor = 'y'; static const char shmup = 's'; static const char randpattern = 'r'; @@ -634,6 +642,10 @@ namespace rg { static const char global = 'x'; // wrongmode only -- change vid.scfg.players then restart_game(rg::nothing) instead static const char multi = 'm'; + // wrongmode only -- mark achievements for special geometries + static const char special_geometry = 'g'; + // wrongmode only -- mark achievements for special variations + static const char special_variation = '7'; } int landMultiplier(eLand l); @@ -1721,7 +1733,6 @@ void checkStunKill(cell *dest); void clearMessages(); void resetGeometry(); -extern bool nonbitrunc; namespace svg { void circle(int x, int y, int size, int col); @@ -2718,20 +2729,19 @@ struct hrmap { struct hrmap_hyperbolic : hrmap { heptagon *origin; - bool isnonbitrunc; + eVariation mvar; hrmap_hyperbolic(); heptagon *getOrigin() { return origin; } ~hrmap_hyperbolic() { DEBMEM ( verifycells(origin); ) // printf("Deleting hyperbolic map: %p\n", this); - dynamicval ph(nonbitrunc, isnonbitrunc); + dynamicval ph(variation, mvar); clearfrom(origin); } void verify() { verifycells(origin); } }; namespace irr { - extern bool on; extern ld density; extern ld quality; extern int cellcount; @@ -2988,7 +2998,7 @@ namespace texture { int recolor(int col); - typedef tuple texture_parameters; + typedef tuple texture_parameters; texture_parameters orig_texture_parameters; map texture_map, texture_map_orig; @@ -3082,7 +3092,7 @@ transmatrix actualV(const heptspin& hs, const transmatrix& V); transmatrix applyspin(const heptspin& hs, const transmatrix& V); transmatrix cview(); -extern string bitruncnames[2]; +extern string bitruncnames[5]; extern bool need_mouseh; extern int whateveri, whateveri2; @@ -3220,7 +3230,6 @@ extern int sagephase; extern int lastsize; extern int noiseuntil; hyperpoint xpush0(ld x); -extern eGeometry targetgeometry; transmatrix xspinpush(ld alpha, ld x); hyperpoint xspinpush0(ld alpha, ld x); @@ -3320,7 +3329,6 @@ string XLAT(string x, stringpar p1, stringpar p2, stringpar p3, stringpar p4, st namespace gp { typedef pair loc; - extern bool on; void compute_geometry(); void extend_map(cell *c, int d); extern ld scale; @@ -3421,7 +3429,7 @@ template struct saverenum : supersaver { bool dosave() { return val != dft; } void reset() { val = dft; } saverenum(T& v) : val(v) { } - string save() { return its(val); } + string save() { return its(int(val)); } void load(const string& s) { val = (T) atoi(s.c_str()); } }; @@ -3736,6 +3744,10 @@ void switch_game_mode(char switchWhat); void stop_game_and_switch_mode(char switchWhat = rg::nothing); // stop_game + switch_game_mode void restart_game(char switchWhat = rg::nothing); // popAllScreens + popAllGames + stop_game + switch_game_mode + start_game +// these work as stop_game_and_switch_mode +void set_variation(eVariation); +void set_geometry(eGeometry); + void generate_floorshapes(); void drawArrowTraps(); void drawBlizzards(); @@ -3872,7 +3884,7 @@ extern void switchHardcore(); extern bool using_perspective; -void generateAlts(heptagon *h, int levs = irr::on ? 1 : S3-3, bool link_cdata = true); +void generateAlts(heptagon *h, int levs = IRREGULAR ? 1 : S3-3, bool link_cdata = true); namespace ors { extern int mode; diff --git a/hyperpoint.cpp b/hyperpoint.cpp index 57b52c1a..e8375a9d 100644 --- a/hyperpoint.cpp +++ b/hyperpoint.cpp @@ -4,10 +4,8 @@ namespace hr { -eGeometry geometry, targetgeometry; - -// for the pure heptagonal grid -bool nonbitrunc = false; +eGeometry geometry; +eVariation variation; // hyperbolic points and matrices diff --git a/hypgraph.cpp b/hypgraph.cpp index bc1b3790..9a6f5875 100644 --- a/hypgraph.cpp +++ b/hypgraph.cpp @@ -499,15 +499,15 @@ bool confusingGeometry() { } ld master_to_c7_angle() { - return (nonbitrunc && !binarytiling && !archimedean) ? M_PI + gp::alpha : 0; + return (!BITRUNCATED && !binarytiling && !archimedean) ? M_PI + gp::alpha : 0; } transmatrix actualV(const heptspin& hs, const transmatrix& V) { - if(irr::on) + if(IRREGULAR) return V * spin(M_PI + 2 * M_PI / S7 * (hs.spin + irr::periodmap[hs.at].base.spin)); if(archimedean) return V * spin(-arcm::current.triangles[arcm::id_of(hs.at)][hs.spin].first); if(binarytiling) return V; - return (hs.spin || nonbitrunc) ? V * spin(hs.spin*2*M_PI/S7 + master_to_c7_angle()) : V; + return (hs.spin || !BITRUNCATED) ? V * spin(hs.spin*2*M_PI/S7 + master_to_c7_angle()) : V; } transmatrix applyspin(const heptspin& hs, const transmatrix& V) { @@ -589,11 +589,11 @@ void drawrec(const heptspin& hs, hstate s, const transmatrix& V) { bool draw = c->pathdist < PINFD; - if(gp::on) { + if(GOLDBERG) { gp::drawrec(c, actualV(hs, V1)); } - else if(irr::on) { + else if(IRREGULAR) { auto& hi = irr::periodmap[hs.at]; transmatrix V0 = actualV(hs, V1); auto& vc = irr::cells_of_heptagon[hi.base.at]; @@ -609,7 +609,7 @@ void drawrec(const heptspin& hs, hstate s, const transmatrix& V) { drawcell(c, V2, 0, hs.mirrored); } - if(!nonbitrunc) for(int d=0; dc.fix(hs.spin + d); // createMov(c, ds); if(c->move(ds) && c->c.spin(ds) == 0 && dodrawcell(c->move(ds))) { diff --git a/init.cpp b/init.cpp index af7c3b5b..7a2529cf 100644 --- a/init.cpp +++ b/init.cpp @@ -39,7 +39,7 @@ void initAll() { initgraph(); #if CAP_SAVE loadsave(); - if(irr::on) irr::auto_creator(); + if(IRREGULAR) irr::auto_creator(); #endif start_game(); diff --git a/irregular.cpp b/irregular.cpp index d682c3ca..a56330b3 100644 --- a/irregular.cpp +++ b/irregular.cpp @@ -1,7 +1,5 @@ namespace hr { namespace irr { -bool on; - ld density = 2; ld quality = .2; int place_attempts = 10; @@ -511,7 +509,7 @@ bool step(int delta) { ld scale; void compute_geometry() { - if(irr::on) { + if(IRREGULAR) { scale = sqrt(isize(cells_of_heptagon) * 1. / isize(cells)); crossf *= scale; hepvdist *= scale; @@ -805,9 +803,7 @@ void start_game_on_created_map() { for(hrmap *& hm : allmaps) if(hm == base) hm = NULL; stop_game(); geometry = orig_geometry; - irr::on = true; - nonbitrunc = true; - gp::on = false; + variation = eVariation::irregular; need_reset_geometry = true; gridmaking = false; start_game(); @@ -981,8 +977,7 @@ void visual_creator() { break; } - nonbitrunc = true; - gp::on = false; + variation = eVariation::pure; need_reset_geometry = true; start_game(); if(base) delete base; @@ -995,7 +990,7 @@ void visual_creator() { } void auto_creator() { - irr::on = false; + variation = eVariation::pure; int cc = cellcount; bitruncations_requested = bitruncations_performed; visual_creator(); diff --git a/landgen.cpp b/landgen.cpp index 463e0d87..b806a464 100644 --- a/landgen.cpp +++ b/landgen.cpp @@ -210,14 +210,14 @@ void giantLandSwitch(cell *c, int d, cell *from) { else { if(d == 9) { - cell *c2 = (gp::on || irr::on) ? c->master->c7 : c; + cell *c2 = (GOLDBERG || IRREGULAR) ? c->master->c7 : c; if(cdist50(c2) == 3 && polarb50(c2) == 1) c->wall = waPalace; } if(d == 8 && sphere) { int gs = getHemisphere(c,0); - if(gp::on || irr::on) { + if(NONSTDVAR) { int v = 1; forCellEx(c2, c) if(getHemisphere(c2, 0) != gs) v = 2; @@ -230,7 +230,7 @@ void giantLandSwitch(cell *c, int d, cell *from) { if(gs == 1) c->wall = waPalace; if(gs == 3) - c->wall = nonbitrunc ? waOpenGate : waClosedGate; + c->wall = PURE ? waOpenGate : waClosedGate; if(gs == 4 && hrand(100) < 40) c->wall = waClosePlate; if(gs == 6) @@ -247,10 +247,10 @@ void giantLandSwitch(cell *c, int d, cell *from) { bool lookingForPrincess = !euclid && c->master->alt && !princess::challenge; bool pgate = false; - if(nonbitrunc) { + if(PURE) { int i = fiftyval049(c->master->c7); if(i >= 8 && i <= 14 && !polarb50(c->master->c7)) pgate = true; - if(gp::on) { + if(GOLDBERG) { bool good = false; forCellEx(c2, c) { int i2 = fiftyval049(c2->master->c7); @@ -273,7 +273,7 @@ void giantLandSwitch(cell *c, int d, cell *from) { } } else if(cdist50(c) == 3 && polarb50(c) == 1 && !ishept(c)) { - if(gp::on) ; + if(GOLDBERG) ; else { int q = 0, s = 0; if(!ishept(c)) for(int i=0; itype; i++) @@ -294,9 +294,9 @@ void giantLandSwitch(cell *c, int d, cell *from) { } } else if(c->wall == waPalace) ; - else if((hrand(100) < (lookingForPrincess ? (nonbitrunc ? 11 : 7) : 5) && cdist50(c)) || + else if((hrand(100) < (lookingForPrincess ? (PURE ? 11 : 7) : 5) && cdist50(c)) || (cdist50(c) == 0 && polarb50(c) && hrand(100) < 60)) { - c->wall = hrand(100) < (lookingForPrincess ? (nonbitrunc ? 25 : 30):50) ? waClosePlate : waOpenPlate; + c->wall = hrand(100) < (lookingForPrincess ? (PURE ? 25 : 30):50) ? waClosePlate : waOpenPlate; } else if(hrand(100) < (lookingForPrincess ? 3 : 5)) c->wall = waTrapdoor; @@ -311,9 +311,9 @@ void giantLandSwitch(cell *c, int d, cell *from) { if(princess::generating) { // no Opening Plates nearby - if(d <= 7 && c->wall == waOpenPlate && !nonbitrunc) + if(d <= 7 && c->wall == waOpenPlate && BITRUNCATED) c->wall = waNone; - if(d <= 7 && c->wall == waClosePlate && nonbitrunc) + if(d <= 7 && c->wall == waClosePlate && PURE) c->wall = waOpenPlate; // no monsters nearby if(d>0) c->monst = moNone; @@ -407,7 +407,7 @@ void giantLandSwitch(cell *c, int d, cell *from) { } else if(a4) c->wall = hrand(100) < 50 ? waCavefloor : waCavewall; - else if(nonbitrunc) { + else if(!BITRUNCATED) { if(polarb50(c)) c->wall = waCavewall; else c->wall = waCavefloor; @@ -426,7 +426,7 @@ void giantLandSwitch(cell *c, int d, cell *from) { c->monst = moSeep; ONEMPTY { - if(hrand(nonbitrunc?400:1000) < PT(100 + 2 * (kills[moMiner] + kills[moLancer] + kills[moFlailer]), 200) && notDippingFor(itEmerald)) { + if(hrand(PURE?400:1000) < PT(100 + 2 * (kills[moMiner] + kills[moLancer] + kills[moFlailer]), 200) && notDippingFor(itEmerald)) { // do not destroy walls! bool ok = true; for(int i=0; itype; i++) if(c->move(i)->wall == waCavewall) ok = false; @@ -469,7 +469,7 @@ void giantLandSwitch(cell *c, int d, cell *from) { v = RANDPAT ? 24 : 1; else if(sphere) { int gs = getHemisphere(c, 0); - if(gp::on) { + if(GOLDBERG) { v = 6; if(gs == 0) v = 24; forCellEx(c2, c) if(getHemisphere(c2, 0) * gs < 0) @@ -588,7 +588,7 @@ void giantLandSwitch(cell *c, int d, cell *from) { else if(v == 25 || v == 59 || v == 27 || v == 57) c->wall = waVineHalfB; else c->wall = waNone; - if((gp::on || irr::on) && cellHalfvine(c)) { + if(NONSTDVAR && cellHalfvine(c)) { c->wall = waNone; forCellCM(c2, c) if(emeraldval(c2) == (v^1)) c->wall = waVinePlant; @@ -1060,14 +1060,14 @@ void giantLandSwitch(cell *c, int d, cell *from) { case laHalloween: if(d == 9) { - if(gp::on) { + if(GOLDBERG) { int fv = c->master->fiftyval; if(fv == 1 || fv == 4 || fv == 10) c->wall = waChasm; if(c == c->master->c7 && fv == 3) c->item = itTreat; } - else if(nonbitrunc && !euclid) { + else if(!BITRUNCATED && !euclid) { int fv = c->master->fiftyval; if(fv == 1 || fv == 4 || fv == 2) c->wall = waChasm; @@ -1146,7 +1146,7 @@ void giantLandSwitch(cell *c, int d, cell *from) { break; case laStorms: { - bool randstorm = hyperbolic_not37 || gp::on || irr::on || (quotient && geometry != gZebraQuotient); + bool randstorm = hyperbolic_not37 || NONSTDVAR || (quotient && geometry != gZebraQuotient); if(d == 9) { if(torus) { @@ -1177,7 +1177,7 @@ void giantLandSwitch(cell *c, int d, cell *from) { if(ctof(c)) { int id = c->master->fiftyval; if(id == 1) c->wall = waCharged; - if(id == (elliptic && !nonbitrunc ? 3 : 9)) c->wall = waGrounded; + if(id == (elliptic && BITRUNCATED ? 3 : 9)) c->wall = waGrounded; } } else if(S7 == 4) { @@ -1200,7 +1200,7 @@ void giantLandSwitch(cell *c, int d, cell *from) { } } else if(randstorm) ; - else if(nonbitrunc) { + else if(PURE) { int i = zebra40(c); if((i == 5 || i == 8) && hrand(100) < 20) c->wall = hrand(2) ? waCharged : waGrounded; else if(i == 15) c->wall = waSandstone; @@ -1359,7 +1359,7 @@ void giantLandSwitch(cell *c, int d, cell *from) { case laHell: if(d == 9) { - if(hrand(1000) < (nonbitrunc ? 16 : 36) && celldist(c) >= 3) { + if(hrand(1000) < (PURE ? 16 : 36) && celldist(c) >= 3) { for(int i=0; itype; i++) { cell *c2 = createMov(c, i); setdist(c2, d+1, c); @@ -1411,7 +1411,7 @@ void giantLandSwitch(cell *c, int d, cell *from) { case laHive: if(d == 9) { - if(hrand(2000) < (chaosmode ? 1000 : (nonbitrunc && !gp::on) ?200:2) && !safety) + if(hrand(2000) < (chaosmode ? 1000 : PURE ?200:2) && !safety) hive::createBugArmy(c); if(hrand(2000) < 100 && !c->wall && !c->item && !c->monst) { int nww = 0; @@ -1631,14 +1631,14 @@ void giantLandSwitch(cell *c, int d, cell *from) { if(d == 7 && c->wall == waNone) buildPrizeMirror(c, 1000); ONEMPTY { - if(hrand((doCross && celldist(c) <= 5) ?450:16000) < 30+items[itRedGem]+yendor::hardness() && !pseudohept(c) && !c->monst && !c->wall && !(nonbitrunc && S3==4)) { + if(hrand((doCross && celldist(c) <= 5) ?450:16000) < 30+items[itRedGem]+yendor::hardness() && !pseudohept(c) && !c->monst && !c->wall && !(!BITRUNCATED && S3==4)) { int i = -1; for(int t=0; ttype; t++) if(c->move(t)->mpdist > c->mpdist && !pseudohept(c->move(t))) i = t; if(i != -1 && !peace::on) generateSnake(c, i, 1); } - else if(hrand(16000) < 50+items[itRedGem]+yendor::hardness() && (nonbitrunc?hrand(10)<3:!ishept(c)) && !c->monst) + else if(hrand(16000) < 50+items[itRedGem]+yendor::hardness() && (PURE?hrand(10)<3:!ishept(c)) && !c->monst) c->monst = moRedTroll, c->mondir = NODIR; } @@ -1674,7 +1674,7 @@ void giantLandSwitch(cell *c, int d, cell *from) { if(hrand(1000) < 150 && celldist(c) >= 3 && !pseudohept(c)) c->wall = waSmallTree; int q = 0; - if(!nonbitrunc && !chaosmode && !weirdhyperbolic) for(int i=0; itype; i++) + if(BITRUNCATED && !chaosmode && !weirdhyperbolic) for(int i=0; itype; i++) if(c->move(i) && !isWarped(c->move(i)->land) && c->move(i)->land != laCrossroads4) q++; if(q == 1) c->wall = waWarpGate; @@ -1683,7 +1683,7 @@ void giantLandSwitch(cell *c, int d, cell *from) { if(c->land == laWarpSea) { c->wall = waSea; int q = 0; - if(!nonbitrunc && !chaosmode) for(int i=0; itype; i++) + if(BITRUNCATED && !chaosmode) for(int i=0; itype; i++) if(c->move(i) && !isWarped(c->move(i)->land)) q++; if(q == 1) c->wall = waWarpGate; } @@ -1809,7 +1809,7 @@ void giantLandSwitch(cell *c, int d, cell *from) { } else if(items[itHunting] < 10) { vector next; - forCellEx(c2, c) if(c2->mpdist > 7 && (nonbitrunc || !ctof(c2))) next.push_back(c2); + forCellEx(c2, c) if(c2->mpdist > 7 && (!BITRUNCATED || !ctof(c2))) next.push_back(c2); if(isize(next)) { c->item = itHunting; cell *c3 = next[hrand(isize(next))]; @@ -1855,7 +1855,7 @@ void giantLandSwitch(cell *c, int d, cell *from) { forCellEx(c2, c) if(c2->landparam % TEMPLE_EACH == 0 && !pseudohept(c2)) q++; placecolumn = q == 2; - if(placecolumn && weirdhyperbolic && nonbitrunc && hrand(100) >= 50) + if(placecolumn && weirdhyperbolic && !BITRUNCATED && hrand(100) >= 50) placecolumn = false; if(placecolumn) { placecolumn = false; @@ -2118,7 +2118,7 @@ void giantLandSwitch(cell *c, int d, cell *from) { else si.id = (zebra40(c)&2) ? 0 : zebra40(c) == 4 ? 8 : 1; c->wall = waSea; - if(among(si.id, 0, 4, 16, nonbitrunc ? -1 : 24)) + if(among(si.id, 0, 4, 16, PURE ? -1 : 24)) c->wall = waDock; if(si.id == 8 && hrand(100) < 75) { c->wall = waBoat; @@ -2200,7 +2200,7 @@ void giantLandSwitch(cell *c, int d, cell *from) { case laCrossroads5: if(c->wall == waTower) c->land = laCamelot; ONEMPTY { - if(nonbitrunc && c->land == laCrossroads5 && hrand(100) < 60) + if(!BITRUNCATED && c->land == laCrossroads5 && hrand(100) < 60) c->wall = waBarrier; else if(!inv::on && items[itShard] >= 10 && hrand(8000) < 120*orbcrossfun(items[itShard]) && mirror::build(c)) ; else if(hyperstonesUnlocked() && hrand(8000) < 100 && mirror::build(c)) ; @@ -2482,7 +2482,7 @@ void setdist(cell *c, int d, cell *from) { placeLocalOrbs(c); } - if(nonbitrunc && c->wall == waMirrorWall && c->land == laMirror) + if(PURE && c->wall == waMirrorWall && c->land == laMirror) c->land = laMirrorWall; // , c->item = itPirate; // not really a proper bugfix if(d == 7) playSeenSound(c); diff --git a/landlock.cpp b/landlock.cpp index ec355998..d3b5f856 100644 --- a/landlock.cpp +++ b/landlock.cpp @@ -664,7 +664,7 @@ bool rlyehComplete() { } bool lchance(eLand l) { - if(tactic::on || yendor::on || ((geometry || gp::on) && specialland == laElementalWall)) return true; + if(tactic::on || yendor::on || ((geometry || GOLDBERG) && specialland == laElementalWall)) return true; if(chaosmode) return hrand(100) < 25; return hrand(100) >= 40 * kills[elementalOf(l)] / (elementalKills()+1); } @@ -1118,7 +1118,7 @@ land_validity_t& land_validity(eLand l) { if(weirdhyperbolic) return simplified_walls; // works nice on a big non-tetrahedron-based sphere - if(sphere && S3 != 3 && gp::on) + if(sphere && S3 != 3 && GOLDBERG) return special_geo3; } @@ -1131,14 +1131,14 @@ land_validity_t& land_validity(eLand l) { return pattern_not_implemented_random; // not enough space - if(l == laStorms && nonbitrunc && elliptic) + if(l == laStorms && (old_daily_id < 35 ? !BITRUNCATED : PURE) && elliptic) return not_enough_space; if(l == laStorms && S7 == 3) return not_enough_space; // mirrors do not work in gp - if(among(l, laMirror, laMirrorOld) && (gp::on && old_daily_id < 33)) + if(among(l, laMirror, laMirrorOld) && (GOLDBERG && old_daily_id < 33)) return dont_work; if(binarytiling && among(l, laMirror, laMirrorOld)) @@ -1148,11 +1148,11 @@ land_validity_t& land_validity(eLand l) { return pattern_incompatibility; // available only in non-standard geometries - if(l == laMirrorOld && !geometry && !gp::on && !irr::on) + if(l == laMirrorOld && !geometry && STDVAR) return better_version_exists; // available only in standard geometry - if(l == laMirror && (geometry || gp::on || irr::on)) + if(l == laMirror && (geometry || NONSTDVAR)) return not_implemented; // Halloween needs bounded world (can be big bounded) @@ -1181,16 +1181,16 @@ land_validity_t& land_validity(eLand l) { if(l == laWhirlpool && a4) return dont_work; - if(isWarped(l) && a4 && gp::on) + if(isWarped(l) && a4 && GOLDBERG) return dont_work; - if((isWarped(l) || l == laDual) && irr::on && !irr::bitruncations_performed) + if((isWarped(l) || l == laDual) && IRREGULAR && !irr::bitruncations_performed) return dont_work; - if(irr::on && among(l, laPrairie, laMirror, laMirrorOld)) + if(IRREGULAR && among(l, laPrairie, laMirror, laMirrorOld)) return dont_work; - if(irr::on && among(laBlizzard, laVolcano) && !sphere) + if(IRREGULAR && among(laBlizzard, laVolcano) && !sphere) return dont_work; // equidistant-based lands @@ -1218,7 +1218,7 @@ land_validity_t& land_validity(eLand l) { if(l == laPrincessQuest && tactic::on) return not_in_ptm; - if(l == laPrincessQuest && (!stdeuc || gp::on)) + if(l == laPrincessQuest && (!stdeuc || NONSTDVAR)) return not_implemented; // works correctly only in some geometries @@ -1226,12 +1226,12 @@ land_validity_t& land_validity(eLand l) { return not_in_chaos; if(l == laClearing) - if(!(stdeuc || a38 || (a45 && !nonbitrunc) || (a47 && !nonbitrunc)) || gp::on || irr::on) + if(!(stdeuc || a38 || (a45 && BITRUNCATED) || (a47 && BITRUNCATED)) || NONSTDVAR) if(!bounded) return not_implemented; // does not work in non-bitrunc a4 - if(l == laOvergrown && a4 && nonbitrunc) + if(l == laOvergrown && a4 && !BITRUNCATED) return some0; // does not work in bounded either @@ -1256,7 +1256,7 @@ land_validity_t& land_validity(eLand l) { return not_enough_space; // ... and it works in gp only partially - if((l == laBlizzard || l == laVolcano) && gp::on && (old_daily_id < 33 || !sphere)) + if((l == laBlizzard || l == laVolcano) && GOLDBERG && (old_daily_id < 33 || !sphere)) return partially_implemented; // Kraken does not really work on odd-sided cells; @@ -1271,8 +1271,8 @@ land_validity_t& land_validity(eLand l) { if(geometry == gZebraQuotient) return pattern_compatibility; if(stdeuc) ; - else if(S7 == 4 && !nonbitrunc) return special_geo; - else if(bigsphere && nonbitrunc && !elliptic) return special_geo; + else if(S7 == 4 && BITRUNCATED) return special_geo; + else if(bigsphere && !BITRUNCATED && !elliptic) return special_geo; else return dont_work; } @@ -1322,11 +1322,11 @@ land_validity_t& land_validity(eLand l) { else if(quotient) return pattern_incompatibility; } - if(among(l, laEmerald, laCamelot, laDryForest) && (AS3 != 3) && nonbitrunc) + if(among(l, laEmerald, laCamelot, laDryForest) && VALENCE != 3) return hedgehogs; // ... wineyard pattern is GOOD only in the standard geometry or Euclidean - if(l == laWineyard && (gp::on || sphere) && !randomPatternsMode) + if(l == laWineyard && (NONSTDVAR || sphere) && !randomPatternsMode) return pattern_not_implemented_random; if(l == laTrollheim && quotient == qFIELD) @@ -1338,7 +1338,7 @@ land_validity_t& land_validity(eLand l) { if(l == laTrollheim && !stdeuc && !bounded) return some1; - if(l == laReptile && (a38 || a4 || sphere || nonbitrunc || gp::on || irr::on || (quotient && geometry != gZebraQuotient))) + if(l == laReptile && (a38 || a4 || sphere || !BITRUNCATED || (quotient && geometry != gZebraQuotient))) return bad_graphics; if((l == laDragon || l == laReptile) && !stdeuc && !smallbounded && !randomPatternsMode) @@ -1364,15 +1364,15 @@ land_validity_t& land_validity(eLand l) { if(l == laZebra && quotient && geometry != gZebraQuotient && !randomPatternsMode) return pattern_incompatibility; - if(l == laZebra && !(stdeuc || (a4 && nonbitrunc) || a46) && !randomPatternsMode) + if(l == laZebra && !(stdeuc || (a4 && !BITRUNCATED) || a46) && !randomPatternsMode) return pattern_not_implemented_weird; if(l == laCrossroads3 && euclid) return inaccurate; // because it is not accurate if(l == laPrairie) { - if(gp::on) return not_implemented; - else if(stdeuc || (bigsphere && !nonbitrunc && !elliptic) || (geometry == gFieldQuotient)) ; + if(GOLDBERG) return not_implemented; + else if(stdeuc || (bigsphere && BITRUNCATED && !elliptic) || (geometry == gFieldQuotient)) ; else if(!bounded) return not_implemented; else return unbounded_only; } @@ -1403,7 +1403,7 @@ land_validity_t& land_validity(eLand l) { if(l == laDual && geosupport_threecolor() == 2) return specially_designed; - if(l == laDual && !geometry && !gp::on) + if(l == laDual && !geometry && !GOLDBERG) return hyperbolic_37 ? not_in_full_game3 : not_in_full_game; if(l == laSnakeNest) { @@ -1413,7 +1413,7 @@ land_validity_t& land_validity(eLand l) { } if(l == laDocks && !randomPatternsMode) { - if(a38 && !gp::on) return specially_designed; + if(a38 && !GOLDBERG) return specially_designed; if(a38) return pattern_not_implemented_weird; return pattern_not_implemented_exclude; } @@ -1431,7 +1431,7 @@ land_validity_t& land_validity(eLand l) { if(l == laWildWest && !randomPatternsMode) return out_of_theme; - if(l == laIce && !gp::on && !irr::on && hyperbolic_37 && !quotient && !archimedean && !binarytiling) + if(l == laIce && STDVAR && hyperbolic_37 && !quotient && !archimedean && !binarytiling) return full_game; return ok; diff --git a/mapeditor.cpp b/mapeditor.cpp index 9d6177ad..4ea7a687 100644 --- a/mapeditor.cpp +++ b/mapeditor.cpp @@ -112,10 +112,9 @@ namespace mapstream { int32_t i = VERNUM; save(i); save(patterns::whichPattern); save(geometry); - char nbtype = nonbitrunc; - if(gp::on) nbtype = 2; + char nbtype = char(variation); save(nbtype); - if(gp::on) { + if(GOLDBERG) { save(gp::param.first); save(gp::param.second); } @@ -211,9 +210,8 @@ namespace mapstream { load(geometry); char nbtype; load(nbtype); - nonbitrunc = !!nbtype; - gp::on = nbtype == 2; - if(gp::on) { + variation = eVariation(nbtype); + if(GOLDBERG) { load(gp::param.first); load(gp::param.second); } @@ -690,7 +688,7 @@ namespace mapeditor { if(painttype == 4 && radius) { if(where.at->type != copysource.at->type) return; if(where.spin<0) where.spin=0; - if(!nonbitrunc && !ctof(mouseover) && ((where.spin&1) != (copysource.spin&1))) + if(BITRUNCATED && !ctof(mouseover) && ((where.spin&1) != (copysource.spin&1))) where += 1; } if(painttype != 4) copysource.at = NULL; @@ -1376,8 +1374,8 @@ namespace mapeditor { int nt; hr::ignore(fscanf(f, "%d%d%d%d\n", &tg, &nt, &wp, &patterns::subpattern_flags)); patterns::whichPattern = patterns::ePattern(wp); - if(tg != geometry) { targetgeometry = eGeometry(tg); stop_game_and_switch_mode(rg::geometry); } - if(bool(nt) != nonbitrunc) stop_game_and_switch_mode(rg::bitrunc); + set_geometry(eGeometry(tg)); + set_variation(eVariation(nt)); start_game(); } @@ -1422,7 +1420,7 @@ namespace mapeditor { fprintf(f, "HyperRogue saved picture\n"); fprintf(f, "%x\n", VERNUM_HEX); if(VERNUM_HEX >= 0xA0A0) - fprintf(f, "%d %d %d %d\n", geometry, nonbitrunc, patterns::whichPattern, patterns::subpattern_flags); + fprintf(f, "%d %d %d %d\n", geometry, int(variation), patterns::whichPattern, patterns::subpattern_flags); for(int i=0; i 1), 's'); if(!shmup::on) dialog::addSelItem(XLAT("hardcore mode"), hardcore && !pureHardcore() ? XLAT("PARTIAL") : ONOFF(hardcore), 'h'); @@ -771,8 +771,7 @@ void showStartMenu() { if(!sphere) { stop_game(); specialland = laHalloween; - targetgeometry = gSphere; - restart_game(rg::geometry); + set_geometry(gSphere); vid.alpha = 999; vid.scale = 998; } @@ -826,7 +825,7 @@ void setAppropriateOverview() { pushScreen(yendor::showMenu); else if(peace::on) pushScreen(peace::showMenu); - else if((geometry != gNormal || gp::on || irr::on) && !chaosmode && !(geometry == gEuclid && isCrossroads(specialland)) && !(weirdhyperbolic && specialland == laCrossroads4)) { + else if((geometry != gNormal || NONSTDVAR) && !chaosmode && !(geometry == gEuclid && isCrossroads(specialland)) && !(weirdhyperbolic && specialland == laCrossroads4)) { runGeometryExperiments(); } else { diff --git a/monstergen.cpp b/monstergen.cpp index f2848818..c91b183f 100644 --- a/monstergen.cpp +++ b/monstergen.cpp @@ -679,7 +679,7 @@ void generateSnake(cell *c, int i, int color) { c->hitpoints = color; int cpair = (1<move(i))); preventbarriers(c); - int len = nonbitrunc ? 2 : ROCKSNAKELENGTH; + int len = BITRUNCATED ? ROCKSNAKELENGTH : 2; cell *c2 = c; vector rocksnake; while(--len) { @@ -703,7 +703,7 @@ void generateSnake(cell *c, int i, int color) { i = goodsteps[hrand(isize(goodsteps))]; } } - if(isize(rocksnake) < ROCKSNAKELENGTH/2 && !nonbitrunc) { + if(isize(rocksnake) < ROCKSNAKELENGTH/2 && BITRUNCATED) { for(int i=0; imonst = moNone; } diff --git a/pattern2.cpp b/pattern2.cpp index 5fb2f054..ebfad201 100644 --- a/pattern2.cpp +++ b/pattern2.cpp @@ -5,7 +5,7 @@ namespace hr { int gp_threecolor() { - if(!gp::on) return 0; + if(!GOLDBERG) return 0; if(S3 == 3 && (gp::param.first - gp::param.second) % 3 == 0) return 2; return 1; } @@ -38,14 +38,14 @@ bool ishept(cell *c) { bool ishex1(cell *c) { // EUCLIDEAN if(euclid) return eupattern(c) == 1; - else if(gp::on) return c->master->c7 != c && !pseudohept(c->move(0)); + else if(GOLDBERG) return c->master->c7 != c && !pseudohept(c->move(0)); else return c->type != S6; } bool ishex2(cell *c) { // EUCLIDEAN if(euclid) return eupattern(c) == 1; - else if(gp::on) return c->master->c7 != c && gp::pseudohept_val(c) == 1; + else if(GOLDBERG) return c->master->c7 != c && gp::pseudohept_val(c) == 1; else return c->type != S6; } @@ -140,7 +140,7 @@ int land50(cell *c) { int polara50(cell *c) { if(sphere || euclid || S7>7 || S6>6) return 0; - else if(gp::on || irr::on) return polara50(fiftyval(c->master->c7)); + else if(NONSTDVAR) return polara50(fiftyval(c->master->c7)); else if(ctof(c)) return polara50(fiftyval(c)); else { auto ar = gp::get_masters(c); @@ -153,7 +153,7 @@ int polara50(cell *c) { int polarb50(cell *c) { if(euclid) return true; if(sphere || euclid || S7>7 || S6>6) return true; - else if(gp::on || irr::on) return polarb50(fiftyval(c->master->c7)); + else if(NONSTDVAR) return polarb50(fiftyval(c->master->c7)); else if(ctof(c)) return polarb50(fiftyval(c)); else { auto ar = gp::get_masters(c); @@ -238,7 +238,7 @@ int fiftyval200(cell *c) { // zebraval int dir_bitrunc457(cell *c) { - if(gp::on) return c->master->zebraval / 10; + if(GOLDBERG) return c->master->zebraval / 10; int wset = 0; int has1 = 0; for(int i=0; i<4; i++) { @@ -259,7 +259,7 @@ int val46(cell *c); int zebra40(cell *c) { if(euclid) return eupattern(c); - else if(irr::on) return c->master->zebraval/10; + else if(IRREGULAR) return c->master->zebraval/10; else if(a46) { int v = val46(c); if(v<4) return v; @@ -267,7 +267,7 @@ int zebra40(cell *c) { } else if(ctof(c)) return (c->master->zebraval/10); else if(a4) { - if(gp::on) return zebra40(c->master->c7); + if(GOLDBERG) return zebra40(c->master->c7); int ws = dir_bitrunc457(c); if(ws < 0) return -ws; int tot = 0; @@ -341,8 +341,8 @@ pair fieldval(cell *c) { int fieldval_uniq(cell *c) { if(sphere) { if(archimedean) return c->master->fiftyval; - else if(irr::on) return irr::cellindex[c]; - else if(gp::on) return (get_code(gp::get_local_info(c)) << 8) | (c->master->fieldval / S7); + else if(IRREGULAR) return irr::cellindex[c]; + else if(GOLDBERG) return (get_code(gp::get_local_info(c)) << 8) | (c->master->fieldval / S7); if(ctof(c)) return c->master->fieldval; else return createMov(c, 0)->master->fieldval + 256 * createMov(c,2)->master->fieldval + (1<<16) * createMov(c,4)->master->fieldval; } @@ -354,7 +354,7 @@ int fieldval_uniq(cell *c) { return gmod(p.first * torusconfig::dx + p.second * torusconfig::dy, torusconfig::qty); } else if(binarytiling || archimedean) return 0; - else if(ctof(c) || gp::on || irr::on) return c->master->fieldval/S7; + else if(ctof(c) || NONSTDVAR) return c->master->fieldval/S7; else { int z = 0; for(int u=0; umaster->fieldval, randval)/7; @@ -433,7 +433,7 @@ int getHemisphere(heptagon *h, int which) { int getHemisphere(cell *c, int which) { if(torus) return 0; - if(which == 0 && gp::on && has_nice_dual()) { + if(which == 0 && GOLDBERG && has_nice_dual()) { set visited; vector q; vector type; @@ -465,7 +465,7 @@ int getHemisphere(cell *c, int which) { return getHemisphere(c->master, which); else { int score = 0; - if(gp::on) { + if(GOLDBERG) { auto li = gp::get_local_info(c); gp::be_in_triangle(li); auto corner = gp::corners * gp::loctoh_ort(li.relative); @@ -479,7 +479,7 @@ int getHemisphere(cell *c, int which) { if(score == 0 && error < -.001) score--; return score; } - else if(irr::on) { + else if(IRREGULAR) { auto m = irr::get_masters(c); for(int i=0; i<3; i++) score += getHemisphere(m[i], which); @@ -635,11 +635,11 @@ namespace patterns { si.id = (c->master->fiftyval >> 1) & 3; else si.id = 0; - if(nonbitrunc && gp_threecolor() != 2) + if(!BITRUNCATED && gp_threecolor() != 2) si.id *= 4; else si.id += 4; - si.dir = (pat == PAT_COLORING && !nonbitrunc ? 1 : 0) + (c->master->fiftyval | (c->master->fiftyval & 8 ? 0 : 2)); + si.dir = (pat == PAT_COLORING && BITRUNCATED ? 1 : 0) + (c->master->fiftyval | (c->master->fiftyval & 8 ? 0 : 2)); si.symmetries = 2; si.id += 8; si.id %= 12; @@ -649,14 +649,14 @@ namespace patterns { } else { int sp = c->c.spin(0); - if(gp::on) { + if(GOLDBERG) { sp = gp::last_dir(c); sp ^= int(ishex2(c)); } - if(geometry == gBolza2 && (!gp::on || gp_threecolor() == 2)) { + if(geometry == gBolza2 && (!GOLDBERG || gp_threecolor() == 2)) { patterninfo si0; patterninfo si1; - if(gp::on) { + if(GOLDBERG) { auto li = gp::get_local_info(c); val38(c->master->c7, si0, 0, PAT_COLORING); val38(c->master->move(li.last_dir)->c7, si1, 0, PAT_COLORING); @@ -672,7 +672,7 @@ namespace patterns { } else si.id = 8 * ((c->master->fiftyval & 1) ^ (sp & 1)); - if(gp::on && pseudohept(c)) si.id = 4; + if(GOLDBERG && pseudohept(c)) si.id = 4; bool dock = false; for(int i=0; itype; i+=2) { int fiv = createMov(c, i)->master->fiftyval; @@ -685,13 +685,13 @@ namespace patterns { if(symRotation) si.symmetries = 2; si.id += 8; si.id %= 12; - if(gp::on && pat == PAT_COLORING) + if(GOLDBERG && pat == PAT_COLORING) for(int i=0; itype; i++) { cell *c2 = createMov(c, i); int id2 = 4; if(!pseudohept(c2)) { int sp2 = c2->c.spin(0); - if(gp::on) { + if(GOLDBERG) { sp2 = gp::last_dir(c2); sp2 ^= int(ishex2(c2)); } @@ -733,7 +733,7 @@ namespace patterns { } void val_all(cell *c, patterninfo &si, int sub, int pat) { - if(irr::on || archimedean || binarytiling) si.symmetries = 1; + if(IRREGULAR || archimedean || binarytiling) si.symmetries = 1; else if(a46) val46(c, si, sub, pat); else if(a38) val38(c, si, sub, pat); else if(sphere) valSibling(c, si, sub, pat); @@ -745,7 +745,7 @@ namespace patterns { void val_warped(cell *c, patterninfo& si) { int u = ishept(c)?1:0; - if(S3 != 3 || S7 != 7 || gp::on || irr::on) { + if(S3 != 3 || S7 != 7 || NONSTDVAR) { si.id = u; si.dir = 1; return; @@ -815,7 +815,7 @@ namespace patterns { val_all(c, si, 0, 0); // get id: - if((gp::on? (S3==3) : !weirdhyperbolic) && isWarped(c)) + if((GOLDBERG? (S3==3) : !weirdhyperbolic) && isWarped(c)) val_warped(c, si); else { si.id = pseudohept(c) ? 1 : 0; @@ -827,13 +827,13 @@ namespace patterns { if(subpattern_flags & SPF_FULLSYM) si.symmetries = 1; } - if(sphere && !(nonbitrunc) && !(S7 == 3)) + if(sphere && BITRUNCATED && !(S7 == 3)) si.symmetries = ctof(c) ? 1 : 2; if(sphere && (sub & SPF_EXTRASYM)) { si.symmetries = ctof(c) ? 1 : 2; } if(a38) - si.symmetries = (ctof(c) && !nonbitrunc) ? 1 : 2; + si.symmetries = (ctof(c) && BITRUNCATED) ? 1 : 2; if(a457) { si.symmetries = ctof(c) ? 1 : 2; if(!ctof(c)) si.dir = 0; @@ -843,7 +843,7 @@ namespace patterns { } } - if(gp::on && has_nice_dual() && !ishept(c) && ishex1(c)) si.dir = fix6(si.dir+3); + if(GOLDBERG && has_nice_dual() && !ishept(c) && ishex1(c)) si.dir = fix6(si.dir+3); } ePattern whichPattern = PAT_NONE; @@ -917,7 +917,7 @@ namespace patterns { si.id = zebra40(c); // 4 to 43 int t4 = si.id>>2, tcdir = 0; - if(nonbitrunc) tcdir = si.id^1; + if(PURE) tcdir = si.id^1; else if(t4 == 10) tcdir = si.id-20; else if(t4 >= 4 && t4 < 7) tcdir = 40 + (si.id&3); @@ -972,11 +972,11 @@ namespace patterns { int look_for = -1; int shft = 0; if(inr(si.id, 0, 4)) { - look_for = si.id + (nonbitrunc ? 4 : 60); + look_for = si.id + (PURE ? 4 : 60); if(symRotation) si.symmetries = 1; } - else if(inr(si.id, 4, 32)) look_for = si.id + (nonbitrunc ? 28 : 168); - else if(inr(si.id, 32, 60)) look_for = si.id + (nonbitrunc ? -28 : 112); + else if(inr(si.id, 4, 32)) look_for = si.id + (PURE ? 28 : 168); + else if(inr(si.id, 32, 60)) look_for = si.id + (PURE ? -28 : 112); else if(inr(si.id, 60, 88)) look_for = si.id - 56, shft = si.reflect ? 1 : 5; else if(inr(si.id, 88, 116)) look_for = si.id - 84, shft = 3; else if(inr(si.id, 116, 144)) look_for = si.id + 56; @@ -1020,7 +1020,7 @@ namespace patterns { if(euclid) // use the torus ID si.id = fieldpattern::fieldval_uniq(c); - else if(nonbitrunc && !archimedean && !gp::on && !irr::on) + else if(PURE && !archimedean) // use the actual field codes si.id = fieldpattern::fieldval(c).first; else @@ -1037,7 +1037,7 @@ namespace patterns { val_all(c, si, sub, pat); } - else if(gp::on) { + else if(GOLDBERG) { bool football = (pat == PAT_COLORING && (sub & SPF_FOOTBALL)) || pat == 0; if(football) val_nopattern(c, si, sub); else val_threecolors(c, si, sub); @@ -1065,18 +1065,18 @@ namespace patterns { } bool geosupport_chessboard() { - return archimedean ? arcm::current.support_chessboard() : (nonbitrunc && S3 == 4); + return archimedean ? arcm::current.support_chessboard() : (VALENCE % 2 == 0); } int geosupport_threecolor() { - if(irr::on) return 0; - if(!nonbitrunc && S3 == 3) { + if(IRREGULAR) return 0; + if(BITRUNCATED && S3 == 3) { if(S7 % 2) return 1; return 2; } if((S7 % 2 == 0) && (S3 == 3)) return 2; - if(a46 && nonbitrunc) + if(a46 && PURE) return 1; if(archimedean) return arcm::current.support_threecolor(); return 0; @@ -1084,11 +1084,11 @@ int geosupport_threecolor() { int geosupport_football() { // always works in bitrunc geometries - if(!nonbitrunc) return 2; + if(BITRUNCATED) return 2; if(archimedean) return arcm::current.support_football(); - if(irr::on) return irr::bitruncations_performed ? 2 : 1; + if(IRREGULAR) return irr::bitruncations_performed ? 2 : 1; // always works in patterns supporting three-color int tc = max(geosupport_threecolor(), gp_threecolor()); @@ -1097,13 +1097,13 @@ int geosupport_football() { if(S3 == 3 && S7 == 7) return 1; // nice chessboard pattern, but not the actual Graveyard if(S3 == 4 && !(S7&1)) return 1; - if(S3 == 4 && gp::on) return 1; + if(S3 == 4 && GOLDBERG) return 1; return 0; } int pattern_threecolor(cell *c) { if(archimedean) return arcm::threecolor(arcm::id_of(c->master)); - if(irr::on || binarytiling) return !pseudohept(c); + if(IRREGULAR || binarytiling) return !pseudohept(c); if(S3 == 3 && !(S7&1) && gp_threecolor() == 1 && c->master->c7 != c) { auto li = gp::get_local_info(c); int rel = (li.relative.first - li.relative.second + MODFIXER) % 3; @@ -1116,12 +1116,12 @@ int pattern_threecolor(cell *c) { return pattern_threecolor(createStep(c->master, fix7(li.last_dir+1))->c7); } if(a38) { - // if(gp::on && gp_threecolor() == 2 && gp::pseudohept_val(c) == 0) return 0; + // if(GOLDBERG && gp_threecolor() == 2 && gp::pseudohept_val(c) == 0) return 0; patterns::patterninfo si; - patterns::val38(c, si, nonbitrunc ? 0 : patterns::SPF_ROT, patterns::PAT_COLORING); + patterns::val38(c, si, !BITRUNCATED ? 0 : patterns::SPF_ROT, patterns::PAT_COLORING); return si.id >> 2; } - if(a4 && gp::on) { + if(a4 && GOLDBERG) { patterns::patterninfo si; auto li = gp::get_local_info(c); if(S7 & 1) return (li.relative.first&1) + (li.relative.second&1)*2; @@ -1137,14 +1137,14 @@ int pattern_threecolor(cell *c) { if(li.relative.second & 1) i ^= i2; return i; } - if(a46 && !nonbitrunc) { + if(a46 && BITRUNCATED) { patterns::patterninfo si; patterns::val46(c, si, 0, patterns::PAT_COLORING); int i = si.id; return i >> 2; } if(euclid) { - if(a4 && nonbitrunc) return eupattern4(c); + if(a4 && PURE) return eupattern4(c); return eupattern(c) % 3; } if(S7 == 4 && S3 == 3) { @@ -1160,7 +1160,7 @@ int pattern_threecolor(cell *c) { } return sp; } - if(nonbitrunc) + if(PURE) return codesN[c->master->fiftyval]; if(ctof(c)) return 0; @@ -1172,7 +1172,7 @@ int pattern_threecolor(cell *c) { return 2 - (c->c.spin(i)&1); } } - if(stdhyperbolic && nonbitrunc) { + if(stdhyperbolic && PURE) { int z = zebra40(c); if(z == 5 || z == 8 || z == 15) return 0; if(c->land == laSnakeNest) { @@ -1182,16 +1182,16 @@ int pattern_threecolor(cell *c) { } return 1; } - if(a46 && nonbitrunc) { + if(a46 && !BITRUNCATED) { patterns::patterninfo si; patterns::val46(c, si, 0, patterns::PAT_COLORING); return si.id; } - if(S7 == 5 && nonbitrunc && S3 == 3) { + if(S7 == 5 && PURE && S3 == 3) { const int codes[12] = {1, 2, 0, 3, 2, 0, 0, 1, 3, 1, 2, 3}; return codes[c->master->fiftyval]; } - if(S7 == 3 && nonbitrunc) + if(S7 == 3 && PURE) return c->master->fiftyval; if(gp_threecolor() && (S7&1)) return gp::pseudohept_val(c) > 0; @@ -1202,12 +1202,12 @@ int pattern_threecolor(cell *c) { // in the 'pure heptagonal' tiling, returns true for a set of cells // which roughly corresponds to the heptagons in the normal tiling bool pseudohept(cell *c) { - if(irr::on) return irr::pseudohept(c); + if(IRREGULAR) return irr::pseudohept(c); if(binarytiling) return c->type & c->master->distance & 1; if(archimedean) return arcm::pseudohept(arcm::id_of(c->master)); - if(gp::on && gp_threecolor() == 2) + if(GOLDBERG && gp_threecolor() == 2) return gp::pseudohept_val(c) == 0; - if(gp::on && gp_threecolor() == 1 && (S7&1) && (S3 == 3)) + if(GOLDBERG && gp_threecolor() == 1 && (S7&1) && (S3 == 3)) return gp::pseudohept_val(c) == 0; return pattern_threecolor(c) == 0; } @@ -1215,9 +1215,9 @@ bool pseudohept(cell *c) { // while Krakens movement is usually restricted to non-pseudohept cells, // there is one special case when this does not work (because non-pseudohept cells have varying degrees) bool kraken_pseudohept(cell *c) { - if(!euclid && S3 == 4 && gp::on && (gp::param.first % 2 || gp::param.second % 2 || S7 % 2)) + if(!euclid && S3 == 4 && GOLDBERG && (gp::param.first % 2 || gp::param.second % 2 || S7 % 2)) return ishept(c); - else if(irr::on) + else if(IRREGULAR) return c->type != 6; else if(archimedean) return c->type == isize(arcm::current.triangles[0]); @@ -1230,7 +1230,7 @@ bool kraken_pseudohept(cell *c) { bool warptype(cell *c) { if(geosupport_chessboard()) return chessvalue(c); - else if(gp::on || irr::on) + else if(NONSTDVAR) return pseudohept(c); else return pattern_threecolor(c) == 0; @@ -1549,7 +1549,7 @@ namespace patterns { if((euclid && whichPattern == PAT_COLORING) || (a38 && whichPattern == PAT_COLORING) || - (a4 && nonbitrunc && whichPattern == PAT_COLORING && !a46)) + (a4 && !BITRUNCATED && whichPattern == PAT_COLORING && !a46)) dialog::addBoolItem(XLAT("edit all three colors"), subpattern_flags & SPF_ROT, '0'); if(euclid && whichPattern == PAT_COLORING) @@ -1558,7 +1558,7 @@ namespace patterns { if(a46 && whichPattern == PAT_COLORING) dialog::addBoolItem(XLAT("rotate the color groups"), subpattern_flags & SPF_CHANGEROT, '4'); - if(a46 && whichPattern == PAT_COLORING && !nonbitrunc) + if(a46 && whichPattern == PAT_COLORING && BITRUNCATED) dialog::addBoolItem(XLAT("edit both bitrunc colors"), subpattern_flags & SPF_TWOCOL, '5'); if( @@ -1572,10 +1572,10 @@ namespace patterns { dialog::addBoolItem(XLAT("symmetry 0-2"), subpattern_flags & SPF_SYM02, '2'); dialog::addBoolItem(XLAT("symmetry 0-3"), subpattern_flags & SPF_SYM03, '3'); } - if(euclid && among(whichPattern, PAT_COLORING, 0) && !archimedean) + if(euclid && among(whichPattern, PAT_COLORING, PAT_TYPES) && !archimedean) dialog::addBoolItem(XLAT("extra symmetries"), subpattern_flags & SPF_EXTRASYM, '='); - if(archimedean && arcm::current.have_symmetry && whichPattern == 0) + if(archimedean && arcm::current.have_symmetry && whichPattern == PAT_TYPES) dialog::addBoolItem(XLAT("extra symmetries"), subpattern_flags & SPF_EXTRASYM, '='); if(whichPattern == PAT_SINGLETYPE) { @@ -1586,15 +1586,15 @@ namespace patterns { if(euclid && among(whichPattern, PAT_COLORING, 0)) dialog::addBoolItem(XLAT("full symmetry"), subpattern_flags & SPF_FULLSYM, '!'); - if(a38 && nonbitrunc && whichPattern == 0) { + if(a38 && PURE && whichPattern == PAT_TYPES) { dialog::addBoolItem(XLAT("extra symmetries"), subpattern_flags & SPF_EXTRASYM, '='); } - if(a46 && nonbitrunc && whichPattern == PAT_COLORING) { + if(a46 && PURE && whichPattern == PAT_COLORING) { dialog::addBoolItem(XLAT("extra symmetries"), subpattern_flags & SPF_EXTRASYM, '='); } - if((whichPattern == PAT_COLORING) || (whichPattern == 0 && archimedean)) { + if((whichPattern == PAT_COLORING) || (whichPattern == PAT_TYPES && archimedean)) { dialog::addBoolItem(XLAT("alternate coloring"), subpattern_flags & SPF_ALTERNATE, '\''); dialog::addBoolItem(XLAT("football pattern"), subpattern_flags & SPF_FOOTBALL, '*'); } @@ -1692,7 +1692,7 @@ namespace patterns { struct changeable_pattern_geometry { eGeometry geo; - bool nonbitru; + eVariation var; ePattern whichPattern; int subpattern_flags; }; @@ -1704,85 +1704,85 @@ namespace patterns { vector cpatterns = { {"football", { - {gNormal, false, PAT_TYPES, 0}, - {gSphere, false, PAT_TYPES, 0}, - {gEuclid, false, PAT_TYPES, SPF_EXTRASYM}, - {gOctagon, false, PAT_TYPES, 0}, - {gOctagon, true, PAT_COLORING, SPF_FOOTBALL | SPF_EXTRASYM}, - {g45, false, PAT_TYPES, 0}, - {g46, false, PAT_TYPES, SPF_EXTRASYM}, - {g47, false, PAT_TYPES, 0}, - {gSmallSphere, false, PAT_TYPES, 0}, - {gSmallSphere, true, PAT_COLORING, SPF_FOOTBALL | SPF_EXTRASYM}, - {gTinySphere, false, PAT_TYPES, SPF_EXTRASYM}, - {gEuclidSquare, false, PAT_TYPES, SPF_EXTRASYM}, + {gNormal, eVariation::bitruncated, PAT_TYPES, 0}, + {gSphere, eVariation::bitruncated, PAT_TYPES, 0}, + {gEuclid, eVariation::bitruncated, PAT_TYPES, SPF_EXTRASYM}, + {gOctagon, eVariation::bitruncated, PAT_TYPES, 0}, + {gOctagon, eVariation::pure, PAT_COLORING, SPF_FOOTBALL | SPF_EXTRASYM}, + {g45, eVariation::bitruncated, PAT_TYPES, 0}, + {g46, eVariation::bitruncated, PAT_TYPES, SPF_EXTRASYM}, + {g47, eVariation::bitruncated, PAT_TYPES, 0}, + {gSmallSphere, eVariation::bitruncated, PAT_TYPES, 0}, + {gSmallSphere, eVariation::pure, PAT_COLORING, SPF_FOOTBALL | SPF_EXTRASYM}, + {gTinySphere, eVariation::bitruncated, PAT_TYPES, SPF_EXTRASYM}, + {gEuclidSquare, eVariation::bitruncated, PAT_TYPES, SPF_EXTRASYM}, }}, {"three colors", { - {gEuclid, false, PAT_COLORING, SPF_SYM0123 | SPF_EXTRASYM}, - {gSmallSphere, false, PAT_COLORING, 0}, - {gSmallSphere, false, PAT_COLORING, SPF_ALTERNATE}, - {gSmallSphere, true, PAT_COLORING, 0}, - {gOctagon, false, PAT_COLORING, SPF_ROT | SPF_EXTRASYM}, - {gOctagon, false, PAT_COLORING, SPF_ROT | SPF_EXTRASYM | SPF_ALTERNATE}, - {gOctagon, true, PAT_COLORING, 0}, - {gEuclidSquare, false, PAT_COLORING, SPF_SYM03 | SPF_EXTRASYM}, - {gEuclidSquare, false, PAT_COLORING, SPF_SYM03 | SPF_EXTRASYM | SPF_ALTERNATE}, - {g46, false, PAT_COLORING, SPF_SYM0123}, - {g46, false, PAT_COLORING, SPF_SYM0123 | SPF_EXTRASYM | SPF_ALTERNATE} + {gEuclid, eVariation::bitruncated, PAT_COLORING, SPF_SYM0123 | SPF_EXTRASYM}, + {gSmallSphere, eVariation::bitruncated, PAT_COLORING, 0}, + {gSmallSphere, eVariation::bitruncated, PAT_COLORING, SPF_ALTERNATE}, + {gSmallSphere, eVariation::pure, PAT_COLORING, 0}, + {gOctagon, eVariation::bitruncated, PAT_COLORING, SPF_ROT | SPF_EXTRASYM}, + {gOctagon, eVariation::bitruncated, PAT_COLORING, SPF_ROT | SPF_EXTRASYM | SPF_ALTERNATE}, + {gOctagon, eVariation::pure, PAT_COLORING, 0}, + {gEuclidSquare, eVariation::bitruncated, PAT_COLORING, SPF_SYM03 | SPF_EXTRASYM}, + {gEuclidSquare, eVariation::bitruncated, PAT_COLORING, SPF_SYM03 | SPF_EXTRASYM | SPF_ALTERNATE}, + {g46, eVariation::bitruncated, PAT_COLORING, SPF_SYM0123}, + {g46, eVariation::bitruncated, PAT_COLORING, SPF_SYM0123 | SPF_EXTRASYM | SPF_ALTERNATE} }}, {"chessboard", { - {gEuclidSquare, true, PAT_CHESS, SPF_EXTRASYM}, - {g45, true, PAT_CHESS, 0}, - {g46, true, PAT_CHESS, 0}, - {g47, true, PAT_CHESS, 0} + {gEuclidSquare, eVariation::pure, PAT_CHESS, SPF_EXTRASYM}, + {g45, eVariation::pure, PAT_CHESS, 0}, + {g46, eVariation::pure, PAT_CHESS, 0}, + {g47, eVariation::pure, PAT_CHESS, 0} }}, {"single type", { - {gNormal, true, PAT_SINGLETYPE, 0}, - {gSphere, true, PAT_SINGLETYPE, 0}, - {gEuclid, false, PAT_SINGLETYPE, 0}, - {gOctagon, true, PAT_SINGLETYPE, 0}, - {g45, true, PAT_SINGLETYPE, 0}, - {g46, true, PAT_SINGLETYPE, 0}, - {g47, true, PAT_SINGLETYPE, 0}, - {gSmallSphere, true, PAT_SINGLETYPE, 0}, - {gTinySphere, true, PAT_SINGLETYPE, 0}, - {gEuclidSquare, true, PAT_SINGLETYPE, 0}, + {gNormal, eVariation::pure, PAT_SINGLETYPE, 0}, + {gSphere, eVariation::pure, PAT_SINGLETYPE, 0}, + {gEuclid, eVariation::bitruncated, PAT_SINGLETYPE, 0}, + {gOctagon, eVariation::pure, PAT_SINGLETYPE, 0}, + {g45, eVariation::pure, PAT_SINGLETYPE, 0}, + {g46, eVariation::pure, PAT_SINGLETYPE, 0}, + {g47, eVariation::pure, PAT_SINGLETYPE, 0}, + {gSmallSphere, eVariation::pure, PAT_SINGLETYPE, 0}, + {gTinySphere, eVariation::pure, PAT_SINGLETYPE, 0}, + {gEuclidSquare, eVariation::pure, PAT_SINGLETYPE, 0}, }}, {"single type+symmetry", { - {gNormal, true, PAT_SINGLETYPE, SPF_EXTRASYM}, - {gSphere, true, PAT_SINGLETYPE, SPF_EXTRASYM}, - {gEuclid, false, PAT_SINGLETYPE, SPF_EXTRASYM}, - {gOctagon, true, PAT_SINGLETYPE, SPF_EXTRASYM}, - {g45, true, PAT_SINGLETYPE, SPF_EXTRASYM}, - {g46, true, PAT_SINGLETYPE, SPF_EXTRASYM}, - {g47, true, PAT_SINGLETYPE, SPF_EXTRASYM}, - {gSmallSphere, true, PAT_SINGLETYPE, SPF_EXTRASYM}, - {gTinySphere, true, PAT_SINGLETYPE, SPF_EXTRASYM}, - {gEuclidSquare, true, PAT_SINGLETYPE, SPF_EXTRASYM}, + {gNormal, eVariation::pure, PAT_SINGLETYPE, SPF_EXTRASYM}, + {gSphere, eVariation::pure, PAT_SINGLETYPE, SPF_EXTRASYM}, + {gEuclid, eVariation::bitruncated, PAT_SINGLETYPE, SPF_EXTRASYM}, + {gOctagon, eVariation::pure, PAT_SINGLETYPE, SPF_EXTRASYM}, + {g45, eVariation::pure, PAT_SINGLETYPE, SPF_EXTRASYM}, + {g46, eVariation::pure, PAT_SINGLETYPE, SPF_EXTRASYM}, + {g47, eVariation::pure, PAT_SINGLETYPE, SPF_EXTRASYM}, + {gSmallSphere, eVariation::pure, PAT_SINGLETYPE, SPF_EXTRASYM}, + {gTinySphere, eVariation::pure, PAT_SINGLETYPE, SPF_EXTRASYM}, + {gEuclidSquare, eVariation::pure, PAT_SINGLETYPE, SPF_EXTRASYM}, }}, {"odd/even", { - {gNormal, false, PAT_SINGLETYPE, SPF_TWOCOL}, - {gSphere, false, PAT_SINGLETYPE, SPF_TWOCOL}, - {g45, true, PAT_SINGLETYPE, SPF_TWOCOL}, - {g47, true, PAT_SINGLETYPE, SPF_TWOCOL} + {gNormal, eVariation::bitruncated, PAT_SINGLETYPE, SPF_TWOCOL}, + {gSphere, eVariation::bitruncated, PAT_SINGLETYPE, SPF_TWOCOL}, + {g45, eVariation::pure, PAT_SINGLETYPE, SPF_TWOCOL}, + {g47, eVariation::pure, PAT_SINGLETYPE, SPF_TWOCOL} }}, {"large picture", { - {gNormal, false, PAT_PALACE, SPF_SYM0123}, - {gNormal, true, PAT_PALACE, SPF_SYM0123}, - {gSphere, false, PAT_FIELD, 0}, - {gSphere, true, PAT_FIELD, 0}, - {gElliptic, false, PAT_FIELD, 0}, - {gElliptic, true, PAT_FIELD, 0}, - {gEuclid, false, PAT_PALACE, 0} + {gNormal, eVariation::bitruncated, PAT_PALACE, SPF_SYM0123}, + {gNormal, eVariation::pure, PAT_PALACE, SPF_SYM0123}, + {gSphere, eVariation::bitruncated, PAT_FIELD, 0}, + {gSphere, eVariation::pure, PAT_FIELD, 0}, + {gElliptic, eVariation::bitruncated, PAT_FIELD, 0}, + {gElliptic, eVariation::pure, PAT_FIELD, 0}, + {gEuclid, eVariation::bitruncated, PAT_PALACE, 0} }}, {"periodic patterns", { - {gNormal, false, PAT_ZEBRA, SPF_SYM0123 | SPF_ROT}, - {gNormal, false, PAT_PALACE, SPF_SYM0123 | SPF_ROT}, - {gNormal, false, PAT_EMERALD, SPF_SYM0123 | SPF_ROT}, - {g46, true, PAT_COLORING, SPF_SYM0123 | SPF_CHANGEROT}, - {g45, true, PAT_ZEBRA, SPF_SYM0123 | SPF_ROT}, - {g47, true, PAT_ZEBRA, SPF_SYM0123 | SPF_ROT}, - {gOctagon, true, PAT_COLORING, SPF_DOCKS}, + {gNormal, eVariation::bitruncated, PAT_ZEBRA, SPF_SYM0123 | SPF_ROT}, + {gNormal, eVariation::bitruncated, PAT_PALACE, SPF_SYM0123 | SPF_ROT}, + {gNormal, eVariation::bitruncated, PAT_EMERALD, SPF_SYM0123 | SPF_ROT}, + {g46, eVariation::pure, PAT_COLORING, SPF_SYM0123 | SPF_CHANGEROT}, + {g45, eVariation::pure, PAT_ZEBRA, SPF_SYM0123 | SPF_ROT}, + {g47, eVariation::pure, PAT_ZEBRA, SPF_SYM0123 | SPF_ROT}, + {gOctagon, eVariation::pure, PAT_COLORING, SPF_DOCKS}, }} }; @@ -1807,7 +1807,7 @@ namespace patterns { for(int j=0; j= 'a' && uni < 'a' + isize(cpatterns[cgroup].geometries)) { auto &g = cpatterns[cgroup].geometries[uni - 'a']; - if(g.geo != geometry) { targetgeometry = g.geo; stop_game_and_switch_mode(rg::geometry); } - if(gp::on) stop_game_and_switch_mode(rg::gp); - if(g.nonbitru != nonbitrunc) stop_game_and_switch_mode(rg::bitrunc);; + if(g.geo != geometry) set_geometry(g.geo); + if(g.var != variation) set_variation(g.var); whichPattern = g.whichPattern; subpattern_flags = g.subpattern_flags; bool not_restarted = game_active; @@ -1874,8 +1873,9 @@ namespace patterns { for(int i=0; imaster) << 8; - else if(!gp::on) return 0; + else if(!GOLDBERG) return 0; else if(c == c->master->c7) return (fixdir(si.dir, c) << 8); else return (get_code(gp::get_local_info(c)) << 16) | (fixdir(si.dir, c) << 8); } @@ -2089,7 +2089,6 @@ namespace linepatterns { if(is_master(c) && !euclid) for(int i=0; imaster->move(i) && c->master->move(i) < c->master && c->master->move(i)->dm4 == c->master->dm4) queuelinef(tC0(V), V*xspinpush0(-2*M_PI*i/S7 - master_to_c7_angle(), tessf), col, 2 + vid.linequality); - // V*xspinpush0((nonbitrunc?M_PI:0) -2*M_PI*i/S7 break; } @@ -2121,13 +2120,13 @@ namespace linepatterns { break; case patVine: { - if(gp::on) { + if(GOLDBERG) { if(c->master->c7 != c) if(gmatrix.count(c->move(0))) queuelinef(tC0(V), gmatrix[c->move(0)]*C0, darkena(backcolor ^ 0xFFFFFF, 0, col), 2 + vid.linequality); } - else if(irr::on) { + else if(IRREGULAR) { if(c->master->c7 != c) if(gmatrix.count(c->master->c7)) queuelinef(tC0(V), gmatrix[c->master->c7]*C0, darkena(backcolor ^ 0xFFFFFF, 0, col), @@ -2146,7 +2145,7 @@ namespace linepatterns { } case patPower: { - if(gp::on) { + if(GOLDBERG) { for(int i=0; imove(i) && c->move(i)->master != c->master && gmatrix.count(c->move(i))) queuelinef(tC0(V), gmatrix[c->move(i)]*C0, col, @@ -2200,7 +2199,7 @@ namespace linepatterns { dialog::init(XLAT("line patterns")); for(numpat=0; patterns[numpat].lpname; numpat++) - dialog::addColorItem(among(patterns[numpat].id, patVine, patPower) && gp::on ? XLAT("Goldberg") + (patterns[numpat].id == patVine ? " " : ""): XLAT(patterns[numpat].lpname), patterns[numpat].color, 'a'+numpat); + dialog::addColorItem(among(patterns[numpat].id, patVine, patPower) && GOLDBERG ? XLAT("Goldberg") + (patterns[numpat].id == patVine ? " " : ""): XLAT(patterns[numpat].lpname), patterns[numpat].color, 'a'+numpat); dialog::addBreak(50); dialog::addBack(); diff --git a/polygons.cpp b/polygons.cpp index 38d28565..5d8853a4 100644 --- a/polygons.cpp +++ b/polygons.cpp @@ -93,7 +93,7 @@ bool ptdsort(const polytodraw& p1, const polytodraw& p2) { void hpcpush(hyperpoint h) { if(sphere) h = mid(h,h); - ld threshold = (sphere ? (ISMOBWEB || gp::on || irr::on ? .04 : .001) : 0.1) * pow(.25, vid.linequality); + ld threshold = (sphere ? (ISMOBWEB || NONSTDVAR ? .04 : .001) : 0.1) * pow(.25, vid.linequality); if(/*vid.usingGL && */!first && intval(hpc.back(), h) > threshold) { hyperpoint md = mid(hpc.back(), h); hpcpush(md); @@ -1402,12 +1402,12 @@ hyperpoint hpxd(ld d, ld x, ld y, ld z) { double scalef; hyperpoint hpxyzsc(double x, double y, double z) { - if(nonbitrunc) return hpxd(scalef, x, y, z); + if(!BITRUNCATED) return hpxd(scalef, x, y, z); else return hpxyz(x,y,z); } hyperpoint turtlevertex(int u, double x, double y, double z) { - ld scale = nonbitrunc ? scalef : 1; + ld scale = BITRUNCATED ? 1 : scalef; if(u) scale /= 2; return hpxd(scale, x, y, z); } @@ -1488,7 +1488,7 @@ void bshape(hpcshape& sh, PPR prio, double shzoom, int shapeid, double bonus = 0 while(polydata[whereis + 2*qty] != NEWSHAPE) qty++; double shzoomx = shzoom; double shzoomy = shzoom; - if(shzoom == WOLF) shzoomx = 1.5 * (nonbitrunc && !archimedean ? crossf / hcrossf : 1), shzoomy = 1.6 * (nonbitrunc && !archimedean ? crossf / hcrossf : 1); + if(shzoom == WOLF) shzoomx = 1.5 * (!BITRUNCATED && !archimedean ? crossf / hcrossf : 1), shzoomy = 1.6 * (!BITRUNCATED && !archimedean ? crossf / hcrossf : 1); int rots2 = rots; // shapes 368..370 are specially designed if(!(shapeid >= 368 && shapeid <= 370)) { @@ -1618,7 +1618,7 @@ void buildpolys() { } // scales - scalef = nonbitrunc ? crossf / hcrossf7 : hcrossf / hcrossf7; + scalef = BITRUNCATED ? hcrossf / hcrossf7 : crossf / hcrossf7; ld xcrossf = crossf; @@ -1627,10 +1627,10 @@ void buildpolys() { double spzoom6 = sphere ? 1.2375 : 1; double spzoom7 = sphere ? .8 : 1; - double spzoomd7 = (nonbitrunc && sphere) ? 1 : spzoom7; + double spzoomd7 = (!BITRUNCATED && sphere) ? 1 : spzoom7; double fac80 = a45 ? 1.4 : a46 ? 1.2 : (a38) ? .7 : .8; - double fac94 = euclid ? .8 : a4 ? (nonbitrunc ? 1.1 : .9) : .94; + double fac94 = euclid ? .8 : a4 ? (BITRUNCATED ? .9 : 1.1) : .94; if(euclid) fac80 = fac94 = .9; @@ -1641,11 +1641,11 @@ void buildpolys() { fac80 *= 1.2, fac94 *= .94; // procedural floors - double zhexf = nonbitrunc ? crossf* .55 : hexf; + double zhexf = BITRUNCATED ? hexf : crossf* .55; double p = -.006; - int td = ((nonbitrunc || euclid) && !(S7&1)) ? S42+S6 : 0; + int td = ((!BITRUNCATED || euclid) && !(S7&1)) ? S42+S6 : 0; double trihepta0 = scalef*spzoom6*(.2776+p) * gsca(a4, 1.3, a46, .975, a47, .85, a38, .9) * bscale6; double trihepta1 = (sphere ? .54 : scalef*spzoom6*(.5273-2*p)) * gsca(a4, .8, a46, 1.075, sphere4, 1.3) * bscale7; @@ -1658,7 +1658,7 @@ void buildpolys() { if(sphere&&S7==3) trihepta0 *= 1.3, trihepta1 *= 1.6; - if(nonbitrunc) { + if(!BITRUNCATED) { ld hedge = hdist(xspinpush0(M_PI/S7, rhexf), xspinpush0(-M_PI/S7, rhexf)); trihepta1 = hdist0(xpush(tessf) * xspinpush0(2*M_PI*2/S7, tessf)) / 2 * .98; @@ -1671,16 +1671,16 @@ void buildpolys() { double floorrad1 = rhexf / gp::scale *0.94; ld goldbf = 1; - if(gp::on) goldbf = gp::scale * 1.6; - if(irr::on) goldbf = irr::scale * 1.6; - if(gp::on) floorrad1 /= 1.6; + if(GOLDBERG) goldbf = gp::scale * 1.6; + if(IRREGULAR) goldbf = irr::scale * 1.6; + if(GOLDBERG) floorrad1 /= 1.6; double triangleside = hcrossf*.94; - if(nonbitrunc) + if(!BITRUNCATED) triangleside = tessf * .94; if(euclid4) { - if(nonbitrunc) + if(!BITRUNCATED) floorrad0 = floorrad1 = rhexf * .94; else floorrad0 = hexvdist * .9, @@ -1768,7 +1768,7 @@ void buildpolys() { hpcpush(ddi(0, -zhexf*2.4) * C0); bshape(shMirror, PPR::WALL); - if(nonbitrunc) { + if(PURE) { for(int t=0; t<=S7; t++) hpcpush(ddi(t*12, floorrad1*7/8 * gp::scale) * C0); } else { @@ -1843,11 +1843,11 @@ void buildpolys() { } double disksize = xcrossf; - if(nonbitrunc && a38) disksize *= 2; + if(PURE && a38) disksize *= 2; else if(a38) disksize *= 1.5; - else if(nonbitrunc && S6 == 8) disksize *= 1.5; + else if(!BITRUNCATED && S6 == 8) disksize *= 1.5; - if(a38 && gp::on) disksize /= 2; + if(a38 && GOLDBERG) disksize /= 2; bshape(shDisk, PPR::ITEM); for(int i=0; i<=S84; i+=S3) @@ -2045,9 +2045,9 @@ void buildpolys() { if(a38) spzoom6 *= .9; - if(a4 && !nonbitrunc) spzoom6 *= 1.9, spzoom7 *= .9, spzoomd7 *= .9; - if(a46 && !nonbitrunc) spzoom6 *= .9; - if(a47 && !nonbitrunc) spzoom6 *= .85; + if(a4 && BITRUNCATED) spzoom6 *= 1.9, spzoom7 *= .9, spzoomd7 *= .9; + if(a46 && BITRUNCATED) spzoom6 *= .9; + if(a47 && BITRUNCATED) spzoom6 *= .85; if(archimedean) shFullFloor.configure(arcm::current.scale()/2, arcm::current.scale()/2); @@ -2059,7 +2059,7 @@ void buildpolys() { shMFloor3.configure(floorrad0*5/8, floorrad1*5/8); shMFloor4.configure(floorrad0*4/8, floorrad1*4/8); shBigTriangle.configure(triangleside, 0); shBigTriangle.prio = PPR::FLOOR_TOWER; - shBigHepta.configure(0, (nonbitrunc ? tessf : xcrossf) * .97); + shBigHepta.configure(0, (!BITRUNCATED ? tessf : xcrossf) * .97); shTriheptaFloor.configure(trihepta0, trihepta1); shDragonFloor.prio = PPR::FLOOR_DRAGON; shPowerFloor.prio = PPR::FLOOR_DRAGON; @@ -2101,7 +2101,7 @@ void buildpolys() { bshape(shZebra[1], PPR::FLOOR, scalef, 163); bshape(shZebra[2], PPR::FLOOR, scalef, 164); bshape(shZebra[3], PPR::FLOOR, scalef, 165); - bshape(shZebra[4], PPR::FLOOR, 1, 166); // for nonbitrunc + bshape(shZebra[4], PPR::FLOOR, 1, 166); // for pure bshape(shEmeraldFloor[0], PPR::FLOOR, scalef, 167); // 4 bshape(shEmeraldFloor[1], PPR::FLOOR, scalef, 168); // 12 bshape(shEmeraldFloor[2], PPR::FLOOR, scalef, 169); // 16 @@ -2115,9 +2115,9 @@ void buildpolys() { bshape(shTower[4], PPR::FLOOR_TOWER, scalef, 200); // 9 bshape(shTower[5], PPR::FLOOR_TOWER, scalef, 201); // 10 bshape(shTower[6], PPR::FLOOR_TOWER, scalef, 202); // 10 - bshape(shTower[7], PPR::FLOOR_TOWER, 1, 203); // nonbitrunc 7 - bshape(shTower[8], PPR::FLOOR_TOWER, 1, 204); // nonbitrunc 11 - bshape(shTower[9], PPR::FLOOR_TOWER, 1, 205); // nonbitrunc 15 + bshape(shTower[7], PPR::FLOOR_TOWER, 1, 203); // pure 7 + bshape(shTower[8], PPR::FLOOR_TOWER, 1, 204); // pure 11 + bshape(shTower[9], PPR::FLOOR_TOWER, 1, 205); // pure 15 bshape(shTower[10], PPR::FLOOR_TOWER, scalef, 206); // Euclidean // structures & walls @@ -2160,11 +2160,11 @@ void buildpolys() { bshape(shWormTail, PPR::TENTACLE1, scalef, 383); bshape(shSmallWormTail, PPR::TENTACLE1, scalef, 384); - if(nonbitrunc) bshape(shDragonSegment, PPR::TENTACLE1, gp::scale * irr::scale, 233); + if(!BITRUNCATED) bshape(shDragonSegment, PPR::TENTACLE1, gp::scale * irr::scale, 233); else bshape(shDragonSegment, PPR::TENTACLE1, scalef, 234); bshape(shDragonWings, PPR::ONTENTACLE, scalef, 237); bshape(shDragonLegs, PPR::TENTACLE0, scalef, 238); - if(nonbitrunc) bshape(shDragonTail, PPR::TENTACLE1, gp::scale * irr::scale, 239); + if(!BITRUNCATED) bshape(shDragonTail, PPR::TENTACLE1, gp::scale * irr::scale, 239); else bshape(shDragonTail, PPR::TENTACLE1, scalef, 240); bshape(shDragonNostril, PPR::ONTENTACLE_EYES, scalef, 241); bshape(shDragonHead, PPR::ONTENTACLE, scalef, 242); @@ -2173,11 +2173,11 @@ void buildpolys() { if(sphere) krsc *= 1.4; if(S7 ==8) krsc *= 1.3; - if(nonbitrunc && !gp::on && !irr::on && !euclid4) { + if(PURE && !euclid4) { tentacle_length = 1.52; bshape(shSeaTentacle, PPR::TENTACLE1, 1, 245); } - else if(gp::on || irr::on) { + else if(NONSTDVAR) { tentacle_length = 0.566256 * 1.6 * gp::scale * irr::scale * krsc; bshape(shSeaTentacle, PPR::TENTACLE1, 1.6 * gp::scale * irr::scale * krsc, 246); } @@ -2185,8 +2185,8 @@ void buildpolys() { tentacle_length = 0.566256 * gp::scale * irr::scale; bshape(shSeaTentacle, PPR::TENTACLE1, gp::scale * irr::scale, 246); } - ld ksc = (nonbitrunc ? 1.8 : 1.5) * gp::scale * irr::scale * krsc; - if(euclid4 && nonbitrunc) ksc *= .5; + ld ksc = (!BITRUNCATED ? 1.8 : 1.5) * gp::scale * irr::scale * krsc; + if(euclid4 && PURE) ksc *= .5; bshape(shKrakenHead, PPR::ONTENTACLE, ksc, 247); bshape(shKrakenEye, PPR::ONTENTACLE_EYES, ksc, 248); bshape(shKrakenEye2, PPR::ONTENTACLE_EYES2, ksc, 249); @@ -2420,10 +2420,10 @@ void buildpolys() { for(int v=0; v<13; v++) for(int z=0; z<2; z++) copyshape(shTortoise[v][4+z], shTortoise[v][2+z], PPR(shTortoise[v][2+z].prio + (PPR::CARRIED-PPR::ITEM))); - if(nonbitrunc) bshape(shMagicSword, PPR::MAGICSWORD, euclid4 ? gp::scale * irr::scale / 2 : gp::scale * irr::scale, 243); + if(!BITRUNCATED) bshape(shMagicSword, PPR::MAGICSWORD, euclid4 ? gp::scale * irr::scale / 2 : gp::scale * irr::scale, 243); else bshape(shMagicSword, PPR::MAGICSWORD, 1, 244); - if(nonbitrunc) bshape(shMagicShovel, PPR::MAGICSWORD, euclid4 ? gp::scale * irr::scale / 2 : gp::scale * irr::scale, 333); + if(!BITRUNCATED) bshape(shMagicShovel, PPR::MAGICSWORD, euclid4 ? gp::scale * irr::scale / 2 : gp::scale * irr::scale, 333); else bshape(shMagicShovel, PPR::MAGICSWORD, 1, 333); bshape(shBead0, PPR(20), 1, 250); diff --git a/quit.cpp b/quit.cpp index 63a9e164..63e733b3 100644 --- a/quit.cpp +++ b/quit.cpp @@ -275,8 +275,7 @@ hint hints[] = { resetModes(); stop_game(); specialland = laHalloween; - targetgeometry = gSphere; - restart_game(rg::geometry); + set_geometry(gSphere); vid.alpha = 999; vid.scale = 998; } diff --git a/rogueviz-kohonen.cpp b/rogueviz-kohonen.cpp index 96a7ce4d..04346677 100644 --- a/rogueviz-kohonen.cpp +++ b/rogueviz-kohonen.cpp @@ -419,7 +419,7 @@ pair get_cellcrawler_id(cell *c) { if(torus && (torusconfig::tmflags() & torusconfig::TF_KLEIN)) return make_pair(cell_to_pair(c).second * 2 + ctof(c), 0); int id = 0, dir = 0; - if(gp::on) { + if(GOLDBERG) { gp::local_info li = gp::get_local_info(c); id = (li.relative.first & 15) + (li.relative.second & 15) * 16 + fix6(li.total_dir) * 256; // ld = li.last_dir; diff --git a/rogueviz.cpp b/rogueviz.cpp index 516f4f86..bf5683de 100644 --- a/rogueviz.cpp +++ b/rogueviz.cpp @@ -1231,7 +1231,7 @@ bool drawVertex(const transmatrix &V, cell *c, shmup::monster *m) { } hyperpoint h = tC0(V * m->at); - transmatrix V2 = rgpushxto0(h) * ypush(nonbitrunc ? .3 : .2); + transmatrix V2 = rgpushxto0(h) * ypush(PURE ? .3 : .2); // todo-variation if(doshow && !behindsphere(V2)) { if(vd.info) queuelink(vd.info, PPR::TEXT); queuestr(V2, (svg::in ? .28 : .2) * crossf / hcrossf, vd.name, backcolor ? 0x000000 : 0xFFFF00, svg::in ? 0 : 1); @@ -1800,7 +1800,7 @@ using namespace tour; string cname() { if(euclid) return "coord-6.txt"; - if(nonbitrunc) return "coord-7.txt"; + if(PURE) return "coord-7.txt"; return "coord-67.txt"; } diff --git a/savemem.cpp b/savemem.cpp index 205720aa..3aa1256b 100644 --- a/savemem.cpp +++ b/savemem.cpp @@ -40,7 +40,7 @@ void slow_delete_cell(cell *c) { void delete_heptagon(heptagon *h2) { cell *c = h2->c7; - if(!nonbitrunc) { + if(BITRUNCATED) { for(int i=0; itype; i++) if(c->move(i)) slow_delete_cell(c->move(i)); @@ -84,7 +84,7 @@ bool unsafeLand(cell *c) { } void save_memory() { - if(quotient || !hyperbolic) return; + if(quotient || !hyperbolic || NONSTDVAR) return; if(!memory_saving_mode) return; if(unsafeLand(cwt.at)) return; int d = celldist(cwt.at); diff --git a/scores.cpp b/scores.cpp index 629ac0c6..6df6b1dd 100644 --- a/scores.cpp +++ b/scores.cpp @@ -36,9 +36,14 @@ int modediff(score *S) { if(S->box[238]) g = gSphere; if(S->box[239]) g = gElliptic; if(max(S->box[197], 1) != multi::players) diff += 8; - if(S->box[186] != nonbitrunc || S->box[341] != gp::on) - diff += 16; - if(S->box[341] && gp::on && (S->box[342] != gp::param.first || S->box[343] != gp::param.second)) + + eVariation savevar = + S->box[341] ? eVariation::goldberg : + S->box[344] ? eVariation::irregular : + eVariation(S->box[186]); + + if(variation != savevar) diff += 16; + if(GOLDBERG && savevar == eVariation::goldberg && (S->box[342] != gp::param.first || S->box[343] != gp::param.second)) diff += 16; if(S->box[196] != chaosmode) diff += 32; if(S->box[119] != shmup::on) diff += 64; diff --git a/shmup.cpp b/shmup.cpp index 417707af..b6a3d376 100644 --- a/shmup.cpp +++ b/shmup.cpp @@ -3305,12 +3305,12 @@ void destroyBoats(cell *c) { } transmatrix master_relative(cell *c, bool get_inverse) { - if(irr::on) { + if(IRREGULAR) { int id = irr::cellindex[c]; ld alpha = 2 * M_PI / S7 * irr::periodmap[c->master].base.spin; return get_inverse ? irr::cells[id].rpusher * spin(-alpha-master_to_c7_angle()): spin(alpha + master_to_c7_angle()) * irr::cells[id].pusher; } - else if(gp::on) { + else if(GOLDBERG) { if(c == c->master->c7) { return spin((get_inverse?-1:1) * master_to_c7_angle()); } @@ -3321,7 +3321,7 @@ transmatrix master_relative(cell *c, bool get_inverse) { return T; } } - else if(!nonbitrunc && !euclid) { + else if(BITRUNCATED && !euclid) { for(int d=0; dmaster->c7->move(d) == c) return (get_inverse?invhexmove:hexmove)[d]; return Id; diff --git a/system.cpp b/system.cpp index 6d2a8d22..6b6ee058 100644 --- a/system.cpp +++ b/system.cpp @@ -35,7 +35,7 @@ bool verless(string v, string cmp) { bool do_use_special_land() { return !safety && - (peace::on || tactic::on || geometry || gp::on || irr::on || randomPatternsMode || yendor::on); + (peace::on || tactic::on || geometry || NONSTDVAR || randomPatternsMode || yendor::on); } hookset *hooks_welcome_message; @@ -569,7 +569,10 @@ void applyBoxes() { applyBoxBool(survivalist); if(loadingHi) applyBoxI(itLotus); else applyBoxNum(truelotus, "lotus/escape"); - applyBoxBool(nonbitrunc, "heptagons only"); + + int v = int(variation); + applyBoxNum(v, "variation"); + variation = eVariation(v); applyBoxI(itRose); applyBoxOrb(itOrbBeauty); applyBoxI(itCoral); @@ -690,11 +693,12 @@ void applyBoxes() { applyBoxM(moCrusher); applyBoxM(moMonk); - applyBoxBool(gp::on); + bool v2 = false; + applyBoxBool(v2); if(loading && v2) variation = eVariation::goldberg; applyBox(gp::param.first); applyBox(gp::param.second); - applyBoxBool(irr::on); + v2 = false; applyBoxBool(v2); if(loading && v2) variation = eVariation::irregular; applyBox(irr::cellcount); list_invorb(); @@ -719,13 +723,14 @@ void loadBoxHigh() { dynamicval sp2(geometry, (eGeometry) savebox[116]); dynamicval sp3(shmup::on, savebox[119]); dynamicval sp4(chaosmode, savebox[196]); - dynamicval sp5(nonbitrunc, savebox[186]); - dynamicval sp6(gp::on, savebox[341]); + dynamicval sp5(variation, (eVariation) savebox[186]); dynamicval sp7(gp::param.first, savebox[342]); dynamicval sp8(gp::param.second, savebox[343]); if(savebox[238]) geometry = gSphere; if(savebox[239]) geometry = gElliptic; + if(savebox[341]) variation = eVariation::goldberg; + if(savebox[344]) variation = eVariation::irregular; if(multi::players < 1 || multi::players > MAXPLAYER) multi::players = 1; @@ -857,8 +862,8 @@ void saveStats(bool emergency = false) { fprintf(f, "Total enemies killed: %d\n", tkills()); fprintf(f, "cells generated: %d\n", cellcount); if(pureHardcore()) fprintf(f, "Pure hardcore mode\n"); - if(nonbitrunc) fprintf(f, "Heptagons only mode\n"); if(geometry) fprintf(f, "Geometry: %s\n", ginf[geometry].name); + if(CHANGED_VARIATION) fprintf(f, "Variation: %s\n", gp::operation_name().c_str()); if(chaosmode) fprintf(f, "Chaos mode\n"); if(shmup::on) fprintf(f, "Shoot-em up mode\n"); if(inv::on) fprintf(f, "Inventory mode\n"); @@ -1028,8 +1033,8 @@ namespace gamestack { heptspin viewctr; transmatrix View; eGeometry geometry; + eVariation variation; bool shmup; - bool hepta; }; vector gd; @@ -1048,7 +1053,7 @@ namespace gamestack { gdn.View = View; gdn.geometry = geometry; gdn.shmup = shmup::on; - gdn.hepta = nonbitrunc; + gdn.variation = variation; gdn.ctover = centerover; gd.push_back(gdn); } @@ -1060,7 +1065,7 @@ namespace gamestack { viewctr = gdn.viewctr; View = gdn.View; geometry = gdn.geometry; - nonbitrunc = gdn.hepta; + variation = gdn.variation; if(shmup::on) shmup::clearMonsters(); shmup::on = gdn.shmup; resetGeometry(); @@ -1127,6 +1132,37 @@ void push_game() { game_active = false; } +void set_geometry(eGeometry target) { + if(geometry != target) { + stop_game(); + ors::reset(); + geometry = target; + + if(chaosmode && (euclid || sphere || quotient)) chaosmode = false; + if(euclid6) variation = eVariation::bitruncated; + if(IRREGULAR) variation = eVariation::bitruncated; + if(GOLDBERG && gp::param == gp::loc(1,1) && S3 == 3) { + variation = eVariation::bitruncated; + } + if(GOLDBERG && nonorientable) { + if(gp::param.second && gp::param.second != gp::param.first) + gp::param.second = 0; + } + if(geometry == gBinaryTiling) variation = eVariation::pure; + + need_reset_geometry = true; + } + } + +void set_variation(eVariation target) { + if(variation != target) { + stop_game(); + if(euclid6 || binarytiling) geometry = gNormal; + variation = target; + need_reset_geometry = true; + } + } + void switch_game_mode(char switchWhat) { DEBB(DF_INIT, (debugfile,"switch_game_mode\n")); switch(switchWhat) { @@ -1156,7 +1192,8 @@ void switch_game_mode(char switchWhat) { case rg::tour: geometry = gNormal; yendor::on = tactic::on = princess::challenge = peace::on = inv::on = false; - chaosmode = nonbitrunc = randomPatternsMode = irr::on = gp::on = false; + chaosmode = randomPatternsMode = false; + variation = eVariation::bitruncated; gp::param = gp::loc(1, 1); shmup::on = false; need_reset_geometry = true; @@ -1164,33 +1201,6 @@ void switch_game_mode(char switchWhat) { break; #endif - case rg::bitrunc: - case rg::gp: - if(euclid6 || binarytiling) geometry = gNormal; - nonbitrunc = !nonbitrunc; irr::on = false; - gp::on = (switchWhat == rg::gp && !gp::on); - need_reset_geometry = true; - break; - - case rg::geometry: - ors::reset(); - if(geometry == targetgeometry) geometry = gNormal; - else geometry = targetgeometry; - if(chaosmode && (euclid || sphere || quotient)) chaosmode = false; - if(nonbitrunc && euclid6) nonbitrunc = false; - if(irr::on) irr::on = false; - if(gp::on && gp::param == gp::loc(1,1) && S3 == 3) { - gp::on = false; nonbitrunc = false; - } - if(gp::on && nonorientable) { - if(gp::param.second && gp::param.second != gp::param.first) - gp::param.second = 0; - } - if(geometry == gBinaryTiling) nonbitrunc = true, gp::on = irr::on = false; - - need_reset_geometry = true; - break; - case rg::yendor: yendor::on = !yendor::on; tactic::on = false; diff --git a/textures.cpp b/textures.cpp index 174bffd6..74b4b45f 100644 --- a/textures.cpp +++ b/textures.cpp @@ -389,7 +389,7 @@ void texture_config::mark_triangles() { } } -static const auto current_texture_parameters = tie(geometry, nonbitrunc, patterns::whichPattern, patterns::subpattern_flags, pmodel, vid.scale, vid.alpha); +static const auto current_texture_parameters = tie(geometry, variation, patterns::whichPattern, patterns::subpattern_flags, pmodel, vid.scale, vid.alpha); void texture_config::clear_texture_map() { texture_map.clear(); @@ -773,7 +773,8 @@ patterns::patterninfo si_save; saverlist texturesavers; -bool target_nonbitru; +eVariation targetvariation; +eGeometry targetgeometry; string csymbol; @@ -794,7 +795,7 @@ void init_textureconfig() { addsaver(vid.yposition, "Y position", 0); addsaver(vid.xposition, "X position", 0); addsaver(vid.camera_angle, "camera angle", 0); - addsaverenum(target_nonbitru, "bitruncated", false); + addsaverenum(targetvariation, "bitruncated", eVariation::bitruncated); // ... geometry parameters addsaverenum(patterns::whichPattern, "pattern", patterns::PAT_TYPES); @@ -843,7 +844,7 @@ bool texture_config::save() { } targetgeometry = geometry; - target_nonbitru = nonbitrunc; + targetvariation = variation; cell *ctr = euclid ? centerover.at : viewctr.at->c7; si_save = patterns::getpatterninfo0(ctr); @@ -887,13 +888,13 @@ bool texture_config::load() { return false; } } - stop_game_and_switch_mode(rg::geometry); + set_geometry(targetgeometry); start_game(); return config.load(); } - if(nonbitrunc != target_nonbitru) { - stop_game_and_switch_mode(rg::bitrunc); + if(variation != targetvariation) { + set_variation(targetvariation); start_game(); return config.load(); } @@ -1472,7 +1473,7 @@ void texture_config::true_remap() { auto& mi2 = texture_map[si.id]; mi2 = mi; - if(gp::on || irr::on) pshift += si.dir; + if(GOLDBERG || IRREGULAR) pshift += si.dir; mapTexture(c, mi2, si, ggmatrix(c), pshift); mapTexture2(mi2); mi2.tvertices = move(new_tvertices); diff --git a/tour.cpp b/tour.cpp index 7da5978e..1f17c6c0 100644 --- a/tour.cpp +++ b/tour.cpp @@ -150,19 +150,28 @@ bool handleKeyTour(int sym, int uni) { } } - if(geometry || nonbitrunc) { + if(geometry || CHANGED_VARIATION) { return_geometry(); return true; } presentation(pmGeometry); - if(sym == '1') targetgeometry = gSphere, vid.alpha = 1, vid.scale = .5; - if(sym == '2') targetgeometry = gEuclid, vid.alpha = 1, vid.scale = .5; - firstland = specialland = cwt.at->land; push_game(); - switch_game_mode(sym == '3' ? rg::bitrunc : rg::geometry); + switch(sym) { + case '3': + set_variation(eVariation::pure); + break; + case '1': + set_geometry(gSphere); + vid.alpha = 1, vid.scale = .5; + break; + case '2': + set_geometry(gEuclid); + vid.alpha = 1, vid.scale = .5; + break; + } start_game(); presentation(pmGeometryStart); string x; @@ -284,7 +293,7 @@ namespace ss { dialog::display(); keyhandler = [] (int sym, int uni) { if(uni >= 'a' && uni < 'a' + sssize) { - if(geometry || nonbitrunc) { + if(geometry || CHANGED_VARIATION) { pop_game(); presentation(pmGeometryReset); } diff --git a/yendor.cpp b/yendor.cpp index be66e16c..822e919f 100644 --- a/yendor.cpp +++ b/yendor.cpp @@ -864,7 +864,7 @@ int modecode() { else if(pureHardcore()) xcode ++; if(euclid) xcode += 6; - else if(nonbitrunc) xcode += 3; + else if(!BITRUNCATED) xcode += 3; if(sphere) { xcode += 9; @@ -894,14 +894,14 @@ int modecode() { // randompattern never records its scores // no specifics of the advanced configuration of torus/fieldquotient currently recorded - if(gp::on) { + if(GOLDBERG) { mct += (1 << 19); auto loc = gp::human_representation(gp::param); mct += loc.first << 21; // 4 bits mct += loc.second << 25; // 4 bits } - if(irr::on) { + if(IRREGULAR) { mct += (1 << 20); mct += irr::density_code() << 21; // 8 bits }