mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-27 14:37:16 +00:00
fixed worldsize display and gp::area for S3==4
This commit is contained in:
parent
6c25d2297e
commit
bd479d3c41
@ -787,10 +787,7 @@ eLand switchable(eLand nearland, eLand farland, int c) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
eLand getEuclidLand(int c) {
|
eLand getEuclidLand(int c) {
|
||||||
if(nonorientable) {
|
if(nonorientable && c < 0) c = -c;
|
||||||
c = -c;
|
|
||||||
if(c < 5) return laCrossroads;
|
|
||||||
}
|
|
||||||
auto& la = get_euland(c);
|
auto& la = get_euland(c);
|
||||||
if(la) return la;
|
if(la) return la;
|
||||||
if(get_euland(c-2) && !get_euland(c-1)) getEuclidLand(c-1);
|
if(get_euland(c-2) && !get_euland(c-1)) getEuclidLand(c-1);
|
||||||
|
108
geom-exp.cpp
108
geom-exp.cpp
@ -204,6 +204,14 @@ void showTorusConfig() {
|
|||||||
dialog::addInfo(XLAT("best if %1 is divisible by %2", "y", "2"), 0x808080), valid = 0;
|
dialog::addInfo(XLAT("best if %1 is divisible by %2", "y", "2"), 0x808080), valid = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(cyl) {
|
||||||
|
if(!(square && klein)) {
|
||||||
|
dialog::addBoolItem(XLAT("set y=-2x for Crossroads"), ady == -2 * adx, 'C');
|
||||||
|
dialog::add_action([] () { torusconfig::newsdy = -2 * torusconfig::newsdx; });
|
||||||
|
}
|
||||||
|
dialog::addBoolItem(XLAT("set y=0 for Crossroads IV and Chaos Mode"), ady == 0, 'D');
|
||||||
|
dialog::add_action([] () { torusconfig::newsdy = 0; });
|
||||||
|
}
|
||||||
|
|
||||||
dialog::addSelItem(XLAT("scale factor"), fts(vid.scale), 'z');
|
dialog::addSelItem(XLAT("scale factor"), fts(vid.scale), 'z');
|
||||||
|
|
||||||
@ -215,6 +223,7 @@ void showTorusConfig() {
|
|||||||
dialog::addItem("default", 'c');
|
dialog::addItem("default", 'c');
|
||||||
|
|
||||||
keyhandler = [=] (int sym, int uni) {
|
keyhandler = [=] (int sym, int uni) {
|
||||||
|
dialog::handleNavigation(sym, uni);
|
||||||
if(uni == 'n' && single)
|
if(uni == 'n' && single)
|
||||||
dialog::editNumber(torusconfig::newqty, 0, 1000, 3, torusconfig::def_qty, XLAT("number of cells (n)"), "");
|
dialog::editNumber(torusconfig::newqty, 0, 1000, 3, torusconfig::def_qty, XLAT("number of cells (n)"), "");
|
||||||
else if(uni == 'd' && single)
|
else if(uni == 'd' && single)
|
||||||
@ -298,14 +307,14 @@ void showEuclideanMenu() {
|
|||||||
int ts = ginf[geometry].sides;
|
int ts = ginf[geometry].sides;
|
||||||
int tv = ginf[geometry].vertex;
|
int tv = ginf[geometry].vertex;
|
||||||
int tq = ginf[geometry].quotientstyle;
|
int tq = ginf[geometry].quotientstyle;
|
||||||
int nom = (BITRUNCATED ? tv+ts : tv) * ((tq & qNONORIENTABLE) ? 2 : 4);
|
int nom = (BITRUNCATED ? tv+ts : tv) * 4;
|
||||||
int denom = (2*ts + 2*tv - ts * tv);
|
int denom = (2*ts + 2*tv - ts * tv);
|
||||||
|
|
||||||
if(GOLDBERG) {
|
if(GOLDBERG && S3)
|
||||||
denom *= 2;
|
nom = 2 * (2*tv + ts * (gp::area-1));
|
||||||
nom = nom / tv * (2*tv + ts * (gp::area-1));
|
|
||||||
if(nom % 2 == 0) nom /= 2, denom /= 2;
|
if(GOLDBERG && S3 == 4)
|
||||||
}
|
nom = 2 * (2*tv + 2 * ts * (gp::area-1));
|
||||||
|
|
||||||
dialog::addSelItem(XLAT("land"), XLAT1(linf[specialland].name), '5');
|
dialog::addSelItem(XLAT("land"), XLAT1(linf[specialland].name), '5');
|
||||||
dialog::addBreak(50);
|
dialog::addBreak(50);
|
||||||
@ -348,43 +357,70 @@ void showEuclideanMenu() {
|
|||||||
int gar =
|
int gar =
|
||||||
GOLDBERG ? gp::area - 1 :
|
GOLDBERG ? gp::area - 1 :
|
||||||
PURE ? 0 :
|
PURE ? 0 :
|
||||||
2;
|
2;
|
||||||
|
|
||||||
switch(geometry) {
|
int euler;
|
||||||
case gTorus:
|
if(euclid) euler = 0;
|
||||||
worldsize = torusconfig::qty;
|
else if(sphere && nonorientable) euler = 1;
|
||||||
|
else if(sphere) euler = 2;
|
||||||
|
else if(!bounded) euler = -2;
|
||||||
|
else switch(geometry) {
|
||||||
|
case gFieldQuotient:
|
||||||
|
worldsize = isize(currentmap->allcells());
|
||||||
|
euler = 2 * worldsize * denom / nom;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case gMinimal:
|
||||||
|
euler = -1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case gZebraQuotient:
|
case gZebraQuotient:
|
||||||
worldsize = 12 + 14 * gar;
|
case gBolza:
|
||||||
break;
|
euler = -2;
|
||||||
|
|
||||||
case gFieldQuotient:
|
|
||||||
worldsize = isize(currfp.matrices) / ts;
|
|
||||||
worldsize = worldsize * (2*tv + ts * gar) / tv / 2;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case gKleinQuartic:
|
case gKleinQuartic:
|
||||||
worldsize = 24 + 28 * gar;
|
case gSchmutzM2:
|
||||||
|
case gBolza2:
|
||||||
|
euler = -4;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case gSchmutzM3:
|
||||||
|
case gBring:
|
||||||
|
euler = -6;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case gMacbeath:
|
case gMacbeath:
|
||||||
worldsize = (12 + 14 * gar) * 6;
|
euler = -12;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case gBolza:
|
default:
|
||||||
worldsize = 3 * (2*tv + ts * gar) / tv;
|
println(hlog, "warning: Euler characteristics unknown");
|
||||||
break;
|
|
||||||
|
|
||||||
case gBolza2:
|
|
||||||
worldsize = 6 * (2*tv + ts * gar) / tv;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
worldsize = denom ? nom/denom : 0;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nom *= euler;
|
||||||
|
denom *= 2;
|
||||||
|
|
||||||
|
int g = gcd(nom, denom);
|
||||||
|
if(g) {
|
||||||
|
nom /= g;
|
||||||
|
denom /= g;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(fulltorus) {
|
||||||
|
using namespace torusconfig;
|
||||||
|
auto& mode = tmodes[torus_mode];
|
||||||
|
if(mode.flags & TF_SINGLE)
|
||||||
|
worldsize = qty;
|
||||||
|
else
|
||||||
|
worldsize = sdx * sdy;
|
||||||
|
}
|
||||||
|
else worldsize = denom ? nom / denom : 0;
|
||||||
|
|
||||||
|
if(euler < 0 && !bounded)
|
||||||
|
worldsize = -worldsize;
|
||||||
|
|
||||||
string spf = its(ts);
|
string spf = its(ts);
|
||||||
if(archimedean) {
|
if(archimedean) {
|
||||||
spf = "";
|
spf = "";
|
||||||
@ -444,10 +480,20 @@ void showEuclideanMenu() {
|
|||||||
binarytiling ? fts4(8 * M_PI * sqrt(2) * log(2) / vid.binary_width) + " exp(∞)" :
|
binarytiling ? fts4(8 * M_PI * sqrt(2) * log(2) / vid.binary_width) + " exp(∞)" :
|
||||||
archimedean ? arcm::current.world_size() :
|
archimedean ? arcm::current.world_size() :
|
||||||
(archimedean && sphere) ? its(isize(currentmap->allcells())) :
|
(archimedean && sphere) ? its(isize(currentmap->allcells())) :
|
||||||
worldsize < 0 ? (nom%denom ? its(nom)+"/"+its(-denom) : its(-worldsize)) + " exp(∞)":
|
worldsize < 0 ? (nom%denom ? its(nom)+"/"+its(denom) : its(-worldsize)) + " exp(∞)":
|
||||||
worldsize == 0 ? "∞" :
|
(euwrap && !fulltorus) ? "∞" :
|
||||||
|
worldsize == 0 ? "∞²" :
|
||||||
its(worldsize),
|
its(worldsize),
|
||||||
'3');
|
'3');
|
||||||
|
|
||||||
|
if(bounded) {
|
||||||
|
dialog::addSelItem(XLAT("Euler characteristics"), its(euler), 0);
|
||||||
|
if(nonorientable)
|
||||||
|
dialog::addSelItem(XLAT("demigenus"), its(2-euler), 0);
|
||||||
|
else
|
||||||
|
dialog::addSelItem(XLAT("genus"), its((2-euler)/2), 0);
|
||||||
|
}
|
||||||
|
else dialog::addBreak(200);
|
||||||
|
|
||||||
switch(ginf[geometry].cclass) {
|
switch(ginf[geometry].cclass) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -559,7 +559,10 @@ namespace hr { namespace gp {
|
|||||||
if(GOLDBERG) {
|
if(GOLDBERG) {
|
||||||
int x = param.first;
|
int x = param.first;
|
||||||
int y = param.second;
|
int y = param.second;
|
||||||
area = ((2*x+y) * (2*x+y) + y*y*3) / 4;
|
if(S3 == 3)
|
||||||
|
area = ((2*x+y) * (2*x+y) + y*y*3) / 4;
|
||||||
|
else
|
||||||
|
area = x * x + y * y;
|
||||||
next = hpxyz(x+y/2., -y * sqrt(3) / 2, 0);
|
next = hpxyz(x+y/2., -y * sqrt(3) / 2, 0);
|
||||||
ld scale = 1 / hypot2(next);
|
ld scale = 1 / hypot2(next);
|
||||||
crossf *= scale;
|
crossf *= scale;
|
||||||
|
@ -1390,8 +1390,14 @@ land_validity_t& land_validity(eLand l) {
|
|||||||
return great_walls_missing;
|
return great_walls_missing;
|
||||||
|
|
||||||
// highlight Crossroads on Euclidean
|
// highlight Crossroads on Euclidean
|
||||||
if(euclid && !euwrap && (l == laCrossroads || l == laCrossroads4)) // fix cylinder
|
if(euclid && !euwrap && (l == laCrossroads || l == laCrossroads4))
|
||||||
return full_game;
|
return full_game;
|
||||||
|
|
||||||
|
if(euclid && euwrap && !fulltorus && l == laCrossroads && torusconfig::sdy == -2 * torusconfig::sdx)
|
||||||
|
return full_game;
|
||||||
|
|
||||||
|
if(euclid && euwrap && !fulltorus && l == laCrossroads4 && torusconfig::sdy == 0)
|
||||||
|
return full_game;
|
||||||
|
|
||||||
// highlight Zebra-based lands on Zebra Quotient!
|
// highlight Zebra-based lands on Zebra Quotient!
|
||||||
if((l == laZebra || l == laWhirlwind || l == laStorms || l == laWarpCoast || l == laWarpSea) && geometry == gZebraQuotient)
|
if((l == laZebra || l == laWhirlwind || l == laStorms || l == laWarpCoast || l == laWarpSea) && geometry == gZebraQuotient)
|
||||||
|
Loading…
Reference in New Issue
Block a user