mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-11 18:00:34 +00:00
singletype patterns now can be remapped to irregular grids
This commit is contained in:
parent
bd59b4e23a
commit
7e1344a863
@ -703,6 +703,11 @@ namespace hr { namespace gp {
|
|||||||
|
|
||||||
bool show_nonthree = !(texture_remap && (S7&1));
|
bool show_nonthree = !(texture_remap && (S7&1));
|
||||||
bool show_bitrunc = !(texture_remap && !(S7&1));
|
bool show_bitrunc = !(texture_remap && !(S7&1));
|
||||||
|
bool show_irregular = !texture_remap;
|
||||||
|
if(texture_remap) {
|
||||||
|
if(patterns::cgroup == cpSingle)
|
||||||
|
show_nonthree = true, show_bitrunc = false, show_irregular = true;
|
||||||
|
}
|
||||||
|
|
||||||
if(show_nonthree) {
|
if(show_nonthree) {
|
||||||
dialog::addBoolItem(XLAT("OFF"), param == loc(1,0) && !irr::on, 'a');
|
dialog::addBoolItem(XLAT("OFF"), param == loc(1,0) && !irr::on, 'a');
|
||||||
@ -742,7 +747,7 @@ namespace hr { namespace gp {
|
|||||||
else
|
else
|
||||||
dialog::addBoolItem(XLAT("select"), param == internal_representation(config) && !irr::on, 'f');
|
dialog::addBoolItem(XLAT("select"), param == internal_representation(config) && !irr::on, 'f');
|
||||||
|
|
||||||
if(!texture_remap && irr::supports(geometry)) {
|
if(show_irregular && irr::supports(geometry)) {
|
||||||
dialog::addBoolItem(XLAT("irregular"), irr::on, 'i');
|
dialog::addBoolItem(XLAT("irregular"), irr::on, 'i');
|
||||||
dialog::add_action([] () { if(!irr::on) irr::visual_creator(); });
|
dialog::add_action([] () { if(!irr::on) irr::visual_creator(); });
|
||||||
}
|
}
|
||||||
|
@ -672,6 +672,10 @@ int celldist(cell *c, bool alts) {
|
|||||||
eGeometry orig_geometry;
|
eGeometry orig_geometry;
|
||||||
|
|
||||||
void start_game_on_created_map() {
|
void start_game_on_created_map() {
|
||||||
|
#if CAP_TEXTURE
|
||||||
|
auto old_tstate = texture::config.tstate;
|
||||||
|
auto old_tstate_max = texture::config.tstate_max;
|
||||||
|
#endif
|
||||||
popScreen();
|
popScreen();
|
||||||
for(hrmap *& hm : allmaps) if(hm == base) hm = NULL;
|
for(hrmap *& hm : allmaps) if(hm == base) hm = NULL;
|
||||||
stop_game();
|
stop_game();
|
||||||
@ -682,6 +686,9 @@ void start_game_on_created_map() {
|
|||||||
need_reset_geometry = true;
|
need_reset_geometry = true;
|
||||||
gridmaking = false;
|
gridmaking = false;
|
||||||
start_game();
|
start_game();
|
||||||
|
#if CAP_TEXTURE
|
||||||
|
texture::config.remap(old_tstate, old_tstate_max);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool save_map(const string& fname) {
|
bool save_map(const string& fname) {
|
||||||
|
11
pattern2.cpp
11
pattern2.cpp
@ -1724,18 +1724,23 @@ namespace patterns {
|
|||||||
}
|
}
|
||||||
dialog::addBoolItem(s, geometry == g.geo && nonbitrunc == g.nonbitru && whichPattern == g.whichPattern && subpattern_flags == g.subpattern_flags, 'a'+j);
|
dialog::addBoolItem(s, geometry == g.geo && nonbitrunc == g.nonbitru && whichPattern == g.whichPattern && subpattern_flags == g.subpattern_flags, 'a'+j);
|
||||||
}
|
}
|
||||||
bool have_goldberg = S3 == 3 && among(cgroup, cpFootball, cpThree) && !euclid;
|
bool have_goldberg = (S3 == 3 && among(cgroup, cpFootball, cpThree) && !euclid);
|
||||||
|
bool have_variations = (among(cgroup, cpSingle, cpSingleSym) && !euclid);
|
||||||
if(!(S7&1) && !nonbitrunc) have_goldberg = false; // always start from non-bitruncated
|
if(!(S7&1) && !nonbitrunc) have_goldberg = false; // always start from non-bitruncated
|
||||||
if(have_goldberg) {
|
if(have_goldberg) {
|
||||||
dialog::addBoolItem(XLAT("Goldberg"), gp::on, 'G');
|
dialog::addBoolItem(XLAT("Goldberg"), gp::on, 'G');
|
||||||
dialog::lastItem().value = gp::operation_name();
|
dialog::lastItem().value = gp::operation_name();
|
||||||
}
|
}
|
||||||
|
if(have_variations) {
|
||||||
|
dialog::addBoolItem(XLAT("variations"), gp::on, 'G');
|
||||||
|
dialog::lastItem().value = gp::operation_name();
|
||||||
|
}
|
||||||
else dialog::addBreak(100);
|
else dialog::addBreak(100);
|
||||||
dialog::addItem(XLAT("more tuning"), 'r');
|
dialog::addItem(XLAT("more tuning"), 'r');
|
||||||
dialog::addBack();
|
dialog::addBack();
|
||||||
dialog::display();
|
dialog::display();
|
||||||
|
|
||||||
keyhandler = [have_goldberg] (int sym, int uni) {
|
keyhandler = [have_goldberg, have_variations] (int sym, int uni) {
|
||||||
if(uni == 'r')
|
if(uni == 'r')
|
||||||
pushScreen(showPattern);
|
pushScreen(showPattern);
|
||||||
else if(uni >= '0' && uni < '0' + isize(cpatterns))
|
else if(uni >= '0' && uni < '0' + isize(cpatterns))
|
||||||
@ -1756,7 +1761,7 @@ namespace patterns {
|
|||||||
texture::config.remap(old_tstate, old_tstate_max);
|
texture::config.remap(old_tstate, old_tstate_max);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if(uni == 'G' && have_goldberg)
|
else if(uni == 'G' && (have_goldberg || have_variations))
|
||||||
gp::configure(true);
|
gp::configure(true);
|
||||||
else if(doexiton(sym, uni))
|
else if(doexiton(sym, uni))
|
||||||
popScreen();
|
popScreen();
|
||||||
|
17
textures.cpp
17
textures.cpp
@ -277,7 +277,9 @@ int getTriangleID(cell *c, patterns::patterninfo& si, hyperpoint h) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int goldbergcode(cell *c, const patterns::patterninfo& si) {
|
int goldbergcode(cell *c, const patterns::patterninfo& si) {
|
||||||
if(!gp::on) return 0;
|
if(irr::on)
|
||||||
|
return irr::cellindex[c] << 8;
|
||||||
|
else if(!gp::on) return 0;
|
||||||
else if(c == c->master->c7) return (fixdir(si.dir, c) << 8);
|
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);
|
else return (get_code(gp::get_local_info(c)) << 16) | (fixdir(si.dir, c) << 8);
|
||||||
}
|
}
|
||||||
@ -300,6 +302,17 @@ void mapTexture(cell *c, textureinfo& mi, patterns::patterninfo &si, const trans
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if(irr::on) {
|
||||||
|
mi.M = T;
|
||||||
|
mi.triangles.clear();
|
||||||
|
auto& vs = irr::cells[irr::cellindex[c]];
|
||||||
|
for(int i=0; i<c->type; i++) {
|
||||||
|
hyperpoint h1 = vs.vertices[i];
|
||||||
|
hyperpoint h2 = vs.vertices[(i+1)%c->type];
|
||||||
|
mi.triangles.emplace_back(make_array(C0, h1, h2), make_array(mi.M*C0, mi.M*h1, mi.M*h2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
mi.M = T * applyPatterndir(c, si);
|
mi.M = T * applyPatterndir(c, si);
|
||||||
|
|
||||||
@ -348,7 +361,7 @@ bool texture_config::apply(cell *c, const transmatrix &V, int col) {
|
|||||||
|
|
||||||
set_floor(shFullFloor);
|
set_floor(shFullFloor);
|
||||||
qfi.tinf = &mi;
|
qfi.tinf = &mi;
|
||||||
qfi.spin = gp::on ? Id : applyPatterndir(c, si);
|
qfi.spin = (gp::on || irr::on) ? Id : applyPatterndir(c, si);
|
||||||
|
|
||||||
if(grid_color) {
|
if(grid_color) {
|
||||||
draw_floorshape(c, V, shFullFloor, 0, PPR_FLOOR);
|
draw_floorshape(c, V, shFullFloor, 0, PPR_FLOOR);
|
||||||
|
Loading…
Reference in New Issue
Block a user