diff --git a/floorshapes.cpp b/floorshapes.cpp index 7a547bda..93a81925 100644 --- a/floorshapes.cpp +++ b/floorshapes.cpp @@ -332,7 +332,7 @@ namespace gp { id = nextid++; bool master = !(li.relative.first||li.relative.second); - int cor = master ? S7 : 6; + int cor = master ? S7 : SG6; if(master) li.last_dir = -1; if(debug_geometry) printf("last=%d at=%d,%d tot=%d siid=%d sidir=%d cor=%d id=%d\n", li.last_dir, li.relative.first, li.relative.second, li.total_dir, siid, sidir, cor, id); @@ -437,7 +437,7 @@ namespace gp { for(int j=0; j= wc.mindir + 6) dir -= 6; + if(dir < wc.mindir) dir += SG6; + if(dir >= wc.mindir + SG6) dir -= SG6; return wc.cw + dir; } void set_localwalk(goldberg_mapping_t& wc, int dir, const cellwalker& cw) { - if(dir < wc.mindir) dir += 6; - if(dir >= wc.mindir + 6) dir -= 6; + if(dir < wc.mindir) dir += SG6; + if(dir >= wc.mindir + SG6) dir -= SG6; wc.cw = cw - dir; } bool pull(loc at, int dir) { auto& wc = get_mapping(at); auto at1 = at + eudir(dir); - int dir1 = fix6(dir+3); + int dir1 = fixg6(dir+SG3); cellwalker wcw = get_localwalk(wc, dir); auto& wc1= get_mapping(at1); if(wc1.cw.c) { @@ -176,12 +191,12 @@ namespace hr { namespace gp { } return false; } - + void conn1(loc at, int dir, int dir1) { auto& wc = get_mapping(at); auto wcw = get_localwalk(wc, dir); auto& wc1 = get_mapping(at + eudir(dir)); - WHD( Xprintf(" md:%d s:%d", wc.mindir, wc.cw.spin); ) + WHD( Xprintf(" md:%02d s:%d", wc.mindir, wc.cw.spin); ) WHD( Xprintf(" connection %s/%d %s=%s ~ %s/%d ", disp(at), dir, dcw(wc.cw+dir), dcw(wcw), disp(at+eudir(dir)), dir1); ) if(!wc1.cw.c) { if(peek(wcw)) { @@ -189,7 +204,7 @@ namespace hr { namespace gp { set_localwalk(wc1, dir1, wcw + wstep); } else { - peek(wcw) = newCell(6, wc.cw.c->master); + peek(wcw) = newCell(SG6, wc.cw.c->master); tsetspin(wcw.c->spintable, wcw.spin, 0); set_localwalk(wc1, dir1, wcw + wstep); spawn++; @@ -218,8 +233,8 @@ namespace hr { namespace gp { } void conn(loc at, int dir) { - conn1(at, fix6(dir), fix6(dir+3)); - conn1(at + eudir(dir), fix6(dir+3), fix6(dir)); + conn1(at, fixg6(dir), fixg6(dir+SG3)); + conn1(at + eudir(dir), fixg6(dir+SG3), fixg6(dir)); } goldberg_mapping_t& set_heptspin(loc at, heptspin hs) { @@ -241,9 +256,14 @@ namespace hr { namespace gp { extend_map(c, d); extend_map(c, fixdir(d-1, c)); extend_map(c, fixdir(d+1, c)); + if(S3 == 4 && !c->mov[d]) + for(int i=0; imaster, i)->c7, j); return; } + if(S3 == 4 && param.first <= param.second) { d--; if(d<0) d += S7; } clear_mapping(); // we generate a local map from an Euclidean grid to the @@ -251,19 +271,35 @@ namespace hr { namespace gp { // we fill the equilateral triangle with the following vertices: - loc vc[3]; + loc vc[4]; vc[0] = loc(0,0); vc[1] = param; - vc[2] = param * loc(0,1); + if(S3 == 3) + vc[2] = param * loc(0,1); + else + vc[2] = param * loc(1,1), + vc[3] = param * loc(0,1); heptspin hs(c->master, d, false); auto& ac0 = set_heptspin(vc[0], hs); ac0.mindir = -1; - auto& ac1 = set_heptspin(vc[1], hs + wstep - 3); + auto& ac1 = set_heptspin(vc[1], hs + wstep - SG3); ac1.mindir = 0; - auto& ac2 = set_heptspin(vc[2], hs + 1 + wstep - 4); - ac2.mindir = 1; + auto& ac2 = set_heptspin(vc[S3-1], S3 == 3 ? hs + 1 + wstep - 4 : hs + 1 + wstep + 1); + ac2.mindir = S3 == 3 ? 1 : -2; + if(S3 == 4) { + set_heptspin(vc[2], hs + wstep - 1 + wstep + 1).mindir = -3; + } + + if(S3 == 4 && param == loc(1,1)) { + conn(loc(0,0), 1); + conn(loc(0,1), 0); + conn(loc(0,1), 1); + conn(loc(0,1), 2); + conn(loc(0,1), 3); + return; + } if(nonorientable && param.first == param.second) { int x = param.first; @@ -295,58 +331,74 @@ namespace hr { namespace gp { } // then we set the edges of our big equilateral triangle (in a symmetric way) - for(int i=0; i<3; i++) { + for(int i=0; i= 2 && rel.first >= 2 - rel.second) { + while(rel.first >= 2 && (S3 == 3 ? rel.first >= 2 - rel.second : true)) { build(start, 0, true); - build(end, 3, false); + build(end, SG3, false); rel.first -= 2; } while(rel.second >= 2) { build(start, 1, true); - build(end, 4, false); + build(end, 1+SG3, false); rel.second -= 2; } - while(rel.second <= -2) { + while(rel.second <= -2 && S3 == 3) { build(start, 5, true); build(end, 2, false); rel.second += 2; rel.first -= 2; } - while((rel.first>0 && rel.second > 0) | (rel.first > 1 && rel.second < 0)) { + if(S3 == 3) while((rel.first>0 && rel.second > 0) | (rel.first > 1 && rel.second < 0)) { build(start, 0, true); build(end, 3, false); rel.first -= 2; } - for(int k=0; k<6; k++) - if(start + eudir(k+2*i) == end) + if(S3 == 4 && rel == loc(1,1)) { + if(param == loc(3,1) || param == loc(5,1)) { + build(start, 1, true); + build(end, 2, false); + rel.first--; + rel.second--; + } + else { + build(start, 0, true); + build(end, 3, false); + rel.first--; + rel.second--; + } + } + for(int k=0; k3) sp -= 6; + if(sp>SG3) sp -= SG6; return normalize(spin(2*M_PI*sp/S7) * cornmul(T, corner)); } @@ -438,7 +537,7 @@ namespace hr { namespace gp { transmatrix T = dir_matrix(i); for(int x=-16; x<16; x++) for(int y=-16; y<16; y++) - for(int d=0; d<6; d++) { + for(int d=0; d<(S3==3?6:4); d++) { loc at = loc(x, y); hyperpoint h = atz(T, corners, at, 6); @@ -453,8 +552,8 @@ namespace hr { namespace gp { if(i == -1) return atz(dir_matrix(cid), corners, li.relative, 0, cf); else { - auto& cellmatrix = Tf[i][li.relative.first&31][li.relative.second&31][fix6(li.total_dir)]; - return inverse(cellmatrix) * atz(dir_matrix(i), corners, li.relative, fix6(cid + li.total_dir), cf); + auto& cellmatrix = Tf[i][li.relative.first&31][li.relative.second&31][fixg6(li.total_dir)]; + return inverse(cellmatrix) * atz(dir_matrix(i), corners, li.relative, fixg6(cid + li.total_dir), cf); } } @@ -499,13 +598,13 @@ namespace hr { namespace gp { v = v * loc(0, 1); if(x > 8) x = 8; if(y > 8) y = 8; - if(y > x) v = v * loc(1, -1); + if(S3 == 3 && y > x) v = v * loc(1, -1); return v; } loc human_representation(loc v) { int& x = v.first, &y = v.second; - while(x < 0 || y < 0 || (x == 0 && y > 0)) + if(S3 == 3) while(x < 0 || y < 0 || (x == 0 && y > 0)) v = v * loc(0, 1); return v; } @@ -517,11 +616,11 @@ namespace hr { namespace gp { } else if(param == loc(1, 0)) return XLAT("OFF"); - else if(param == loc(1, 1)) + else if(param == loc(1, 1) && S3 == 3) return XLAT("bitruncated"); - else if(param == loc(2, 0)) + else if(param == loc(2, 0) && S3 == 3) return XLAT("chamfered"); - else if(param == loc(3, 0)) + else if(param == loc(3, 0) && S3 == 3) return XLAT("2x bitruncated"); else { auto p = human_representation(param); @@ -546,7 +645,7 @@ namespace hr { namespace gp { if(gp::on) stop_game_and_switch_mode(rg::bitrunc); if(!nonbitrunc) stop_game_and_switch_mode(rg::bitrunc); } - else if(xy.first == 1 && xy.second == 1) { + else if(xy.first == 1 && xy.second == 1 && S3 == 3) { if(gp::on) stop_game_and_switch_mode(rg::bitrunc); if(nonbitrunc) stop_game_and_switch_mode(rg::bitrunc); } @@ -588,7 +687,7 @@ namespace hr { namespace gp { if(show_bitrunc) { dialog::addBoolItem(XLAT("bitruncated"), param == loc(1,1), 'b'); - dialog::lastItem().value = "GP(1,1)"; + dialog::lastItem().value = S3 == 3 ? "GP(1,1)" : "---"; } if(show_nonthree) { @@ -622,8 +721,14 @@ namespace hr { namespace gp { dialog::handleNavigation(sym, uni); if(uni == 'a' && show_nonthree) whirl_set(loc(1, 0), texture_remap); - else if(uni == 'b' && show_bitrunc) - whirl_set(loc(1, 1), texture_remap); + else if(uni == 'b' && show_bitrunc) { + if(S3 == 4) { + if(nonbitrunc || gp::on) + restart_game(rg::bitrunc); + } + else + whirl_set(loc(1, 1), texture_remap); + } else if(uni == 'c' && show_nonthree) whirl_set(loc(2, 0), texture_remap); else if(uni == 'd') diff --git a/hypgraph.cpp b/hypgraph.cpp index c4bdc823..7c4cc78f 100644 --- a/hypgraph.cpp +++ b/hypgraph.cpp @@ -524,8 +524,8 @@ void drawrec(cell *c, const transmatrix& V) { if(at != li.relative) printf("at %s/%s\n", disp(at), disp(li.relative)); if(maindir != li.last_dir) printf("ld %d/%d\n", maindir, li.last_dir); */ draw_li.relative = at; - draw_li.total_dir = fix6(dir); - transmatrix V1 = V * Tf[draw_li.last_dir][at.first&31][at.second&31][fix6(dir)]; + draw_li.total_dir = fixg6(dir); + transmatrix V1 = V * Tf[draw_li.last_dir][at.first&31][at.second&31][fixg6(dir)]; if(in_qrange(V1)) drawcell(c, V1, 0, false); } @@ -534,7 +534,7 @@ void drawrec(cell *c, const transmatrix& V) { if(!c2) continue; if(c2->mov[0] != c) continue; if(c2 == c2->master->c7) continue; - drawrec(c2, V, at + eudir(dir+i), dir + i + 3, maindir); + drawrec(c2, V, at + eudir(dir+i), dir + i + SG3, maindir); } } @@ -550,7 +550,7 @@ void drawrec(cell *c, const transmatrix& V) { if(c2->mov[0] != c) continue; if(c2 == c2->master->c7) continue; draw_li.last_dir = i; - drawrec(c2, V, gp::loc(1,0), 3, i); + drawrec(c2, V, gp::loc(1,0), SG3, i); } } } diff --git a/shmup.cpp b/shmup.cpp index bf4011e2..737caa46 100644 --- a/shmup.cpp +++ b/shmup.cpp @@ -3319,7 +3319,7 @@ transmatrix master_relative(cell *c, bool get_inverse) { } else { auto li = gp::get_local_info(c); - transmatrix T = spin(master_to_c7_angle()) * gp::Tf[li.last_dir][li.relative.first&31][li.relative.second&31][fix6(li.total_dir)]; + transmatrix T = spin(master_to_c7_angle()) * gp::Tf[li.last_dir][li.relative.first&31][li.relative.second&31][gp::fixg6(li.total_dir)]; if(get_inverse) T = inverse(T); return T; }