1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-20 15:40:26 +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;
queue<pair<heptagon*, transmatrix>> drawqueue;
queue<tuple<heptagon*, transmatrix, ld>> drawqueue;
void enqueue(heptagon *h, const transmatrix& T) {
if(visited.count(h)) { return; }
visited.insert(h);
drawqueue.emplace(h, T);
drawqueue.emplace(h, T, band_shift);
}
pair<ld, ld>& archimedean_tiling::get_triangle(heptagon *h, int cid) {
@ -620,8 +620,9 @@ void draw() {
while(!drawqueue.empty()) {
auto p = drawqueue.front();
drawqueue.pop();
heptagon *h = p.first;
transmatrix V = p.second;
heptagon *h = get<0>(p);
transmatrix V = get<1>(p);
dynamicval<ld> b(band_shift, get<2>(p));
int id = id_of(h);
int S = isize(current.triangles[id]);
@ -636,7 +637,9 @@ void draw() {
if(DUAL && (i&1)) continue;
h->cmove(i);
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++;
}

View File

@ -154,29 +154,32 @@ namespace binary {
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 && 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);
drawcell(c, V, 0, false);
drawcell(c, V1, 0, false);
// 1: up
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
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
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
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
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
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() {