mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-27 14:37:16 +00:00
cubic Windy Plains
This commit is contained in:
parent
f1115c4a0a
commit
8182a206b9
21
hypgraph.cpp
21
hypgraph.cpp
@ -406,6 +406,12 @@ void drawEuclidean() {
|
|||||||
int minsx = mindx-1, maxsx=maxdx+1, minsy=mindy-1, maxsy=maxdy+1;
|
int minsx = mindx-1, maxsx=maxdx+1, minsy=mindy-1, maxsy=maxdy+1;
|
||||||
mindx=maxdx=mindy=maxdy=0;
|
mindx=maxdx=mindy=maxdy=0;
|
||||||
|
|
||||||
|
static ld centerd;
|
||||||
|
|
||||||
|
transmatrix View0 = View;
|
||||||
|
|
||||||
|
ld cellrad = vid.radius / (EUCSCALE + vid.alphax);
|
||||||
|
|
||||||
for(int dx=minsx; dx<=maxsx; dx++)
|
for(int dx=minsx; dx<=maxsx; dx++)
|
||||||
for(int dy=minsy; dy<=maxsy; dy++) {
|
for(int dy=minsy; dy<=maxsy; dy++) {
|
||||||
reclevel = eudist(dx, dy);
|
reclevel = eudist(dx, dy);
|
||||||
@ -423,7 +429,13 @@ void drawEuclidean() {
|
|||||||
Mat = eumove(x, y);
|
Mat = eumove(x, y);
|
||||||
}
|
}
|
||||||
if(!c) continue;
|
if(!c) continue;
|
||||||
Mat = View * Mat;
|
Mat = View0 * Mat;
|
||||||
|
|
||||||
|
if(torus) {
|
||||||
|
ld locald = (Mat[0][2] * Mat[0][2] + Mat[1][2] * Mat[1][2]);
|
||||||
|
if(c == centerover) centerd = locald;
|
||||||
|
else if(locald < centerd) centerd = locald, centerover = c, View = View0 * eumove(dx, dy);
|
||||||
|
}
|
||||||
|
|
||||||
// Mat[0][0] = -1;
|
// Mat[0][0] = -1;
|
||||||
// Mat[1][1] = -1;
|
// Mat[1][1] = -1;
|
||||||
@ -440,7 +452,7 @@ void drawEuclidean() {
|
|||||||
if(dx > maxdx) maxdx = dx;
|
if(dx > maxdx) maxdx = dx;
|
||||||
if(dy > maxdy) maxdy = dy;
|
if(dy > maxdy) maxdy = dy;
|
||||||
}
|
}
|
||||||
|
if(cx >= -cellrad && cy >= -cellrad && cx < vid.xres+cellrad && cy < vid.yres+cellrad)
|
||||||
if(dodrawcell(c)) {
|
if(dodrawcell(c)) {
|
||||||
drawcell(c, Mat, 0, false);
|
drawcell(c, Mat, 0, false);
|
||||||
}
|
}
|
||||||
@ -457,7 +469,9 @@ void centerpc(ld aspd) {
|
|||||||
if(vid.sspeed >= 4.99) aspd = 1000;
|
if(vid.sspeed >= 4.99) aspd = 1000;
|
||||||
DEBB(DF_GRAPH, (debugfile,"center pc\n"));
|
DEBB(DF_GRAPH, (debugfile,"center pc\n"));
|
||||||
hyperpoint H = ypush(-vid.yshift) * sphereflip * tC0(cwtV);
|
hyperpoint H = ypush(-vid.yshift) * sphereflip * tC0(cwtV);
|
||||||
if(H[0] == 0 && H[1] == 0) return; // either already centered or direction unknown
|
if(H[0] == 0 && H[1] == 0) {
|
||||||
|
return; // either already centered or direction unknown
|
||||||
|
}
|
||||||
ld R = hdist0(H); // = sqrt(H[0] * H[0] + H[1] * H[1]);
|
ld R = hdist0(H); // = sqrt(H[0] * H[0] + H[1] * H[1]);
|
||||||
if(R < 1e-9) {
|
if(R < 1e-9) {
|
||||||
/* if(playerfoundL && playerfoundR) {
|
/* if(playerfoundL && playerfoundR) {
|
||||||
@ -475,6 +489,7 @@ void centerpc(ld aspd) {
|
|||||||
|
|
||||||
View[0][2] -= cwtV[0][2] * aspd / R;
|
View[0][2] -= cwtV[0][2] * aspd / R;
|
||||||
View[1][2] -= cwtV[1][2] * aspd / R;
|
View[1][2] -= cwtV[1][2] * aspd / R;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
|
Loading…
Reference in New Issue
Block a user