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

using viewcenter() consistently

This commit is contained in:
Zeno Rogue 2019-08-17 23:29:11 +02:00
parent 6958cbcbd9
commit 95da7ff09e
5 changed files with 13 additions and 13 deletions

View File

@ -163,7 +163,7 @@ EX transmatrix &ggmatrix(cell *c) {
t = View * eumove(cell_to_vec(c) - cellwalker_to_vec(centerover)); t = View * eumove(cell_to_vec(c) - cellwalker_to_vec(centerover));
} }
else 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; return t;
} }

View File

@ -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(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; transmatrix Vit = V;
if(GDIM == 3 && WDIM == 2 && c && it != itBabyTortoise) Vit = mscale(V, cgi.STUFF); 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; a<c->type; a++) for(int a=0; a<c->type; a++)
if(c->move(a) && !isWall3(c->move(a), dummy)) { if(c->move(a) && !isWall3(c->move(a), dummy)) {
if(pmodel == mdPerspective && !sphere && !quotient && !penrose && !nonisotropic) { if(pmodel == mdPerspective && !sphere && !quotient && !penrose && !nonisotropic) {
if(a < 4 && among(geometry, gHoroTris, gBinary3) && 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(viewctr.at->c7)) 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(c->move(a)->master->distance > c->master->distance && c->master->distance > viewctr.at->distance && !quotient) continue;
} }
else if(sol && in_perspective()) { else if(sol && in_perspective()) {
@ -7149,7 +7149,7 @@ EX void make_actual_view() {
if(GDIM == 3) { if(GDIM == 3) {
ld max = WDIM == 2 ? vid.camera : vid.yshift; ld max = WDIM == 2 ? vid.camera : vid.yshift;
if(max) 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]); camera_level = asin_auto(tC0(inverse(actual_view_transform * View))[2]);
} }
if(nonisotropic) { if(nonisotropic) {
@ -7185,7 +7185,7 @@ EX transmatrix cview() {
EX void precise_mouseover() { EX void precise_mouseover() {
if(WDIM == 3) { if(WDIM == 3) {
mouseover2 = mouseover = viewctr.at->c7; mouseover2 = mouseover = viewcenter();
ld best = HUGE_VAL; ld best = HUGE_VAL;
hyperpoint h = hyperpoint h =
nisot::local_perspective_used() ? inverse(nisot::local_perspective) * cpush(2, 1) * C0 : cpush(2, 1) * C0; nisot::local_perspective_used() ? inverse(nisot::local_perspective) * cpush(2, 1) * C0 : cpush(2, 1) * C0;

View File

@ -444,7 +444,7 @@ EX namespace history {
xpos += bwidth; xpos += bwidth;
} }
last_base = viewctr.at->c7; last_base = viewcenter();
last_relative = inverse(ggmatrix(last_base)) * C0; last_relative = inverse(ggmatrix(last_base)) * C0;
} }
} }

View File

@ -524,7 +524,7 @@ void moved() {
save_memory(); save_memory();
return; return;
} }
setdist(masterless ? centerover.at : viewctr.at->c7, 7 - getDistLimit() - genrange_bonus, NULL); setdist(viewcenter(), 7 - getDistLimit() - genrange_bonus, NULL);
} }
playermoved = false; playermoved = false;
} }
@ -613,8 +613,8 @@ EX void apply() {
cspin(0, GDIM-1, -movement_angle * degree), View); cspin(0, GDIM-1, -movement_angle * degree), View);
moved(); moved();
if(clearup) { if(clearup) {
viewctr.at->c7->wall = waNone; viewcenter()->wall = waNone;
forCellEx(c1, viewctr.at->c7) c1->wall = waNone; forCellEx(c1, viewcenter()) c1->wall = waNone;
} }
} }
break; break;
@ -637,7 +637,7 @@ EX void apply() {
moved(); moved();
View = cspin(0, GDIM-1, 2 * M_PI * t / period) * View; View = cspin(0, GDIM-1, 2 * M_PI * t / period) * View;
if(clearup) { if(clearup) {
viewctr.at->c7->wall = waNone; viewcenter()->wall = waNone;
} }
break; break;

View File

@ -1013,7 +1013,7 @@ bool texture_config::save() {
targetgeometry = geometry; targetgeometry = geometry;
targetvariation = variation; targetvariation = variation;
cell *ctr = euclid ? centerover.at : viewctr.at->c7; cell *ctr = viewcenter();
si_save = patterns::getpatterninfo0(ctr); si_save = patterns::getpatterninfo0(ctr);
if(archimedean) csymbol = arcm::current.symbol; if(archimedean) csymbol = arcm::current.symbol;
@ -1072,7 +1072,7 @@ bool texture_config::load() {
celllister cl(currentmap->gamestart(), 20, 10000, NULL); celllister cl(currentmap->gamestart(), 20, 10000, NULL);
bool found = false; bool found = false;
for(cell *c: cl.lst) if(euclid || ctof(c)) { 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); 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(si_here.id == si_save.id && si_here.reflect == si_save.reflect && si_here.dir == si_save.dir) {
if(euclid) centerover.at = ctr; if(euclid) centerover.at = ctr;