mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-23 23:47:00 +00:00
irr:: Euclidean guarding
This commit is contained in:
parent
b8cf027b7a
commit
f69ea5ec8d
@ -33,6 +33,7 @@ EX namespace euclid3 {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
EX coord euzero = coord(0,0,0);
|
EX coord euzero = coord(0,0,0);
|
||||||
|
EX intmatrix euzeroall = make_array<coord>(euzero, euzero, euzero);
|
||||||
|
|
||||||
static const intmatrix main_axes = make_array<coord>(coord(1,0,0), coord(0,1,0), coord(0,0,1));
|
static const intmatrix main_axes = make_array<coord>(coord(1,0,0), coord(0,1,0), coord(0,0,1));
|
||||||
|
|
||||||
@ -445,7 +446,7 @@ EX namespace euclid3 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EX intmatrix make_quarter_turn(int a, int b, int c) {
|
EX intmatrix make_quarter_turn(int a, int b, int c) {
|
||||||
intmatrix T0 = make_array<coord> (euzero, euzero, euzero);
|
intmatrix T0 = euzeroall;
|
||||||
T0[0][0] = a;
|
T0[0][0] = a;
|
||||||
T0[0][1] = b;
|
T0[0][1] = b;
|
||||||
T0[2][0] = c;
|
T0[2][0] = c;
|
||||||
@ -456,6 +457,8 @@ EX namespace euclid3 {
|
|||||||
|
|
||||||
int dim = ginf[g].g.gameplay_dimension;
|
int dim = ginf[g].g.gameplay_dimension;
|
||||||
|
|
||||||
|
if(IRREGULAR) T0 = irr::base_periods, twisted0 = irr::base_twisted;
|
||||||
|
|
||||||
user_axes = T0;
|
user_axes = T0;
|
||||||
if(dim == 2) user_axes[2] = euzero;
|
if(dim == 2) user_axes[2] = euzero;
|
||||||
|
|
||||||
@ -828,6 +831,10 @@ EX namespace euclid3 {
|
|||||||
torus_config_option(XLAT("Möbius band"), 'E', rectangular_torus(6, 0, true));
|
torus_config_option(XLAT("Möbius band"), 'E', rectangular_torus(6, 0, true));
|
||||||
if(S3 == 3) torus_config_option(XLAT("seven-colorable torus"), 'F', regular_torus({1,2}));
|
if(S3 == 3) torus_config_option(XLAT("seven-colorable torus"), 'F', regular_torus({1,2}));
|
||||||
if(S3 == 3) torus_config_option(XLAT("HyperRogue classic torus"), 'G', single_row_torus(381, -22));
|
if(S3 == 3) torus_config_option(XLAT("HyperRogue classic torus"), 'G', single_row_torus(381, -22));
|
||||||
|
torus_config_option(XLAT("no quotient"), 'H', rectangular_torus(0, 0, false));
|
||||||
|
|
||||||
|
if(IRREGULAR)
|
||||||
|
dialog::addInfo("period cannot be changed in irregular");
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog::addBreak(50);
|
dialog::addBreak(50);
|
||||||
|
@ -749,6 +749,10 @@ EX namespace gp {
|
|||||||
dialog::addBoolItem(XLAT("irregular"), IRREGULAR, 'i');
|
dialog::addBoolItem(XLAT("irregular"), IRREGULAR, 'i');
|
||||||
dialog::add_action(dialog::add_confirmation([=] () {
|
dialog::add_action(dialog::add_confirmation([=] () {
|
||||||
if(min_quality && !irr::bitruncations_requested) irr::bitruncations_requested++;
|
if(min_quality && !irr::bitruncations_requested) irr::bitruncations_requested++;
|
||||||
|
if(euclid && !bounded) {
|
||||||
|
println(hlog, XLAT("To create Euclidean irregular tesselations, first enable a torus"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
if(!IRREGULAR) irr::visual_creator();
|
if(!IRREGULAR) irr::visual_creator();
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -121,6 +121,9 @@ string status[5];
|
|||||||
|
|
||||||
EX hrmap *base;
|
EX hrmap *base;
|
||||||
|
|
||||||
|
EX euclid3::intmatrix base_periods;
|
||||||
|
EX int base_twisted;
|
||||||
|
|
||||||
bool gridmaking;
|
bool gridmaking;
|
||||||
|
|
||||||
int rearrange_index;
|
int rearrange_index;
|
||||||
@ -916,6 +919,14 @@ string irrhelp =
|
|||||||
"with too large periodic base geometry. "
|
"with too large periodic base geometry. "
|
||||||
"For technical reasons, the density cannot be too small.";
|
"For technical reasons, the density cannot be too small.";
|
||||||
|
|
||||||
|
bool too_small_euclidean() {
|
||||||
|
for(cell *c: base->allcells())
|
||||||
|
forCellIdEx(c1, i1, c)
|
||||||
|
forCellIdEx(c2, i2, c)
|
||||||
|
if(i1 != i2 && c1 == c2) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void show_gridmaker() {
|
void show_gridmaker() {
|
||||||
cmode = sm::SIDE | sm::MAYDARK;
|
cmode = sm::SIDE | sm::MAYDARK;
|
||||||
gamescreen(0);
|
gamescreen(0);
|
||||||
@ -986,6 +997,8 @@ void show_gridmaker() {
|
|||||||
if(bitruncations_requested < bitruncations_performed) runlevel = 0;
|
if(bitruncations_requested < bitruncations_performed) runlevel = 0;
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
if(too_small_euclidean())
|
||||||
|
dialog::addInfo(XLAT("too small period -- irregular tiling generation fails"));
|
||||||
dialog::addItem(XLAT("reset"), 'r');
|
dialog::addItem(XLAT("reset"), 'r');
|
||||||
dialog::add_action([] () { runlevel = 0; });
|
dialog::add_action([] () { runlevel = 0; });
|
||||||
dialog::addHelp();
|
dialog::addHelp();
|
||||||
@ -1018,6 +1031,8 @@ EX void visual_creator() {
|
|||||||
start_game();
|
start_game();
|
||||||
if(base) delete base;
|
if(base) delete base;
|
||||||
base = currentmap;
|
base = currentmap;
|
||||||
|
base_periods = euclid3::T0;
|
||||||
|
base_twisted = euclid3::twisted0;
|
||||||
drawthemap();
|
drawthemap();
|
||||||
cellcount = int(isize(base->allcells()) * density + .5);
|
cellcount = int(isize(base->allcells()) * density + .5);
|
||||||
pushScreen(show_gridmaker);
|
pushScreen(show_gridmaker);
|
||||||
|
Loading…
Reference in New Issue
Block a user