From 95da7ff09e071a274b941122c94ed17b108e54f1 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sat, 17 Aug 2019 23:29:11 +0200 Subject: [PATCH] using viewcenter() consistently --- geometry2.cpp | 2 +- graph.cpp | 10 +++++----- history.cpp | 2 +- screenshot.cpp | 8 ++++---- textures.cpp | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/geometry2.cpp b/geometry2.cpp index bca48217..ce17d5a2 100644 --- a/geometry2.cpp +++ b/geometry2.cpp @@ -163,7 +163,7 @@ EX transmatrix &ggmatrix(cell *c) { t = View * eumove(cell_to_vec(c) - cellwalker_to_vec(centerover)); } else - t = actualV(viewctr, actual_view_transform * View) * calc_relative_matrix(c, viewctr.at->c7, C0); + t = actualV(viewctr, actual_view_transform * View) * calc_relative_matrix(c, viewcenter(), C0); } return t; } diff --git a/graph.cpp b/graph.cpp index be409197..03ea70c3 100644 --- a/graph.cpp +++ b/graph.cpp @@ -861,7 +861,7 @@ EX bool drawItemType(eItem it, cell *c, const transmatrix& V, color_t icol, int if(GDIM == 3 && mapeditor::drawUserShape(V, mapeditor::sgItem, it, darkena(icol, 0, 0xFF), c)) return false; - if(WDIM == 3 && c == viewctr.at->c7 && in_perspective() && hdist0(tC0(V)) < cgi.orbsize * 0.25) return false; + if(WDIM == 3 && c == viewcenter() && in_perspective() && hdist0(tC0(V)) < cgi.orbsize * 0.25) return false; transmatrix Vit = V; if(GDIM == 3 && WDIM == 2 && c && it != itBabyTortoise) Vit = mscale(V, cgi.STUFF); @@ -5995,8 +5995,8 @@ EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { for(int a=0; atype; a++) if(c->move(a) && !isWall3(c->move(a), dummy)) { if(pmodel == mdPerspective && !sphere && !quotient && !penrose && !nonisotropic) { - if(a < 4 && among(geometry, gHoroTris, gBinary3) && celldistAlt(c) >= celldistAlt(viewctr.at->c7)) continue; - else if(a < 2 && among(geometry, gHoroRec) && celldistAlt(c) >= celldistAlt(viewctr.at->c7)) continue; + if(a < 4 && among(geometry, gHoroTris, gBinary3) && celldistAlt(c) >= celldistAlt(viewcenter())) continue; + else if(a < 2 && among(geometry, gHoroRec) && celldistAlt(c) >= celldistAlt(viewcenter())) continue; else if(c->move(a)->master->distance > c->master->distance && c->master->distance > viewctr.at->distance && !quotient) continue; } else if(sol && in_perspective()) { @@ -7149,7 +7149,7 @@ EX void make_actual_view() { if(GDIM == 3) { ld max = WDIM == 2 ? vid.camera : vid.yshift; if(max) - actual_view_transform = solmul(zpush(wall_radar((masterless ? centerover.at : viewctr.at->c7), inverse(View), max)), actual_view_transform * View) * inverse(View); + actual_view_transform = solmul(zpush(wall_radar((masterless ? centerover.at : viewcenter()), inverse(View), max)), actual_view_transform * View) * inverse(View); camera_level = asin_auto(tC0(inverse(actual_view_transform * View))[2]); } if(nonisotropic) { @@ -7185,7 +7185,7 @@ EX transmatrix cview() { EX void precise_mouseover() { if(WDIM == 3) { - mouseover2 = mouseover = viewctr.at->c7; + mouseover2 = mouseover = viewcenter(); ld best = HUGE_VAL; hyperpoint h = nisot::local_perspective_used() ? inverse(nisot::local_perspective) * cpush(2, 1) * C0 : cpush(2, 1) * C0; diff --git a/history.cpp b/history.cpp index aaab18a9..a32823ba 100644 --- a/history.cpp +++ b/history.cpp @@ -444,7 +444,7 @@ EX namespace history { xpos += bwidth; } - last_base = viewctr.at->c7; + last_base = viewcenter(); last_relative = inverse(ggmatrix(last_base)) * C0; } } diff --git a/screenshot.cpp b/screenshot.cpp index 2ad11999..dcc72db1 100644 --- a/screenshot.cpp +++ b/screenshot.cpp @@ -524,7 +524,7 @@ void moved() { save_memory(); return; } - setdist(masterless ? centerover.at : viewctr.at->c7, 7 - getDistLimit() - genrange_bonus, NULL); + setdist(viewcenter(), 7 - getDistLimit() - genrange_bonus, NULL); } playermoved = false; } @@ -613,8 +613,8 @@ EX void apply() { cspin(0, GDIM-1, -movement_angle * degree), View); moved(); if(clearup) { - viewctr.at->c7->wall = waNone; - forCellEx(c1, viewctr.at->c7) c1->wall = waNone; + viewcenter()->wall = waNone; + forCellEx(c1, viewcenter()) c1->wall = waNone; } } break; @@ -637,7 +637,7 @@ EX void apply() { moved(); View = cspin(0, GDIM-1, 2 * M_PI * t / period) * View; if(clearup) { - viewctr.at->c7->wall = waNone; + viewcenter()->wall = waNone; } break; diff --git a/textures.cpp b/textures.cpp index ec514453..715fbbb4 100644 --- a/textures.cpp +++ b/textures.cpp @@ -1013,7 +1013,7 @@ bool texture_config::save() { targetgeometry = geometry; targetvariation = variation; - cell *ctr = euclid ? centerover.at : viewctr.at->c7; + cell *ctr = viewcenter(); si_save = patterns::getpatterninfo0(ctr); if(archimedean) csymbol = arcm::current.symbol; @@ -1072,7 +1072,7 @@ bool texture_config::load() { celllister cl(currentmap->gamestart(), 20, 10000, NULL); bool found = false; for(cell *c: cl.lst) if(euclid || ctof(c)) { - cell *ctr = euclid ? centerover.at : viewctr.at->c7; + cell *ctr = viewcenter(); auto si_here = patterns::getpatterninfo0(c); if(si_here.id == si_save.id && si_here.reflect == si_save.reflect && si_here.dir == si_save.dir) { if(euclid) centerover.at = ctr;