From 8182a206b9d098fe8bd450a870312270ffe7097d Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Fri, 3 Nov 2017 20:55:18 +0100 Subject: [PATCH] cubic Windy Plains --- control.cpp | 2 +- hypgraph.cpp | 29 ++++++++++++++++++++++------- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/control.cpp b/control.cpp index 4cab0ff3..361d489e 100644 --- a/control.cpp +++ b/control.cpp @@ -345,7 +345,7 @@ void handleKeyNormal(int sym, int uni) { if((sym == SDLK_DELETE || sym == SDLK_KP_PERIOD || sym == 'g') && uni != 'G' && uni != 'G'-64) movepcto(MD_DROP, 1); if(sym == 't' && uni != 'T' && uni != 'T'-64 && canmove) { - if(playermoved && items[itStrongWind]) { + if(playermoved && items[itStrongWind]) { cell *c = whirlwind::jumpDestination(cwt.c); if(c) centerover = c; } diff --git a/hypgraph.cpp b/hypgraph.cpp index 192ad701..f4f84283 100644 --- a/hypgraph.cpp +++ b/hypgraph.cpp @@ -402,10 +402,16 @@ void drawEuclidean() { pid = decodeId(centerover->master); else decodeMaster(centerover->master, px, py); - + int minsx = mindx-1, maxsx=maxdx+1, minsy=mindy-1, maxsy=maxdy+1; 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 dy=minsy; dy<=maxsy; dy++) { reclevel = eudist(dx, dy); @@ -423,7 +429,13 @@ void drawEuclidean() { Mat = eumove(x, y); } 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[1][1] = -1; @@ -440,10 +452,10 @@ void drawEuclidean() { if(dx > maxdx) maxdx = dx; if(dy > maxdy) maxdy = dy; } - - if(dodrawcell(c)) { - drawcell(c, Mat, 0, false); - } + if(cx >= -cellrad && cy >= -cellrad && cx < vid.xres+cellrad && cy < vid.yres+cellrad) + if(dodrawcell(c)) { + drawcell(c, Mat, 0, false); + } } } @@ -457,7 +469,9 @@ void centerpc(ld aspd) { if(vid.sspeed >= 4.99) aspd = 1000; DEBB(DF_GRAPH, (debugfile,"center pc\n")); 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]); if(R < 1e-9) { /* if(playerfoundL && playerfoundR) { @@ -475,6 +489,7 @@ void centerpc(ld aspd) { View[0][2] -= cwtV[0][2] * aspd / R; View[1][2] -= cwtV[1][2] * aspd / R; + } else {