mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-02-04 13:19:20 +00:00
third turn space improvements
This commit is contained in:
parent
e258b923c6
commit
bd89c1b91a
52
euclid.cpp
52
euclid.cpp
@ -430,6 +430,27 @@ EX namespace euclid3 {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EX intmatrix make_third_turn(int a, int b, int c) {
|
||||||
|
intmatrix T0;
|
||||||
|
T0[0][0] = a;
|
||||||
|
T0[0][1] = b;
|
||||||
|
T0[2][0] = c;
|
||||||
|
T0[0][2] = -T0[0][0]-T0[0][1];
|
||||||
|
T0[1][0] = T0[0][1];
|
||||||
|
T0[1][1] = T0[0][2];
|
||||||
|
T0[1][2] = T0[0][0];
|
||||||
|
T0[2][1] = T0[2][2] = c;
|
||||||
|
return T0;
|
||||||
|
}
|
||||||
|
|
||||||
|
EX intmatrix make_quarter_turn(int a, int b, int c) {
|
||||||
|
intmatrix T0 = make_array<coord> (euzero, euzero, euzero);
|
||||||
|
T0[0][0] = a;
|
||||||
|
T0[0][1] = b;
|
||||||
|
T0[2][0] = c;
|
||||||
|
return T0;
|
||||||
|
}
|
||||||
|
|
||||||
EX void build_torus3(eGeometry g) {
|
EX void build_torus3(eGeometry g) {
|
||||||
|
|
||||||
int dim = ginf[g].g.gameplay_dimension;
|
int dim = ginf[g].g.gameplay_dimension;
|
||||||
@ -489,6 +510,9 @@ EX namespace euclid3 {
|
|||||||
if(dim == 3) {
|
if(dim == 3) {
|
||||||
if(valid_third_turn(T0)) {
|
if(valid_third_turn(T0)) {
|
||||||
twisted &= 16;
|
twisted &= 16;
|
||||||
|
if(g == gRhombic3 && (T0[2][2]&1)) twisted = 0;
|
||||||
|
if(g == gBitrunc3 && (T0[0][0]&1)) twisted = 0;
|
||||||
|
if(g == gBitrunc3 && (T0[1][1]&1)) twisted = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
twisted &= 7;
|
twisted &= 7;
|
||||||
@ -706,6 +730,7 @@ EX namespace euclid3 {
|
|||||||
void torus_config_option(string name, char key, torus_config tc) {
|
void torus_config_option(string name, char key, torus_config tc) {
|
||||||
dialog::addBoolItem(name, make_pair(T_edit, twisted_edit) == tc && PURE, key);
|
dialog::addBoolItem(name, make_pair(T_edit, twisted_edit) == tc && PURE, key);
|
||||||
dialog::add_action([tc] {
|
dialog::add_action([tc] {
|
||||||
|
stop_game();
|
||||||
tie(euclid3::T0, euclid3::twisted0) = tc;
|
tie(euclid3::T0, euclid3::twisted0) = tc;
|
||||||
tie(T_edit, twisted_edit) = tc;
|
tie(T_edit, twisted_edit) = tc;
|
||||||
set_variation(eVariation::pure);
|
set_variation(eVariation::pure);
|
||||||
@ -734,8 +759,20 @@ EX namespace euclid3 {
|
|||||||
for(int j=0; j<dim; j++)
|
for(int j=0; j<dim; j++)
|
||||||
if(T_edit[i][j] && i != j) nondiag = true;
|
if(T_edit[i][j] && i != j) nondiag = true;
|
||||||
|
|
||||||
|
if(valid_third_turn(T_edit)) {
|
||||||
|
auto g = geometry;
|
||||||
|
if(g == gCubeTiling ||
|
||||||
|
(g == gRhombic3 && T_edit[2][2] % 2 == 0) ||
|
||||||
|
(g == gBitrunc3 && T_edit[0][0] % 2 == 0 && T_edit[1][1] % 2 == 0))
|
||||||
|
dialog::addBoolItem(XLAT("third turn space"), twisted_edit & 16, 'x');
|
||||||
|
else
|
||||||
|
dialog::addBoolItem(XLAT("make it even"), twisted_edit & 16, 'x');
|
||||||
|
dialog::add_action([] { twisted_edit ^= 16; });
|
||||||
|
}
|
||||||
|
|
||||||
if(nondiag) {
|
if(nondiag) {
|
||||||
dialog::addInfo(XLAT("twisting implemented only for diagonal matrices"));
|
dialog::addInfo(XLAT("twisting implemented only for diagonal matrices"));
|
||||||
|
dialog::addInfo(XLAT("or for columns : (A,B,C), (B,C,A), (D,D,D) where A+B+C=0"));
|
||||||
dialog::addBreak(200);
|
dialog::addBreak(200);
|
||||||
}
|
}
|
||||||
else if(T_edit[dim-1][dim-1] == 0) {
|
else if(T_edit[dim-1][dim-1] == 0) {
|
||||||
@ -763,6 +800,9 @@ EX namespace euclid3 {
|
|||||||
dialog::addBoolItem(XLAT("swapping impossible"), twisted_edit & 4, 'z');
|
dialog::addBoolItem(XLAT("swapping impossible"), twisted_edit & 4, 'z');
|
||||||
dialog::add_action([] { twisted_edit ^= 4; });
|
dialog::add_action([] { twisted_edit ^= 4; });
|
||||||
}
|
}
|
||||||
|
dialog::addBreak(50);
|
||||||
|
torus_config_option(XLAT("third-turn space"), 'A', {make_third_turn(2,0,2), 16});
|
||||||
|
torus_config_option(XLAT("quarter-turn space"), 'B', {make_quarter_turn(2, 0, 2), 5});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(T_edit[1][0] == 0 && T_edit[1][1] == 0)
|
if(T_edit[1][0] == 0 && T_edit[1][1] == 0)
|
||||||
@ -873,14 +913,10 @@ EX namespace euclid3 {
|
|||||||
else if(argis("-twistthird")) {
|
else if(argis("-twistthird")) {
|
||||||
PHASEFROM(2);
|
PHASEFROM(2);
|
||||||
stop_game();
|
stop_game();
|
||||||
shift(); T0[0][0] = argi();
|
shift(); int a = argi();
|
||||||
shift(); T0[0][1] = argi();
|
shift(); int b = argi();
|
||||||
shift(); T0[2][0] = argi();
|
shift(); int c = argi();
|
||||||
T0[0][2] = -T0[0][0]-T0[0][1];
|
T0 = make_third_turn(a, b, c);
|
||||||
T0[1][0] = T0[0][1];
|
|
||||||
T0[1][1] = T0[0][2];
|
|
||||||
T0[1][2] = T0[0][0];
|
|
||||||
T0[2][1] = T0[2][2] = argi();
|
|
||||||
twisted0 = 16;
|
twisted0 = 16;
|
||||||
build_torus3();
|
build_torus3();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user