From ade8bda5f93d3304a6576e755cb9370a57b063a5 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Tue, 6 Nov 2018 16:03:20 +0100 Subject: [PATCH] fixed smart_range in Archimedean and binary tilings --- archimedean.cpp | 4 +++- binary-tiling.cpp | 22 +++++++++++++--------- hyper.h | 2 ++ 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/archimedean.cpp b/archimedean.cpp index 890192df..1c4f1fa7 100644 --- a/archimedean.cpp +++ b/archimedean.cpp @@ -626,7 +626,9 @@ void draw() { int S = isize(current.triangles[id]); if(id < 2*current.N ? !DUAL : !PURE) { - if(!dodrawcell(h->c7)) continue; + if(vid.use_smart_range == 0 && !dodrawcell(h->c7)) continue; + if(vid.use_smart_range && idx > 50 && !in_smart_range(V)) continue; + if(vid.use_smart_range == 2) setdist(h->c7, 7, h->c7); drawcell(h->c7, V, 0, false); } diff --git a/binary-tiling.cpp b/binary-tiling.cpp index 602192b5..ad95151d 100644 --- a/binary-tiling.cpp +++ b/binary-tiling.cpp @@ -152,31 +152,35 @@ namespace binary { return transmatrix {{{-u*u/8+1, u/2, u*u/8}, {-u/2, 1, u/2}, {-u*u/8, u/2, u*u/8+1}}}; } - void draw_rec(cell *c, int dirs, const transmatrix& V) { - if(!dodrawcell(c)) return; + void draw_rec(cell *c, int dirs, const transmatrix& V, int reclev) { + + 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 == 2) setdist(c, 7, c); + drawcell(c, V, 0, false); // 1: up if(dirs & 1) - draw_rec(createMov(c, bd_up), 7, V * xpush(-log(2))); + draw_rec(createMov(c, bd_up), 7, V * xpush(-log(2)), reclev+1); // right if(dirs & 2) - draw_rec(createMov(c, bd_right), 2, V * parabolic(1)); + draw_rec(createMov(c, bd_right), 2, V * parabolic(1), reclev+1); // left if(dirs & 4) - draw_rec(createMov(c, bd_left), 4, V * parabolic(-1)); + draw_rec(createMov(c, bd_left), 4, V * parabolic(-1), reclev+1); // down if((dirs & 8) && c->type == 6) - draw_rec(createMov(c, bd_down), dirs & 62, V * xpush(log(2))); + draw_rec(createMov(c, bd_down), dirs & 62, V * 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))); + draw_rec(createMov(c, bd_down_left), dirs & 28, V * 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))); + draw_rec(createMov(c, bd_down_right), dirs & 42, V * parabolic(1) * xpush(log(2)), reclev+1); } void draw() { - draw_rec(viewctr.at->c7, 63, cview()); + draw_rec(viewctr.at->c7, 63, cview(), 0); } transmatrix relative_matrix(heptagon *h2, heptagon *h1) { diff --git a/hyper.h b/hyper.h index 8e1bd14f..c7133a37 100644 --- a/hyper.h +++ b/hyper.h @@ -4300,5 +4300,7 @@ void enable_cheat(); extern int cells_drawn; void menuitem_sightrange(char c = 'r'); + +bool in_smart_range(const transmatrix& T); }