1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-23 21:07:17 +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() {
if(!on) return;
cwt = cellwalker(currentmap->gamestart(), 0);
viewctr = heptspin(cwt.at->master, 0);
centerover = cwt.at;
infos.clear();
vector<bantar_config> genchoices;

View File

@ -6,7 +6,7 @@ namespace hr {
#if CAP_SHOT
struct location {
transmatrix lView;
heptspin lviewctr;
cell *lco;
};
struct lineinfo {
@ -19,10 +19,10 @@ map<int, lineinfo> lines;
location loc_multiply(location orig, transmatrix T) {
dynamicval<transmatrix> dv(View, orig.lView);
dynamicval<heptspin> dc(viewctr, orig.lviewctr);
dynamicval<cell*> 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<l0.plus_matrices; i++)
l0.locs.push_back(loc_multiply(l0.locs.back(), xpush(1)));
lines[id] = std::move(l0);
@ -70,18 +70,18 @@ int readArgs() {
for(int a=0; a<9; a++) scan(f, T[0][a]);
scan(f, l1.plus_matrices, l1.minus_matrices);
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));
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++)
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")) {
for(auto& l: lines)
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")) {
@ -93,7 +93,7 @@ int readArgs() {
int i = 0;
for(auto& loc: p.second.locs) {
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++));
}
}

View File

@ -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;

View File

@ -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();

View File

@ -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; i<isize(vdata); i++) {
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");
}
@ -567,7 +567,7 @@ namespace tree {
for(int i=0; i<isize(vdata); i++) {
vertexdata& vd = vdata[i];
virtualRebase(vd.m, true);
virtualRebase(vd.m);
}
printf("Clearing the TOL data...\n");
@ -1383,7 +1383,7 @@ bool drawVertex(const transmatrix &V, cell *c, shmup::monster *m) {
}
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)
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<class T> function<void(presmode)> 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;
};
}