1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-25 09:30:35 +00:00

fixed smart_range in Archimedean and binary tilings

This commit is contained in:
Zeno Rogue 2018-11-06 16:03:20 +01:00
parent b0151eabe4
commit ade8bda5f9
3 changed files with 18 additions and 10 deletions

View File

@ -626,7 +626,9 @@ void draw() {
int S = isize(current.triangles[id]); int S = isize(current.triangles[id]);
if(id < 2*current.N ? !DUAL : !PURE) { 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); drawcell(h->c7, V, 0, false);
} }

View File

@ -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}}}; 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) { void draw_rec(cell *c, int dirs, const transmatrix& V, int reclev) {
if(!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 == 2) setdist(c, 7, c);
drawcell(c, V, 0, false); drawcell(c, V, 0, false);
// 1: up // 1: up
if(dirs & 1) 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 // right
if(dirs & 2) 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 // left
if(dirs & 4) 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 // 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))); draw_rec(createMov(c, bd_down), dirs & 62, V * 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))); draw_rec(createMov(c, bd_down_left), dirs & 28, V * 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))); draw_rec(createMov(c, bd_down_right), dirs & 42, V * parabolic(1) * xpush(log(2)), reclev+1);
} }
void draw() { void draw() {
draw_rec(viewctr.at->c7, 63, cview()); draw_rec(viewctr.at->c7, 63, cview(), 0);
} }
transmatrix relative_matrix(heptagon *h2, heptagon *h1) { transmatrix relative_matrix(heptagon *h2, heptagon *h1) {

View File

@ -4300,5 +4300,7 @@ void enable_cheat();
extern int cells_drawn; extern int cells_drawn;
void menuitem_sightrange(char c = 'r'); void menuitem_sightrange(char c = 'r');
bool in_smart_range(const transmatrix& T);
} }