1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-20 23:50:27 +00:00

bandshifting for Archimedean and binary tilings (sometimes crashes Archimedean)

This commit is contained in:
Zeno Rogue 2018-11-10 10:31:19 +01:00
parent 6c8661b484
commit ab58d82713
2 changed files with 19 additions and 13 deletions

View File

@ -577,12 +577,12 @@ void create_adjacent(heptagon *h, int d) {
} }
set<heptagon*> visited; set<heptagon*> visited;
queue<pair<heptagon*, transmatrix>> drawqueue; queue<tuple<heptagon*, transmatrix, ld>> drawqueue;
void enqueue(heptagon *h, const transmatrix& T) { void enqueue(heptagon *h, const transmatrix& T) {
if(visited.count(h)) { return; } if(visited.count(h)) { return; }
visited.insert(h); visited.insert(h);
drawqueue.emplace(h, T); drawqueue.emplace(h, T, band_shift);
} }
pair<ld, ld>& archimedean_tiling::get_triangle(heptagon *h, int cid) { pair<ld, ld>& archimedean_tiling::get_triangle(heptagon *h, int cid) {
@ -620,8 +620,9 @@ void draw() {
while(!drawqueue.empty()) { while(!drawqueue.empty()) {
auto p = drawqueue.front(); auto p = drawqueue.front();
drawqueue.pop(); drawqueue.pop();
heptagon *h = p.first; heptagon *h = get<0>(p);
transmatrix V = p.second; transmatrix V = get<1>(p);
dynamicval<ld> b(band_shift, get<2>(p));
int id = id_of(h); int id = id_of(h);
int S = isize(current.triangles[id]); int S = isize(current.triangles[id]);
@ -636,7 +637,9 @@ void draw() {
if(DUAL && (i&1)) continue; if(DUAL && (i&1)) continue;
h->cmove(i); h->cmove(i);
if(PURE && id >= 2*current.N && h->move(i) && id_of(h->move(i)) >= 2*current.N) continue; if(PURE && id >= 2*current.N && h->move(i) && id_of(h->move(i)) >= 2*current.N) continue;
enqueue(h->move(i), V * adjcell_matrix(h, i)); transmatrix V1 = V * adjcell_matrix(h, i);
bandfixer bf(V1);
enqueue(h->move(i), V1);
} }
idx++; idx++;
} }

View File

@ -154,29 +154,32 @@ namespace binary {
void draw_rec(cell *c, int dirs, const transmatrix& V, int reclev) { void draw_rec(cell *c, int dirs, const transmatrix& V, int reclev) {
transmatrix V1 = V;
bandfixer bf(V1);
if(vid.use_smart_range == 0 && !dodrawcell(c)) return; if(vid.use_smart_range == 0 && !dodrawcell(c)) return;
if(vid.use_smart_range && reclev >= 2 && !in_smart_range(V)) return; if(vid.use_smart_range && reclev >= 2 && !in_smart_range(V1)) return;
if(vid.use_smart_range == 2) setdist(c, 7, c); if(vid.use_smart_range == 2) setdist(c, 7, c);
drawcell(c, V, 0, false); drawcell(c, V1, 0, false);
// 1: up // 1: up
if(dirs & 1) if(dirs & 1)
draw_rec(createMov(c, bd_up), 7, V * xpush(-log(2)), reclev+1); draw_rec(createMov(c, bd_up), 7, V1 * xpush(-log(2)), reclev+1);
// right // right
if(dirs & 2) if(dirs & 2)
draw_rec(createMov(c, bd_right), 2, V * parabolic(1), reclev+1); draw_rec(createMov(c, bd_right), 2, V1 * parabolic(1), reclev+1);
// left // left
if(dirs & 4) if(dirs & 4)
draw_rec(createMov(c, bd_left), 4, V * parabolic(-1), reclev+1); draw_rec(createMov(c, bd_left), 4, V1 * parabolic(-1), reclev+1);
// down // down
if((dirs & 8) && c->type == 6) if((dirs & 8) && c->type == 6)
draw_rec(createMov(c, bd_down), dirs & 62, V * xpush(log(2)), reclev+1); draw_rec(createMov(c, bd_down), dirs & 62, V1 * xpush(log(2)), reclev+1);
// down_left // down_left
if((dirs & 16) && c->type == 7) if((dirs & 16) && c->type == 7)
draw_rec(createMov(c, bd_down_left), dirs & 28, V * parabolic(-1) * xpush(log(2)), reclev+1); draw_rec(createMov(c, bd_down_left), dirs & 28, V1 * parabolic(-1) * xpush(log(2)), reclev+1);
// down_right // down_right
if((dirs & 32) && c->type == 7) if((dirs & 32) && c->type == 7)
draw_rec(createMov(c, bd_down_right), dirs & 42, V * parabolic(1) * xpush(log(2)), reclev+1); draw_rec(createMov(c, bd_down_right), dirs & 42, V1 * parabolic(1) * xpush(log(2)), reclev+1);
} }
void draw() { void draw() {