From 9168abd1a788d1c646e500a8922292f8ae7db62a Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Thu, 14 Nov 2019 20:26:07 +0100 Subject: [PATCH] adjusted RogueViz --- rogueviz/banachtarski.cpp | 2 +- rogueviz/cvl.cpp | 22 +++++++++++----------- rogueviz/flocking.cpp | 5 ++--- rogueviz/grigorchuk.cpp | 2 +- rogueviz/rogueviz.cpp | 18 +++++++++--------- 5 files changed, 24 insertions(+), 25 deletions(-) diff --git a/rogueviz/banachtarski.cpp b/rogueviz/banachtarski.cpp index 3d614177..76e33eff 100644 --- a/rogueviz/banachtarski.cpp +++ b/rogueviz/banachtarski.cpp @@ -207,7 +207,7 @@ int notry = 0; void bantar() { if(!on) return; cwt = cellwalker(currentmap->gamestart(), 0); - viewctr = heptspin(cwt.at->master, 0); + centerover = cwt.at; infos.clear(); vector genchoices; diff --git a/rogueviz/cvl.cpp b/rogueviz/cvl.cpp index 98aa69e8..d62b3e7e 100644 --- a/rogueviz/cvl.cpp +++ b/rogueviz/cvl.cpp @@ -6,7 +6,7 @@ namespace hr { #if CAP_SHOT struct location { transmatrix lView; - heptspin lviewctr; + cell *lco; }; struct lineinfo { @@ -19,10 +19,10 @@ map lines; location loc_multiply(location orig, transmatrix T) { dynamicval dv(View, orig.lView); - dynamicval dc(viewctr, orig.lviewctr); + dynamicval dc(centerover, orig.lco); View = inverse(T) * View; for(int a=0; a<10; a++) optimizeview(); - return location{View, viewctr}; + return location{View, centerover}; } bool show_map = false; @@ -31,8 +31,8 @@ void cvl_marker() { if(show_map) for(auto& l: lines) { int id = 0; for(auto& loc: l.second.locs) { - if(gmatrix.count(loc.lviewctr.at->c7)) { - transmatrix T = gmatrix[loc.lviewctr.at->c7] * inverse(spin(loc.lviewctr.spin*2*M_PI/S7 + master_to_c7_angle())) * inverse(loc.lView); + if(gmatrix.count(loc.lco)) { + transmatrix T = gmatrix[loc.lco] * inverse(loc.lView); queuepoly(T, cgi.shAsymmetric, 0xFF00FFFF); queuestr(T, 1.0, its(l.first)+"/"+its(id), 0xFFFFFF); } @@ -54,7 +54,7 @@ int readArgs() { int id; lineinfo l0; scan(f, id, l0.plus_matrices, l0.minus_matrices); - l0.locs.push_back(location{View, viewctr}); + l0.locs.push_back(location{View, centerover}); for(int i=1; i dv(View, loc.lView); - dynamicval dc(viewctr, loc.lviewctr); + dynamicval dc(centerover, loc.lco); shot::take(format(s.c_str(), p.first, i++)); } } diff --git a/rogueviz/flocking.cpp b/rogueviz/flocking.cpp index 12866b9c..79f236e8 100644 --- a/rogueviz/flocking.cpp +++ b/rogueviz/flocking.cpp @@ -237,7 +237,7 @@ namespace flocking { auto m = vd.m; // these two functions compute new base and at, based on pats[i] m->at = pats[i]; - virtualRebase(m, true); + virtualRebase(m); m->vel = vels[i]; } shmup::fixStorage(); @@ -252,7 +252,7 @@ namespace flocking { if(follow == 1) { gmatrix.clear(); - vdata[0].m->pat = View * calc_relative_matrix(vdata[0].m->base, viewctr.at->c7, C0) * vdata[0].m->at; + vdata[0].m->pat = View * calc_relative_matrix(vdata[0].m->base, centerover, C0) * vdata[0].m->at; View = spin(90 * degree) * inverse(vdata[0].m->pat) * View; if(GDIM == 3) { View = hr::cspin(1, 2, 90 * degree) * View; @@ -274,7 +274,6 @@ namespace flocking { } optimizeview(); - centerover.at = viewctr.at->c7; compute_graphical_distance(); gmatrix.clear(); playermoved = false; diff --git a/rogueviz/grigorchuk.cpp b/rogueviz/grigorchuk.cpp index eb4db9a7..4463f167 100644 --- a/rogueviz/grigorchuk.cpp +++ b/rogueviz/grigorchuk.cpp @@ -376,7 +376,7 @@ struct hrmap_grigorchuk : hrmap_standard { void draw() override { dq::visited_by_matrix.clear(); - dq::enqueue_by_matrix(viewctr.at, actualV(viewctr, cview())); + dq::enqueue_by_matrix(centerover->master, cview() * master_relative(centerover, true)); while(!dq::drawqueue.empty()) { auto& p = dq::drawqueue.front(); diff --git a/rogueviz/rogueviz.cpp b/rogueviz/rogueviz.cpp index 5bb645c5..31db71cd 100644 --- a/rogueviz/rogueviz.cpp +++ b/rogueviz/rogueviz.cpp @@ -237,7 +237,7 @@ void addedge(int i, int j, edgeinfo *ei) { addedge(i, id, ei); addedge(id, j, ei); - virtualRebase(vdata[i].m, true); + virtualRebase(vdata[i].m); } else addedge0(i, j, ei); } @@ -284,7 +284,7 @@ namespace spiral { createViz(i, cwt.at, h); vd.name = its(i+1); - virtualRebase(vd.m, true); + virtualRebase(vd.m); vd.cp = dftcolor; } @@ -331,7 +331,7 @@ namespace collatz { vdata.resize(1); vertexdata& vd = vdata[0]; createViz(0, cwt.at, xpush(cshift)); - virtualRebase(vd.m, true); + virtualRebase(vd.m); vd.cp = dftcolor; vd.data = 0; addedge(0, 0, 1, false, collatz::collatz1); @@ -466,7 +466,7 @@ namespace anygraph { printf("Rebasing...\n"); for(int i=0; ic7; + cell *center = multidraw ? c : centerover; if(!multidraw && ei->orig && ei->orig != center && celldistance(ei->orig, center) > 3) ei->orig = NULL; @@ -1469,7 +1469,7 @@ bool drawVertex(const transmatrix &V, cell *c, shmup::monster *m) { vertexdata& vdn = vdata[i0]; createViz(i0, m->base, m->at * collatz::T2); - virtualRebase(vdn.m, true); + virtualRebase(vdn.m); vdn.cp = perturb(cp); vdn.data = 0; addedge(i, i0, 1, false, collatz::collatz1); @@ -1492,7 +1492,7 @@ bool drawVertex(const transmatrix &V, cell *c, shmup::monster *m) { vdata.resize(i0+2); vertexdata& vdn = vdata[i0+1]; createViz(i0+1, m->base, m->at * collatz::T3); - virtualRebase(vdn.m, true); + virtualRebase(vdn.m); vdn.cp = perturb(cp); vdn.data = 0; addedge(i, i0+1, 1, false, collatz::collatz2); @@ -2148,7 +2148,7 @@ template function roguevizslide(char c, const T& t) { slidecommand = "toggle the player"; if(mode == 4) mapeditor::drawplayer = !mapeditor::drawplayer; - centerover.at = NULL; pd_from = NULL; + pd_from = NULL; }; }