diff --git a/conformal.cpp b/conformal.cpp index c3bc6388..e95cbd22 100644 --- a/conformal.cpp +++ b/conformal.cpp @@ -288,6 +288,8 @@ namespace conformal { bool dospiral = true; ld extra_line_steps = 0; + + vector path_for_lineanimation; void clear() { on = false; @@ -295,31 +297,31 @@ namespace conformal { for(int i=0; iat = Id; m->base = c; v.push_back(m); - if(c == currentmap->gamestart()) break; - for(int i=0; itype; i++) - if(celldist(c->move(i)) < celldist(c)) { - c = c->move(i); - break; - } } - reverse(v.begin(), v.end()); - int Q = isize(v)-1; // virtualRebase(v[0], false); // virtualRebase(v[Q], false); @@ -352,6 +354,14 @@ namespace conformal { llv = ticks; phase = 0; } + + void create_playerpath() { + create(currentmap->gamestart(), cwt.at); + } + + void create_recenter_to_view() { + create(path_for_lineanimation[0], centerover.at ? centerover.at : cwt.at); + } void movetophase() { @@ -448,6 +458,11 @@ namespace conformal { spiral_multiplier = cld(0, 2 * M_PI) / cld(h[0], h[1]); } + if(centerover.at && !on) + if(isize(path_for_lineanimation) == 0 || (quotient && path_for_lineanimation.back() != centerover.at)) { + path_for_lineanimation.push_back(centerover.at); + } + band_shift = 0; } @@ -1026,8 +1041,10 @@ namespace conformal { dialog::addSelItem(XLAT("projection"), current_proj_name(), 'm'); - if(!bounded && !euclid) dialog::addBoolItem(XLAT("prepare the line animation"), (on), 'e'); + dialog::addBoolItem(XLAT("animate from start to current player position"), (on), 'e'); + dialog::addBoolItem(XLAT("animate from last recenter to current view"), (on), 'E'); if(on) dialog::addSelItem(XLAT("animation speed"), fts(lvspeed), 'a'); + else dialog::addBreak(100); dialog::addSelItem(XLAT("extend the ends"), fts(extra_line_steps), 'p'); #if CAP_SDL @@ -1053,7 +1070,7 @@ namespace conformal { void handleKeyC(int sym, int uni) { dialog::handleNavigation(sym, uni); - if(uni == 'e') { + if(uni == 'e' || uni == 'E') { if(on) clear(); else { if(canmove && !cheater) { @@ -1061,7 +1078,8 @@ namespace conformal { return; } if(canmove && cheater) cheater++; - create(); + if(uni == 'E') create_recenter_to_view(); + else create_playerpath(); } } else if(uni == 'o') @@ -1148,7 +1166,7 @@ namespace conformal { bool ih = includeHistory; includeHistory = autobandhistory; pmodel = mdBand; - create(); + create_playerpath(); createImage(dospiral); clear(); pmodel = spm; @@ -1253,6 +1271,7 @@ namespace conformal { conformal::killhistory.clear(); conformal::findhistory.clear(); conformal::movehistory.clear(); + conformal::path_for_lineanimation.clear(); conformal::includeHistory = false; }); diff --git a/hyper.h b/hyper.h index af8e6e83..0f301718 100644 --- a/hyper.h +++ b/hyper.h @@ -1443,7 +1443,9 @@ namespace conformal { extern int bandhalf; extern ld extra_line_steps; - void create(); + void create(cell *start, cell *target); + void create_playerpath(); + void create_recenter_to_view(); void clear(); void model_menu(); void history_menu(); diff --git a/hypgraph.cpp b/hypgraph.cpp index 623cbab5..e25e9446 100644 --- a/hypgraph.cpp +++ b/hypgraph.cpp @@ -1237,6 +1237,7 @@ void panning(hyperpoint hf, hyperpoint ht) { int cells_drawn; void fullcenter() { + conformal::path_for_lineanimation.clear(); if(playerfound && false) centerpc(INF); else { bfs(); diff --git a/quit.cpp b/quit.cpp index 885f145e..af4207ed 100644 --- a/quit.cpp +++ b/quit.cpp @@ -216,7 +216,7 @@ hint hints[] = { bool h = conformal::includeHistory; conformal::rotation = 0; conformal::includeHistory = true; - conformal::create(); + conformal::create_playerpath(); cancel = [m,r,h] () { conformal::clear(); pmodel = m; conformal::rotation = r; diff --git a/tour.cpp b/tour.cpp index 22c87660..c0d61fa2 100644 --- a/tour.cpp +++ b/tour.cpp @@ -735,7 +735,7 @@ slide default_slides[] = { "memory.", [] (presmode mode) { static int smart; - if(mode == 1) pmodel = mdBand, conformal::create(), conformal::rotation = 0, + if(mode == 1) pmodel = mdBand, conformal::create_playerpath(), conformal::rotation = 0, smart = vid.use_smart_range, vid.use_smart_range = 2; if(mode == 3) { conformal::clear(), pmodel = mdDisk; @@ -748,7 +748,7 @@ slide default_slides[] = { #if CAP_SDL slidecommand = "render spiral"; if(mode == 4) conformal::createImage(true); - if(mode == 11) conformal::create(); + if(mode == 11) conformal::create_playerpath(); if(mode == 13) conformal::clear(); #endif }