1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-08-05 21:33:58 +00:00

adjusted RogueViz

This commit is contained in:
Zeno Rogue 2019-11-14 20:26:07 +01:00
parent 45ba2f0229
commit 9168abd1a7
5 changed files with 24 additions and 25 deletions

View File

@ -207,7 +207,7 @@ int notry = 0;
void bantar() { void bantar() {
if(!on) return; if(!on) return;
cwt = cellwalker(currentmap->gamestart(), 0); cwt = cellwalker(currentmap->gamestart(), 0);
viewctr = heptspin(cwt.at->master, 0); centerover = cwt.at;
infos.clear(); infos.clear();
vector<bantar_config> genchoices; vector<bantar_config> genchoices;

View File

@ -6,7 +6,7 @@ namespace hr {
#if CAP_SHOT #if CAP_SHOT
struct location { struct location {
transmatrix lView; transmatrix lView;
heptspin lviewctr; cell *lco;
}; };
struct lineinfo { struct lineinfo {
@ -19,10 +19,10 @@ map<int, lineinfo> lines;
location loc_multiply(location orig, transmatrix T) { location loc_multiply(location orig, transmatrix T) {
dynamicval<transmatrix> dv(View, orig.lView); dynamicval<transmatrix> dv(View, orig.lView);
dynamicval<heptspin> dc(viewctr, orig.lviewctr); dynamicval<cell*> dc(centerover, orig.lco);
View = inverse(T) * View; View = inverse(T) * View;
for(int a=0; a<10; a++) optimizeview(); for(int a=0; a<10; a++) optimizeview();
return location{View, viewctr}; return location{View, centerover};
} }
bool show_map = false; bool show_map = false;
@ -31,8 +31,8 @@ void cvl_marker() {
if(show_map) for(auto& l: lines) { if(show_map) for(auto& l: lines) {
int id = 0; int id = 0;
for(auto& loc: l.second.locs) { for(auto& loc: l.second.locs) {
if(gmatrix.count(loc.lviewctr.at->c7)) { if(gmatrix.count(loc.lco)) {
transmatrix T = gmatrix[loc.lviewctr.at->c7] * inverse(spin(loc.lviewctr.spin*2*M_PI/S7 + master_to_c7_angle())) * inverse(loc.lView); transmatrix T = gmatrix[loc.lco] * inverse(loc.lView);
queuepoly(T, cgi.shAsymmetric, 0xFF00FFFF); queuepoly(T, cgi.shAsymmetric, 0xFF00FFFF);
queuestr(T, 1.0, its(l.first)+"/"+its(id), 0xFFFFFF); queuestr(T, 1.0, its(l.first)+"/"+its(id), 0xFFFFFF);
} }
@ -54,7 +54,7 @@ int readArgs() {
int id; int id;
lineinfo l0; lineinfo l0;
scan(f, id, l0.plus_matrices, l0.minus_matrices); 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<l0.plus_matrices; i++) for(int i=1; i<l0.plus_matrices; i++)
l0.locs.push_back(loc_multiply(l0.locs.back(), xpush(1))); l0.locs.push_back(loc_multiply(l0.locs.back(), xpush(1)));
lines[id] = std::move(l0); lines[id] = std::move(l0);
@ -70,18 +70,18 @@ int readArgs() {
for(int a=0; a<9; a++) scan(f, T[0][a]); for(int a=0; a<9; a++) scan(f, T[0][a]);
scan(f, l1.plus_matrices, l1.minus_matrices); scan(f, l1.plus_matrices, l1.minus_matrices);
auto old = lines[id].locs[step]; auto old = lines[id].locs[step];
println(hlog, "FROM ", old.lView, old.lviewctr, " id=", id, " step=", step); println(hlog, "FROM ", old.lView, old.lco, " id=", id, " step=", step);
l1.locs.push_back(loc_multiply(old, T)); l1.locs.push_back(loc_multiply(old, T));
println(hlog, "TO ", l1.locs.back().lView, l1.locs.back().lviewctr, "; creating ", l1.plus_matrices); println(hlog, "TO ", l1.locs.back().lView, l1.locs.back().lco, "; creating ", l1.plus_matrices);
for(int i=1; i<l1.plus_matrices; i++) for(int i=1; i<l1.plus_matrices; i++)
l1.locs.push_back(loc_multiply(l1.locs.back(), xpush(1))); l1.locs.push_back(loc_multiply(l1.locs.back(), xpush(1)));
println(hlog, "LAST ", l1.locs.back().lView, l1.locs.back().lviewctr); println(hlog, "LAST ", l1.locs.back().lView, l1.locs.back().lco);
} }
} }
else if(argis("-cvllist")) { else if(argis("-cvllist")) {
for(auto& l: lines) for(auto& l: lines)
for(auto& loc: l.second.locs) { for(auto& loc: l.second.locs) {
println(hlog, l.first, ". ", loc.lviewctr, " (dist=", celldist(loc.lviewctr.at->c7), "), View = ", loc.lView); println(hlog, l.first, ". ", loc.lco, " (dist=", celldist(loc.lco), "), View = ", loc.lView);
} }
} }
else if(argis("-cvlmap")) { else if(argis("-cvlmap")) {
@ -93,7 +93,7 @@ int readArgs() {
int i = 0; int i = 0;
for(auto& loc: p.second.locs) { for(auto& loc: p.second.locs) {
dynamicval<transmatrix> dv(View, loc.lView); dynamicval<transmatrix> dv(View, loc.lView);
dynamicval<heptspin> dc(viewctr, loc.lviewctr); dynamicval<cell*> dc(centerover, loc.lco);
shot::take(format(s.c_str(), p.first, i++)); shot::take(format(s.c_str(), p.first, i++));
} }
} }

View File

@ -237,7 +237,7 @@ namespace flocking {
auto m = vd.m; auto m = vd.m;
// these two functions compute new base and at, based on pats[i] // these two functions compute new base and at, based on pats[i]
m->at = pats[i]; m->at = pats[i];
virtualRebase(m, true); virtualRebase(m);
m->vel = vels[i]; m->vel = vels[i];
} }
shmup::fixStorage(); shmup::fixStorage();
@ -252,7 +252,7 @@ namespace flocking {
if(follow == 1) { if(follow == 1) {
gmatrix.clear(); 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; View = spin(90 * degree) * inverse(vdata[0].m->pat) * View;
if(GDIM == 3) { if(GDIM == 3) {
View = hr::cspin(1, 2, 90 * degree) * View; View = hr::cspin(1, 2, 90 * degree) * View;
@ -274,7 +274,6 @@ namespace flocking {
} }
optimizeview(); optimizeview();
centerover.at = viewctr.at->c7;
compute_graphical_distance(); compute_graphical_distance();
gmatrix.clear(); gmatrix.clear();
playermoved = false; playermoved = false;

View File

@ -376,7 +376,7 @@ struct hrmap_grigorchuk : hrmap_standard {
void draw() override { void draw() override {
dq::visited_by_matrix.clear(); 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()) { while(!dq::drawqueue.empty()) {
auto& p = dq::drawqueue.front(); auto& p = dq::drawqueue.front();

View File

@ -237,7 +237,7 @@ void addedge(int i, int j, edgeinfo *ei) {
addedge(i, id, ei); addedge(i, id, ei);
addedge(id, j, ei); addedge(id, j, ei);
virtualRebase(vdata[i].m, true); virtualRebase(vdata[i].m);
} }
else addedge0(i, j, ei); else addedge0(i, j, ei);
} }
@ -284,7 +284,7 @@ namespace spiral {
createViz(i, cwt.at, h); createViz(i, cwt.at, h);
vd.name = its(i+1); vd.name = its(i+1);
virtualRebase(vd.m, true); virtualRebase(vd.m);
vd.cp = dftcolor; vd.cp = dftcolor;
} }
@ -331,7 +331,7 @@ namespace collatz {
vdata.resize(1); vdata.resize(1);
vertexdata& vd = vdata[0]; vertexdata& vd = vdata[0];
createViz(0, cwt.at, xpush(cshift)); createViz(0, cwt.at, xpush(cshift));
virtualRebase(vd.m, true); virtualRebase(vd.m);
vd.cp = dftcolor; vd.cp = dftcolor;
vd.data = 0; vd.data = 0;
addedge(0, 0, 1, false, collatz::collatz1); addedge(0, 0, 1, false, collatz::collatz1);
@ -466,7 +466,7 @@ namespace anygraph {
printf("Rebasing...\n"); printf("Rebasing...\n");
for(int i=0; i<isize(vdata); i++) { for(int i=0; i<isize(vdata); i++) {
if(i % 10000 == 0) printf("%d/%d\n", i, isize(vdata)); if(i % 10000 == 0) printf("%d/%d\n", i, isize(vdata));
if(vdata[i].m) virtualRebase(vdata[i].m, true); if(vdata[i].m) virtualRebase(vdata[i].m);
} }
printf("Done.\n"); printf("Done.\n");
} }
@ -567,7 +567,7 @@ namespace tree {
for(int i=0; i<isize(vdata); i++) { for(int i=0; i<isize(vdata); i++) {
vertexdata& vd = vdata[i]; vertexdata& vd = vdata[i];
virtualRebase(vd.m, true); virtualRebase(vd.m);
} }
printf("Clearing the TOL data...\n"); printf("Clearing the TOL data...\n");
@ -1383,7 +1383,7 @@ bool drawVertex(const transmatrix &V, cell *c, shmup::monster *m) {
} }
else { else {
cell *center = multidraw ? c : euclid ? cwt.at : viewctr.at->c7; cell *center = multidraw ? c : centerover;
if(!multidraw && ei->orig && ei->orig != center && celldistance(ei->orig, center) > 3) if(!multidraw && ei->orig && ei->orig != center && celldistance(ei->orig, center) > 3)
ei->orig = NULL; ei->orig = NULL;
@ -1469,7 +1469,7 @@ bool drawVertex(const transmatrix &V, cell *c, shmup::monster *m) {
vertexdata& vdn = vdata[i0]; vertexdata& vdn = vdata[i0];
createViz(i0, m->base, m->at * collatz::T2); createViz(i0, m->base, m->at * collatz::T2);
virtualRebase(vdn.m, true); virtualRebase(vdn.m);
vdn.cp = perturb(cp); vdn.cp = perturb(cp);
vdn.data = 0; vdn.data = 0;
addedge(i, i0, 1, false, collatz::collatz1); 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); vdata.resize(i0+2);
vertexdata& vdn = vdata[i0+1]; vertexdata& vdn = vdata[i0+1];
createViz(i0+1, m->base, m->at * collatz::T3); createViz(i0+1, m->base, m->at * collatz::T3);
virtualRebase(vdn.m, true); virtualRebase(vdn.m);
vdn.cp = perturb(cp); vdn.cp = perturb(cp);
vdn.data = 0; vdn.data = 0;
addedge(i, i0+1, 1, false, collatz::collatz2); addedge(i, i0+1, 1, false, collatz::collatz2);
@ -2148,7 +2148,7 @@ template<class T> function<void(presmode)> roguevizslide(char c, const T& t) {
slidecommand = "toggle the player"; slidecommand = "toggle the player";
if(mode == 4) if(mode == 4)
mapeditor::drawplayer = !mapeditor::drawplayer; mapeditor::drawplayer = !mapeditor::drawplayer;
centerover.at = NULL; pd_from = NULL; pd_from = NULL;
}; };
} }