2018-02-08 23:40:26 +00:00
|
|
|
// Hyperbolic Rogue -- the 'experiments with geometry' menu
|
|
|
|
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
|
|
|
|
|
2017-11-06 20:18:40 +00:00
|
|
|
// -- geometry menu --
|
|
|
|
|
2018-06-10 23:58:31 +00:00
|
|
|
namespace hr {
|
|
|
|
|
2017-11-06 20:18:40 +00:00
|
|
|
int eupage = 0;
|
|
|
|
int euperpage = 21;
|
|
|
|
|
|
|
|
string euchelp =
|
|
|
|
"If you want to know how much the gameplay is affected by the "
|
|
|
|
"hyperbolic geometry in HyperRogue, this mode is for you!\n\n"
|
|
|
|
|
|
|
|
"You can try many different geometries here. We start by gluing "
|
|
|
|
"n-gons in such a way that k of them meet in every vertex. "
|
|
|
|
"Depending on n and k, this either folds into a sphere, unfolds into a plane, "
|
2018-01-06 21:34:03 +00:00
|
|
|
"or requires a hyperbolic space. The result may be then 'bitrunc' by "
|
2017-11-06 20:18:40 +00:00
|
|
|
"replacing each vertex by a 2k-gon. Furthermore, you can play "
|
|
|
|
"with quotient geometries. For example, the elliptic geometry is "
|
|
|
|
"obtained from the sphere by making the antipodes be the same point, "
|
|
|
|
"so you return to the same spot (but as a mirror image) after going there. "
|
|
|
|
"Have fun experimenting! "
|
|
|
|
"Achievements and leaderboards do not work in geometry experiments, "
|
|
|
|
"except some specific ones.\n\n"
|
2018-01-06 21:34:03 +00:00
|
|
|
"In standard geometry (bitrunc or not), you can play the full game, but in other geometries "
|
2017-11-06 20:18:40 +00:00
|
|
|
"you select a particular land. Lands are unlocked by visiting them in this "
|
|
|
|
"session, or permanently by collecting 25 treasure. Try Crossroads in Euclidean "
|
|
|
|
"or chaos mode in non-standard non-quotient hyperbolic to visit many lands. "
|
|
|
|
"Highlights:\n"
|
|
|
|
"* Crystal World and Warped Coast can be understood as extra geometries.\n"
|
|
|
|
"* Halloween is specially designed for spherical geometry.\n"
|
|
|
|
"* To see the difference, try Hunting Grounds in Euclidean -- it is impossible.\n";
|
|
|
|
|
|
|
|
int ewhichscreen = 2;
|
|
|
|
|
2017-11-06 23:40:46 +00:00
|
|
|
void showQuotientConfig() {
|
2017-11-07 13:39:26 +00:00
|
|
|
using namespace fieldpattern;
|
2017-11-06 23:40:46 +00:00
|
|
|
gamescreen(2);
|
|
|
|
dialog::init(XLAT("advanced configuration"));
|
|
|
|
fgeomextra& gxcur = fgeomextras[current_extra];
|
2018-06-22 12:47:24 +00:00
|
|
|
for(int i=0; i<isize(fgeomextras); i++) {
|
2017-11-06 23:40:46 +00:00
|
|
|
auto& g = fgeomextras[i];
|
|
|
|
dialog::addBoolItem(XLAT(ginf[g.base].name), g.base == gxcur.base, 'a'+i);
|
|
|
|
}
|
|
|
|
nextPrimes(gxcur);
|
2018-06-22 12:47:24 +00:00
|
|
|
for(int i=0; i<isize(gxcur.primes); i++) {
|
2017-11-06 23:40:46 +00:00
|
|
|
auto& p = gxcur.primes[i];
|
2018-01-08 22:23:00 +00:00
|
|
|
dialog::addBoolItem(XLAT("order %1%2 (non-bitruncated cells: %3)", its(p.p), p.squared ? "²" : "", its(p.cells)), i == gxcur.current_prime_id, 'A'+i);
|
2017-11-06 23:40:46 +00:00
|
|
|
}
|
|
|
|
|
2018-06-22 12:47:24 +00:00
|
|
|
if(isize(gxcur.primes) < 6) {
|
2017-11-06 23:40:46 +00:00
|
|
|
dialog::addBreak(100);
|
|
|
|
dialog::addHelp(
|
|
|
|
"This geometry is obtained by applying the same 'generators' which "
|
|
|
|
"lead to creating the given basic hyperbolic geometry, "
|
|
|
|
"but using a fixed finite field instead of the field of reals. "
|
|
|
|
"It can be also interpreted as a quotient of the given basic geometry. "
|
|
|
|
"Warning: field patterns based on large primes might generate for a long time."
|
|
|
|
);
|
|
|
|
dialog::addBreak(100);
|
|
|
|
}
|
|
|
|
|
|
|
|
dialog::addItem("find the next prime", 'p');
|
|
|
|
dialog::addItem("activate", 'x');
|
|
|
|
dialog::addItem("default", 'c');
|
|
|
|
|
|
|
|
keyhandler = [&gxcur] (int sym, int uni) {
|
2018-06-22 12:47:24 +00:00
|
|
|
if(uni >= 'a' && uni < 'a' + isize(fgeomextras))
|
2017-11-06 23:40:46 +00:00
|
|
|
current_extra = uni - 'a';
|
2018-06-22 12:47:24 +00:00
|
|
|
else if(uni >= 'A' && uni < 'A' + isize(gxcur.primes))
|
2017-11-06 23:40:46 +00:00
|
|
|
gxcur.current_prime_id = uni - 'A';
|
|
|
|
else if(uni == 'p')
|
|
|
|
nextPrime(gxcur);
|
|
|
|
else if(uni == 'x' || uni == '\n') {
|
2018-08-28 15:17:34 +00:00
|
|
|
set_geometry(gxcur.base);
|
2017-11-06 23:40:46 +00:00
|
|
|
enableFieldChange();
|
2018-08-28 15:17:34 +00:00
|
|
|
set_geometry(gFieldQuotient);
|
2018-06-10 22:58:38 +00:00
|
|
|
start_game();
|
2017-11-06 23:40:46 +00:00
|
|
|
}
|
|
|
|
else if(uni == 'c') {
|
2018-08-28 15:17:34 +00:00
|
|
|
set_geometry(gEuclid);
|
2017-11-06 23:40:46 +00:00
|
|
|
fieldpattern::quotient_field_changed = false;
|
2018-08-28 15:17:34 +00:00
|
|
|
set_geometry(gFieldQuotient);
|
2018-06-10 22:58:38 +00:00
|
|
|
start_game();
|
2017-11-06 23:40:46 +00:00
|
|
|
}
|
|
|
|
else if(doexiton(sym, uni))
|
|
|
|
popScreen();
|
|
|
|
};
|
|
|
|
|
|
|
|
dialog::display();
|
|
|
|
}
|
2017-11-06 20:18:40 +00:00
|
|
|
|
2018-01-06 21:34:03 +00:00
|
|
|
bool torus_bitrunc;
|
2017-12-28 15:46:10 +00:00
|
|
|
|
2017-11-06 20:18:40 +00:00
|
|
|
void showTorusConfig() {
|
|
|
|
cmode = sm::SIDE | sm::TORUSCONFIG;
|
|
|
|
gamescreen(2);
|
|
|
|
|
2017-11-06 23:40:46 +00:00
|
|
|
dialog::init(XLAT("advanced configuration"));
|
2017-11-06 20:18:40 +00:00
|
|
|
|
2017-12-28 15:46:10 +00:00
|
|
|
auto& mode = torusconfig::tmodes[torusconfig::newmode];
|
|
|
|
|
|
|
|
dialog::addSelItem(XLAT("mode"), XLAT(mode.name), 'm');
|
|
|
|
|
|
|
|
bool single = (mode.flags & torusconfig::TF_SINGLE);
|
|
|
|
bool square = (mode.flags & torusconfig::TF_SQUARE);
|
|
|
|
bool simple = (mode.flags & torusconfig::TF_SIMPLE);
|
|
|
|
|
|
|
|
if(single) {
|
|
|
|
dialog::addSelItem(XLAT("number of cells (n)"), its(torusconfig::newqty), 'n');
|
2018-07-09 19:04:23 +00:00
|
|
|
if(mode.flags & torusconfig::TF_HEX)
|
2017-12-28 15:46:10 +00:00
|
|
|
dialog::addSelItem(XLAT("cell bottom-right from 0 (d)"), its(torusconfig::newdy), 'd');
|
|
|
|
else
|
|
|
|
dialog::addSelItem(XLAT("cell below 0 (d)"), its(torusconfig::newdy), 'd');
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if(torusconfig::newsdx < 1) torusconfig::newsdx = 1;
|
|
|
|
if(torusconfig::newsdy < 1) torusconfig::newsdy = 1;
|
|
|
|
dialog::addSelItem(XLAT("width (x)"), its(torusconfig::newsdx), 'x');
|
|
|
|
dialog::addSelItem(XLAT("height (y)"), its(torusconfig::newsdy), 'y');
|
|
|
|
}
|
|
|
|
|
2018-01-06 21:34:03 +00:00
|
|
|
if(square) dialog::addBoolItem(XLAT("bitruncated"), !torus_bitrunc, 't');
|
2017-12-28 15:46:10 +00:00
|
|
|
else dialog::addInfo("", 100);
|
2017-11-06 20:18:40 +00:00
|
|
|
|
2017-12-28 15:46:10 +00:00
|
|
|
int valid = 2;
|
2017-11-06 20:18:40 +00:00
|
|
|
|
2017-12-28 15:46:10 +00:00
|
|
|
if(single) {
|
|
|
|
if(square) {
|
|
|
|
dialog::addInfo("this mode has bad patterns", 0x808080), valid = 1;
|
2018-01-06 21:34:03 +00:00
|
|
|
if(!torus_bitrunc && valid == 1)
|
|
|
|
dialog::addInfo("incompatible with bitruncating", 0x808080), valid = 0;
|
2017-12-28 15:46:10 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
if(torusconfig::newqty % 3)
|
|
|
|
dialog::addInfo(XLAT("best if %1 is divisible by %2", "n", "3"), 0x808080), valid = 1;
|
|
|
|
if((torusconfig::newdy + 999999) % 3 != 2)
|
|
|
|
dialog::addInfo(XLAT("best if %1 is divisible by %2", "d+1", "3"), 0x808080), valid = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if(square) {
|
|
|
|
if(torusconfig::newsdx & 1)
|
|
|
|
dialog::addInfo(XLAT("best if %1 is divisible by %2", "x", "2"), 0x808080), valid = 1;
|
|
|
|
if(torusconfig::newsdy & 1)
|
|
|
|
dialog::addInfo(XLAT("best if %1 is divisible by %2", "y", "2"), 0x808080), valid = 1;
|
2018-01-06 21:34:03 +00:00
|
|
|
if(!torus_bitrunc && valid == 1)
|
|
|
|
dialog::addInfo("incompatible with bitruncating", 0x808080), valid = 0;
|
2017-12-28 15:46:10 +00:00
|
|
|
}
|
|
|
|
else if(simple) {
|
|
|
|
if(torusconfig::newsdx & 1)
|
|
|
|
dialog::addInfo(XLAT("best if %1 is divisible by %2", "x", "3"), 0x808080), valid = 1;
|
|
|
|
if(torusconfig::newsdy & 1)
|
|
|
|
dialog::addInfo(XLAT("best if %1 is divisible by %2", "y", "3"), 0x808080), valid = 1;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if(torusconfig::newsdx & 1)
|
|
|
|
dialog::addInfo(XLAT("best if %1 is divisible by %2", "x", "3"), 0x808080), valid = 1;
|
|
|
|
if(torusconfig::newsdy & 1)
|
|
|
|
dialog::addInfo(XLAT("best if %1 is divisible by %2", "y", "2"), 0x808080), valid = 0;
|
|
|
|
}
|
|
|
|
}
|
2017-11-06 20:18:40 +00:00
|
|
|
|
|
|
|
dialog::addSelItem(XLAT("scale factor"), fts(vid.scale), 'z');
|
|
|
|
|
|
|
|
#if CAP_RUG
|
|
|
|
dialog::addBoolItem(XLAT("hypersian rug mode"), (rug::rugged), 'u');
|
|
|
|
#endif
|
|
|
|
|
|
|
|
dialog::addItem("activate", 'a');
|
|
|
|
dialog::addItem("default", 'c');
|
|
|
|
|
2017-12-28 15:46:10 +00:00
|
|
|
keyhandler = [=] (int sym, int uni) {
|
|
|
|
if(uni == 'm') {
|
|
|
|
int i = torusconfig::newmode + 1;
|
2018-06-22 12:47:24 +00:00
|
|
|
if(i >= isize(torusconfig::tmodes)) i = 0;
|
2017-12-28 15:46:10 +00:00
|
|
|
torusconfig::newmode = torusconfig::eTorusMode(i);
|
|
|
|
}
|
|
|
|
else if(uni == 'n' && single)
|
2017-11-06 20:18:40 +00:00
|
|
|
dialog::editNumber(torusconfig::newqty, 0, 1000, 3, torusconfig::def_qty, XLAT("number of cells (n)"), "");
|
2017-12-28 15:46:10 +00:00
|
|
|
else if(uni == 'd' && single)
|
|
|
|
dialog::editNumber(torusconfig::newdy, -1000, 1000, 3, -torusconfig::def_dy, XLAT("cell below 0 (d)"), "");
|
|
|
|
else if(uni == 'x' && !single)
|
|
|
|
dialog::editNumber(torusconfig::newsdx, 0, 1000, square ? 2 : 3, 12, XLAT("width (x)"), "");
|
|
|
|
else if(uni == 'y' && !single)
|
|
|
|
dialog::editNumber(torusconfig::newsdy, 0, 1000, square ? 2 : simple ? 3 : 2, 12, XLAT("height (y)"), "");
|
|
|
|
else if(uni == 't')
|
2018-01-06 21:34:03 +00:00
|
|
|
torus_bitrunc = !torus_bitrunc;
|
2017-12-28 15:46:10 +00:00
|
|
|
else if((uni == 'a' || uni == '\n') && torusconfig::newqty >= 3 && valid) {
|
2018-08-28 15:17:34 +00:00
|
|
|
set_geometry(gNormal);
|
2017-12-28 15:46:10 +00:00
|
|
|
torusconfig::torus_mode = torusconfig::newmode;
|
2017-11-06 20:18:40 +00:00
|
|
|
torusconfig::qty = torusconfig::newqty;
|
|
|
|
torusconfig::dy = torusconfig::newdy;
|
2017-12-28 15:46:10 +00:00
|
|
|
torusconfig::sdx = torusconfig::newsdx;
|
|
|
|
torusconfig::sdy = torusconfig::newsdy;
|
|
|
|
torusconfig::activate();
|
2018-08-28 15:17:34 +00:00
|
|
|
set_geometry(gTorus);
|
|
|
|
set_variation((torus_bitrunc || !square) ? eVariation::bitruncated : eVariation::pure);
|
2018-06-10 22:58:38 +00:00
|
|
|
start_game();
|
2017-11-06 20:18:40 +00:00
|
|
|
}
|
|
|
|
else if(uni == 'c') {
|
2018-08-28 15:17:34 +00:00
|
|
|
set_geometry(gEuclid);
|
2017-12-28 15:46:10 +00:00
|
|
|
torusconfig::torus_mode = torusconfig::tmSingle;
|
2017-11-06 20:18:40 +00:00
|
|
|
torusconfig::qty = torusconfig::def_qty;
|
|
|
|
torusconfig::dy = torusconfig::def_dy;
|
2018-08-28 15:17:34 +00:00
|
|
|
set_geometry(gTorus);
|
2018-06-10 22:58:38 +00:00
|
|
|
start_game();
|
2017-11-06 20:18:40 +00:00
|
|
|
}
|
|
|
|
else if(uni == 'z') editScale();
|
2017-11-07 12:09:46 +00:00
|
|
|
#if CAP_RUG
|
2017-11-06 20:18:40 +00:00
|
|
|
else if(uni == 'u') rug::select();
|
2017-11-07 12:09:46 +00:00
|
|
|
#endif
|
2017-11-06 20:18:40 +00:00
|
|
|
else if(doexiton(sym, uni))
|
|
|
|
popScreen();
|
|
|
|
};
|
|
|
|
|
|
|
|
dialog::display();
|
|
|
|
}
|
|
|
|
|
2018-08-28 15:17:34 +00:00
|
|
|
string bitruncnames[5] = {" (b)", " (n)", " (g)", " (i)", " (d)"};
|
2017-12-19 13:35:34 +00:00
|
|
|
|
2018-06-17 17:04:17 +00:00
|
|
|
void validity_info() {
|
|
|
|
int vccolors[4] = {0xFF0000, 0xFF8000, 0xFFFF00, 0x00FF00};
|
|
|
|
auto lv = land_validity(specialland);
|
|
|
|
if(lv.flags & lv::display_error_message)
|
|
|
|
dialog::addInfo(XLAT(lv.msg), vccolors[lv.quality_level]);
|
|
|
|
else
|
|
|
|
dialog::addBreak(100);
|
|
|
|
}
|
|
|
|
|
2018-06-21 23:48:46 +00:00
|
|
|
bool showquotients;
|
|
|
|
|
2017-11-06 20:18:40 +00:00
|
|
|
void showEuclideanMenu() {
|
|
|
|
cmode = sm::SIDE;
|
|
|
|
gamescreen(0);
|
|
|
|
if(cheater) for(int i=0; i<landtypes; i++) landvisited[i] = true;
|
|
|
|
for(int i=0; i<landtypes; i++)
|
|
|
|
if(hiitemsMax(treasureType(eLand(i))) >= 25) landvisited[i] = true;
|
|
|
|
landvisited[laCrossroads] = true;
|
2018-01-08 22:11:29 +00:00
|
|
|
landvisited[laCrossroads4] = true;
|
2017-11-06 20:18:40 +00:00
|
|
|
landvisited[laIce] = true;
|
|
|
|
landvisited[laHunting] = true;
|
|
|
|
landvisited[laMirrorOld] = true;
|
|
|
|
landvisited[laPrincessQuest] = cheater || princess::everSaved;
|
|
|
|
landvisited[laWildWest] = true;
|
|
|
|
landvisited[laHalloween] = true;
|
|
|
|
landvisited[laWarpCoast] = true;
|
|
|
|
landvisited[laGraveyard] = true;
|
|
|
|
landvisited[laDual] = true;
|
2018-01-05 13:19:56 +00:00
|
|
|
landvisited[laDocks] |= landvisited[laWarpCoast];
|
|
|
|
landvisited[laSnakeNest] |= landvisited[laRedRock];
|
2017-11-06 20:18:40 +00:00
|
|
|
landvisited[laCA] = true;
|
|
|
|
// for(int i=2; i<lt; i++) landvisited[i] = true;
|
2018-06-17 17:04:17 +00:00
|
|
|
|
|
|
|
string validclasses[4] = {" (X)", " (½)", "", " (!)"};
|
2017-11-06 20:18:40 +00:00
|
|
|
|
2018-04-15 11:04:02 +00:00
|
|
|
if(ewhichscreen == 2) {
|
2017-11-06 20:18:40 +00:00
|
|
|
dialog::init(XLAT("experiment with geometry"));
|
|
|
|
int ts = ginf[geometry].sides;
|
|
|
|
int tv = ginf[geometry].vertex;
|
|
|
|
int tq = ginf[geometry].quotientstyle;
|
2018-08-28 15:17:34 +00:00
|
|
|
int nom = (BITRUNCATED ? tv+ts : tv) * ((tq & qNONORIENTABLE) ? 2 : 4);
|
2017-11-06 20:18:40 +00:00
|
|
|
int denom = (2*ts + 2*tv - ts * tv);
|
|
|
|
|
2018-08-28 15:17:34 +00:00
|
|
|
if(GOLDBERG) {
|
2018-04-03 21:39:18 +00:00
|
|
|
denom *= 2;
|
2018-04-09 15:40:12 +00:00
|
|
|
nom = nom / tv * (2*tv + ts * (gp::area-1));
|
2018-04-03 21:39:18 +00:00
|
|
|
if(nom % 2 == 0) nom /= 2, denom /= 2;
|
|
|
|
}
|
|
|
|
|
2017-11-06 20:18:40 +00:00
|
|
|
dialog::addSelItem(XLAT("land"), XLAT1(linf[specialland].name), '5');
|
|
|
|
dialog::addBreak(50);
|
|
|
|
|
2018-06-17 17:04:17 +00:00
|
|
|
for(int i=0; i<gGUARD; i++) {
|
2018-06-21 23:48:46 +00:00
|
|
|
bool on = geometry == i;
|
2018-06-17 17:04:17 +00:00
|
|
|
dynamicval<eGeometry> cg(geometry, eGeometry(i));
|
2018-06-21 23:48:46 +00:00
|
|
|
if(!!(quotient || elliptic || torus) != showquotients) continue;
|
|
|
|
dialog::addBoolItem(XLAT(ginf[i].name), on, 'a'+i);
|
2018-06-17 17:04:17 +00:00
|
|
|
dialog::lastItem().value += validclasses[land_validity(specialland).quality_level];
|
|
|
|
}
|
2017-11-06 20:18:40 +00:00
|
|
|
|
2018-06-22 02:49:26 +00:00
|
|
|
dialog::addBreak(50);
|
2018-08-19 20:53:34 +00:00
|
|
|
dialog::addBoolItem(XLAT("show quotient spaces"), showquotients, 'z');
|
2017-11-06 20:18:40 +00:00
|
|
|
dialog::addBreak(50);
|
|
|
|
|
|
|
|
if(ts == 6 && tv == 3)
|
2018-08-09 17:28:53 +00:00
|
|
|
dialog::addSelItem(XLAT("variations"), XLAT("does not matter"), 'v');
|
|
|
|
else if(binarytiling)
|
2018-08-14 08:18:18 +00:00
|
|
|
dialog::addSelItem(XLAT("width"), fts(vid.binary_width), 'v');
|
2018-08-28 15:17:34 +00:00
|
|
|
else
|
|
|
|
dialog::addSelItem(XLAT("variations"), gp::operation_name(), 'v');
|
2017-11-06 20:18:40 +00:00
|
|
|
|
2018-06-17 17:04:17 +00:00
|
|
|
dialog::addBreak(25);
|
|
|
|
validity_info();
|
|
|
|
dialog::addBreak(25);
|
2017-11-06 20:18:40 +00:00
|
|
|
|
2018-06-21 23:48:46 +00:00
|
|
|
int worldsize;
|
|
|
|
|
|
|
|
int gar =
|
2018-08-28 15:17:34 +00:00
|
|
|
GOLDBERG ? gp::area - 1 :
|
|
|
|
PURE ? 0 :
|
2018-06-21 23:48:46 +00:00
|
|
|
2;
|
|
|
|
|
|
|
|
switch(geometry) {
|
|
|
|
case gTorus:
|
|
|
|
worldsize = torusconfig::qty;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case gZebraQuotient:
|
|
|
|
worldsize = 12 + 14 * gar;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case gFieldQuotient:
|
2018-06-22 12:47:24 +00:00
|
|
|
worldsize = isize(currfp.matrices) / ts;
|
2018-06-21 23:48:46 +00:00
|
|
|
worldsize = worldsize * (2*tv + ts * gar) / tv / 2;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case gKleinQuartic:
|
|
|
|
worldsize = 24 + 28 * gar;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case gBolza:
|
2018-06-22 02:49:42 +00:00
|
|
|
worldsize = 3 * (2*tv + ts * gar) / tv;
|
2018-06-21 23:48:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case gBolza2:
|
2018-06-22 02:49:42 +00:00
|
|
|
worldsize = 6 * (2*tv + ts * gar) / tv;
|
2018-06-21 23:48:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
worldsize = denom ? nom/denom : 0;
|
|
|
|
break;
|
2017-11-06 20:18:40 +00:00
|
|
|
}
|
2018-08-29 19:16:45 +00:00
|
|
|
|
|
|
|
string spf = its(ts);
|
|
|
|
if(archimedean) {
|
|
|
|
spf = "";
|
|
|
|
for(int i: arcm::current.faces) {
|
|
|
|
if(spf != "") spf += ",";
|
|
|
|
spf += its(i);
|
|
|
|
}
|
|
|
|
if(BITRUNCATED) spf = "[" + spf + "]," + its(arcm::current.N * 2) + "," + its(arcm::current.N * 2);
|
2018-08-30 00:11:43 +00:00
|
|
|
if(DUAL) spf = its(arcm::current.N) + "^[" + spf + "]";
|
2018-08-29 19:16:45 +00:00
|
|
|
}
|
|
|
|
else if(binarytiling)
|
|
|
|
spf = "6,[6,7],7";
|
|
|
|
else if(BITRUNCATED && !euclid6)
|
|
|
|
spf = spf + "," + its(S6) + "," + its(S6);
|
|
|
|
else if(IRREGULAR && irr::bitruncations_performed)
|
|
|
|
spf = "[4..8],6,6";
|
|
|
|
else if(IRREGULAR)
|
|
|
|
spf = "[4..8]^3";
|
|
|
|
else if(GOLDBERG && S3 == 4 && gp::param == gp::loc(1, 1))
|
|
|
|
spf = spf + ",4," + spf + ",4";
|
|
|
|
else if(GOLDBERG && S3 == 4 && gp::param == gp::loc(2, 0))
|
|
|
|
spf = spf + ",4,4,4";
|
|
|
|
else if(GOLDBERG && S3 == 4)
|
|
|
|
spf = "[" + spf + ",4],4,4,4";
|
|
|
|
else if(GOLDBERG && S3 == 3)
|
|
|
|
spf = "[" + spf + ",6],6,6";
|
|
|
|
else {
|
|
|
|
string spf0 = spf;
|
|
|
|
for(int z=1; z<S3; z++) spf = spf + "," + spf0;
|
|
|
|
}
|
2017-11-06 20:18:40 +00:00
|
|
|
|
2018-08-29 19:16:45 +00:00
|
|
|
dialog::addSelItem(XLAT("faces per vertex"), spf, 0);
|
2017-11-06 20:18:40 +00:00
|
|
|
|
|
|
|
string qstring = "none";
|
|
|
|
if(tq & qZEBRA) qstring = "zebra";
|
|
|
|
|
|
|
|
else if(tq & qFIELD) qstring = "field";
|
|
|
|
|
2018-06-21 23:48:46 +00:00
|
|
|
else if((tq & qNONORIENTABLE) && sphere) qstring = "elliptic";
|
2017-11-06 20:18:40 +00:00
|
|
|
|
|
|
|
else if(tq & qTORUS) qstring = "torus";
|
2018-06-21 23:48:46 +00:00
|
|
|
|
|
|
|
else if(tq & qSMALL) qstring = ginf[geometry].shortname;
|
2017-11-06 20:18:40 +00:00
|
|
|
|
|
|
|
dialog::addSelItem(XLAT("quotient space"), XLAT(qstring), 0);
|
2018-08-21 17:00:29 +00:00
|
|
|
|
2018-08-29 19:16:45 +00:00
|
|
|
if(hyperbolic && IRREGULAR) {
|
|
|
|
nom = isize(irr::cells);
|
|
|
|
// both Klein Quartic and Bolza2 are double the Zebra quotiennt
|
|
|
|
denom = -2;
|
|
|
|
if(!quotient) worldsize = nom / denom;
|
|
|
|
}
|
|
|
|
|
2017-11-06 20:18:40 +00:00
|
|
|
dialog::addSelItem(XLAT("size of the world"),
|
2018-08-29 19:16:45 +00:00
|
|
|
binarytiling ? fts4(8 * M_PI * sqrt(2) * log(2) / vid.binary_width) + " exp(∞)" :
|
2018-08-21 17:00:29 +00:00
|
|
|
archimedean ? arcm::current.world_size() :
|
2018-08-19 21:06:32 +00:00
|
|
|
(archimedean && sphere) ? its(isize(currentmap->allcells())) :
|
2018-08-22 23:52:29 +00:00
|
|
|
worldsize < 0 ? (nom%denom ? its(nom)+"/"+its(-denom) : its(-worldsize)) + " exp(∞)":
|
2017-11-06 20:18:40 +00:00
|
|
|
worldsize == 0 ? "∞" :
|
|
|
|
its(worldsize),
|
|
|
|
'3');
|
|
|
|
|
|
|
|
switch(ginf[geometry].cclass) {
|
|
|
|
case 0:
|
|
|
|
dialog::addSelItem(XLAT("Curvature"), XLAT("hyperbolic"), 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
dialog::addSelItem(XLAT("Curvature"), XLAT("flat"), 0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
dialog::addSelItem(XLAT("Curvature"), XLAT("spherical"), 0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(sphere)
|
|
|
|
dialog::addBoolItem(XLAT("stereographic/orthogonal"), vid.alpha>10, '1');
|
|
|
|
else
|
|
|
|
dialog::addBoolItem(XLAT("Poincaré/Klein"), vid.alpha>.5, '1');
|
2018-06-25 21:14:46 +00:00
|
|
|
if(torus || geometry == gFieldQuotient)
|
2017-11-06 20:18:40 +00:00
|
|
|
dialog::addItem(XLAT("advanced parameters"), '4');
|
2018-06-12 22:00:01 +00:00
|
|
|
dialog::addHelp();
|
|
|
|
dialog::addBack();
|
2017-11-06 20:18:40 +00:00
|
|
|
dialog::display();
|
|
|
|
|
|
|
|
keyhandler = [] (int sym, int uni) {
|
|
|
|
dialog::handleNavigation(sym, uni);
|
|
|
|
if(uni >= 'a' && uni < 'a'+gGUARD) {
|
2018-08-28 15:17:34 +00:00
|
|
|
eGeometry targetgeometry = eGeometry(uni - 'a');
|
2018-08-19 21:06:32 +00:00
|
|
|
if(targetgeometry == gArchimedean)
|
|
|
|
pushScreen(arcm::show);
|
2018-08-19 20:53:34 +00:00
|
|
|
else {
|
2018-08-28 15:17:34 +00:00
|
|
|
set_geometry(targetgeometry);
|
2018-08-19 20:53:34 +00:00
|
|
|
start_game();
|
|
|
|
}
|
2017-11-06 20:18:40 +00:00
|
|
|
}
|
2018-08-19 20:53:34 +00:00
|
|
|
else if(uni == 'z')
|
2018-06-21 23:48:46 +00:00
|
|
|
showquotients = !showquotients;
|
2018-08-09 17:28:53 +00:00
|
|
|
else if(uni == 'v') {
|
2018-08-30 00:11:43 +00:00
|
|
|
if(euclid6) ;
|
|
|
|
else if(archimedean) arcm::next_variation();
|
2018-08-14 08:18:18 +00:00
|
|
|
else if(binarytiling) {
|
|
|
|
dialog::editNumber(vid.binary_width, 0, 2, 0.1, 1, XLAT("binary tiling width"), "");
|
|
|
|
dialog::reaction = [] () {
|
2018-08-21 22:14:31 +00:00
|
|
|
resetGeometry();
|
|
|
|
#if CAP_TEXTURE
|
|
|
|
texture::config.remap();
|
|
|
|
#endif
|
2018-08-14 08:18:18 +00:00
|
|
|
};
|
|
|
|
}
|
2018-08-28 15:17:34 +00:00
|
|
|
else if(euclid4) {
|
|
|
|
set_variation(PURE ? eVariation::bitruncated : eVariation::pure);
|
|
|
|
start_game();
|
|
|
|
}
|
2018-07-10 02:13:35 +00:00
|
|
|
else // if(S3 == 3)
|
2018-04-09 15:40:12 +00:00
|
|
|
gp::configure();
|
2017-11-06 20:18:40 +00:00
|
|
|
}
|
|
|
|
else if(uni == '2' || sym == SDLK_F1) gotoHelp(euchelp);
|
2018-09-21 17:51:13 +00:00
|
|
|
else if(uni == '3' && !viewdists) { enable_viewdists(); popScreenAll(); }
|
|
|
|
else if(uni == '3' && viewdists) { viewdists = false; }
|
2017-11-06 20:18:40 +00:00
|
|
|
else if(uni == '1' && !euclid) {
|
|
|
|
if(sphere) {
|
|
|
|
if(vid.alpha < 10) { vid.alpha = 999; vid.scale = 998; }
|
|
|
|
else {vid.alpha = 1; vid.scale = .4; }
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if(vid.alpha > .5) { vid.alpha = 0; vid.scale = 1; }
|
|
|
|
else {vid.alpha = 1; vid.scale = 1; }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(uni == '5')
|
|
|
|
ewhichscreen ^= 3;
|
|
|
|
else if(uni == '4') {
|
|
|
|
if(torus)
|
|
|
|
torusconfig::newdy = torusconfig::dy,
|
|
|
|
torusconfig::newqty = torusconfig::qty,
|
2017-12-28 15:46:10 +00:00
|
|
|
torusconfig::newsdx = torusconfig::sdx,
|
|
|
|
torusconfig::newsdy = torusconfig::sdy,
|
|
|
|
torusconfig::newmode = torusconfig::torus_mode,
|
2018-08-28 15:17:34 +00:00
|
|
|
torus_bitrunc = PURE,
|
2017-11-06 20:18:40 +00:00
|
|
|
pushScreen(showTorusConfig);
|
2018-08-19 20:53:34 +00:00
|
|
|
else if(geometry == gFieldQuotient)
|
2018-06-25 21:14:46 +00:00
|
|
|
pushScreen(showQuotientConfig);
|
2017-11-06 20:18:40 +00:00
|
|
|
}
|
|
|
|
else if(doexiton(sym, uni))
|
|
|
|
popScreen();
|
|
|
|
};
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
dialog::init(XLAT("experiment with geometry"));
|
|
|
|
|
2018-08-28 15:17:34 +00:00
|
|
|
dialog::addSelItem(XLAT("geometry"), XLAT(ginf[geometry].name) + XLAT(bitruncnames[int(variation)]), '5');
|
2017-11-06 20:18:40 +00:00
|
|
|
dialog::addBreak(50);
|
|
|
|
|
2018-04-13 11:08:41 +00:00
|
|
|
generateLandList([] (eLand l) { return land_validity(l).flags & lv::appears_in_geom_exp; });
|
|
|
|
stable_sort(landlist.begin(), landlist.end(), [] (eLand l1, eLand l2) { return land_validity(l1).quality_level > land_validity(l2).quality_level; });
|
2017-11-06 20:18:40 +00:00
|
|
|
|
|
|
|
for(int i=0; i<euperpage; i++) {
|
2018-06-22 12:47:24 +00:00
|
|
|
if(euperpage * eupage + i >= isize(landlist)) { dialog::addBreak(100); break; }
|
2017-11-06 20:18:40 +00:00
|
|
|
eLand l = landlist[euperpage * eupage + i];
|
|
|
|
char ch;
|
|
|
|
if(i < 26) ch = 'a' + i;
|
|
|
|
else ch = 'A' + (i-26);
|
|
|
|
string s = XLAT1(linf[l].name);
|
|
|
|
|
|
|
|
if(landvisited[l]) {
|
|
|
|
dialog::addBoolItem(s, l == specialland, ch);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
dialog::addSelItem(s, XLAT("(locked)"), ch);
|
|
|
|
}
|
|
|
|
|
|
|
|
dialog::lastItem().color = linf[l].color;
|
2018-04-13 11:08:41 +00:00
|
|
|
dialog::lastItem().value += validclasses[land_validity(l).quality_level];
|
2017-11-06 20:18:40 +00:00
|
|
|
}
|
|
|
|
dialog::addBreak(50);
|
|
|
|
if(chaosUnlocked && !quotient && !euclid && !sphere)
|
|
|
|
dialog::addItem(XLAT("Chaos mode"), '1');
|
|
|
|
dialog::addItem(XLAT("next page"), '-');
|
2018-06-17 17:04:17 +00:00
|
|
|
|
|
|
|
dialog::addBreak(25);
|
|
|
|
validity_info();
|
|
|
|
dialog::addBreak(25);
|
2017-11-06 20:18:40 +00:00
|
|
|
|
2018-06-12 22:00:01 +00:00
|
|
|
dialog::addHelp();
|
|
|
|
dialog::addBack();
|
2017-11-06 20:18:40 +00:00
|
|
|
dialog::display();
|
|
|
|
|
|
|
|
keyhandler = [] (int sym, int uni) {
|
|
|
|
dialog::handleNavigation(sym, uni);
|
|
|
|
int lid;
|
|
|
|
if(uni >= 'a' && uni <= 'z') lid = uni - 'a';
|
|
|
|
else if(uni >= 'A' && uni <= 'Z') lid = 26 + uni - 'A';
|
|
|
|
else lid = -1;
|
|
|
|
|
|
|
|
if(lid >= 0) lid += euperpage * eupage;
|
|
|
|
|
|
|
|
if(uni == '5')
|
|
|
|
ewhichscreen ^= 3;
|
|
|
|
else if(uni == '-' || uni == PSEUDOKEY_WHEELUP || uni == PSEUDOKEY_WHEELDOWN) {
|
|
|
|
eupage++;
|
2018-06-22 12:47:24 +00:00
|
|
|
if(eupage * euperpage >= isize(landlist)) eupage = 0;
|
2017-11-06 20:18:40 +00:00
|
|
|
}
|
|
|
|
else if(uni == '1') {
|
|
|
|
if(chaosUnlocked) {
|
2018-06-10 22:58:38 +00:00
|
|
|
stop_game_and_switch_mode(rg::chaos);
|
|
|
|
start_game();
|
2017-11-06 20:18:40 +00:00
|
|
|
}
|
|
|
|
}
|
2018-06-22 12:47:24 +00:00
|
|
|
else if(lid >= 0 && lid < isize(landlist)) {
|
2017-11-06 20:18:40 +00:00
|
|
|
eLand nland = landlist[lid];
|
|
|
|
if(landvisited[nland]) {
|
2018-06-10 22:58:38 +00:00
|
|
|
stop_game_and_switch_mode(tactic::on ? rg::tactic : rg::nothing);
|
2018-08-20 13:49:17 +00:00
|
|
|
firstland = specialland = nland;
|
2018-06-10 22:58:38 +00:00
|
|
|
start_game();
|
2017-11-06 20:18:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(uni == '2' || sym == SDLK_F1) gotoHelp(euchelp);
|
|
|
|
else if(doexiton(sym, uni)) popScreen();
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void runGeometryExperiments() {
|
2018-01-08 22:11:29 +00:00
|
|
|
if(!geometry)
|
2018-08-17 22:46:45 +00:00
|
|
|
specialland = getLandForList(cwt.at);
|
2017-11-06 20:18:40 +00:00
|
|
|
pushScreen(showEuclideanMenu);
|
|
|
|
}
|
|
|
|
|
2018-07-19 21:46:58 +00:00
|
|
|
#if CAP_COMMANDLINE
|
|
|
|
int read_geom_args() {
|
|
|
|
using namespace arg;
|
|
|
|
if(argis("-qpar")) {
|
|
|
|
int p;
|
|
|
|
shift(); sscanf(argcs(), "%d,%d,%d",
|
|
|
|
&p, "ientspace::rvadd, "ientspace::rvdir
|
|
|
|
);
|
|
|
|
autocheat = true;
|
|
|
|
currfp.init(p);
|
|
|
|
}
|
|
|
|
else if(argis("-qpar2")) {
|
|
|
|
stop_game_and_switch_mode(rg::nothing);
|
|
|
|
int a, b;
|
|
|
|
shift(); sscanf(argcs(), "%d,%d", &a, &b);
|
|
|
|
using namespace fieldpattern;
|
|
|
|
current_extra = a;
|
|
|
|
|
|
|
|
auto& gxcur = fgeomextras[current_extra];
|
|
|
|
while(b >= isize(gxcur.primes)) nextPrime(gxcur);
|
|
|
|
|
|
|
|
fgeomextras[current_extra].current_prime_id = b;
|
|
|
|
enableFieldChange();
|
2018-08-28 15:17:34 +00:00
|
|
|
set_geometry(gFieldQuotient);
|
2018-07-19 21:46:58 +00:00
|
|
|
}
|
|
|
|
else if(argis("-cs")) {
|
|
|
|
shift(); cheat();
|
|
|
|
fieldpattern::matrix M = currfp.strtomatrix(args());
|
|
|
|
fieldpattern::subpathid = currfp.matcode[M];
|
|
|
|
fieldpattern::subpathorder = currfp.order(M);
|
|
|
|
}
|
|
|
|
else if(argis("-csp")) {
|
|
|
|
cheat();
|
|
|
|
currfp.findsubpath();
|
|
|
|
}
|
|
|
|
else if(argis("-tpar")) {
|
|
|
|
torusconfig::torus_mode = torusconfig::tmSingle;
|
|
|
|
shift(); sscanf(argcs(), "%d,%d,%d",
|
|
|
|
&torusconfig::qty,
|
|
|
|
&torusconfig::dx,
|
|
|
|
&torusconfig::dy
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else if(argis("-tparx")) {
|
|
|
|
shift();
|
|
|
|
sscanf(argcs(), "%d,%d,%d",
|
|
|
|
(int*) &torusconfig::torus_mode,
|
|
|
|
&torusconfig::sdx,
|
|
|
|
&torusconfig::sdy
|
|
|
|
);
|
|
|
|
if(torusconfig::torus_mode == torusconfig::tmSingle)
|
|
|
|
torusconfig::qty = torusconfig::sdx,
|
|
|
|
torusconfig::dy = torusconfig::sdy;
|
|
|
|
torusconfig::activate();
|
|
|
|
}
|
2018-08-28 15:17:34 +00:00
|
|
|
TOGGLE('7', PURE, set_variation(PURE ? eVariation::bitruncated : eVariation::pure))
|
2018-07-19 21:46:58 +00:00
|
|
|
else if(argis("-geo")) {
|
2018-08-17 11:29:00 +00:00
|
|
|
PHASEFROM(2);
|
2018-08-28 15:17:34 +00:00
|
|
|
shift();
|
|
|
|
set_geometry((eGeometry) argi());
|
2018-07-19 21:46:58 +00:00
|
|
|
}
|
|
|
|
else if(argis("-gp")) {
|
|
|
|
PHASEFROM(2);
|
|
|
|
shift(); gp::param.first = argi();
|
|
|
|
shift(); gp::param.second = argi();
|
2018-08-28 15:17:34 +00:00
|
|
|
set_variation(eVariation::goldberg);
|
2018-07-19 21:46:58 +00:00
|
|
|
}
|
|
|
|
else if(argis("-fi")) {
|
|
|
|
fieldpattern::info();
|
|
|
|
exit(0);
|
|
|
|
}
|
2018-07-19 22:04:23 +00:00
|
|
|
else if(argis("-qs")) {
|
|
|
|
cheat();
|
|
|
|
shift(); currfp.qpaths.push_back(args());
|
|
|
|
}
|
2018-07-19 21:46:58 +00:00
|
|
|
else return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto ah_geom = addHook(hooks_args, 0, read_geom_args);
|
|
|
|
#endif
|
|
|
|
|
2018-06-10 23:58:31 +00:00
|
|
|
}
|