mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-25 09:30:35 +00:00
more options in line animation
This commit is contained in:
parent
44495852ad
commit
4284831069
@ -289,6 +289,8 @@ namespace conformal {
|
|||||||
|
|
||||||
ld extra_line_steps = 0;
|
ld extra_line_steps = 0;
|
||||||
|
|
||||||
|
vector<cell*> path_for_lineanimation;
|
||||||
|
|
||||||
void clear() {
|
void clear() {
|
||||||
on = false;
|
on = false;
|
||||||
int N = isize(v);
|
int N = isize(v);
|
||||||
@ -296,30 +298,30 @@ namespace conformal {
|
|||||||
v.resize(0);
|
v.resize(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void create() {
|
void create(cell *start, cell *target) {
|
||||||
if(celldist(cwt.at) == 0) {
|
|
||||||
|
if(target == start) {
|
||||||
addMessage("Must go a distance from the starting point");
|
addMessage("Must go a distance from the starting point");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
on = true;
|
on = true;
|
||||||
cell *c = cwt.at;
|
|
||||||
|
|
||||||
while(true) {
|
if(!quotient) try {
|
||||||
|
path_for_lineanimation = build_shortest_path(start, target);
|
||||||
|
}
|
||||||
|
catch(hr_shortest_path_exception&) {
|
||||||
|
addMessage("Error: could not build a path");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(cell *c: path_for_lineanimation) {
|
||||||
shmup::monster *m = new shmup::monster;
|
shmup::monster *m = new shmup::monster;
|
||||||
m->at = Id;
|
m->at = Id;
|
||||||
m->base = c;
|
m->base = c;
|
||||||
v.push_back(m);
|
v.push_back(m);
|
||||||
if(c == currentmap->gamestart()) break;
|
|
||||||
for(int i=0; i<c->type; i++)
|
|
||||||
if(celldist(c->move(i)) < celldist(c)) {
|
|
||||||
c = c->move(i);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
reverse(v.begin(), v.end());
|
|
||||||
|
|
||||||
int Q = isize(v)-1;
|
int Q = isize(v)-1;
|
||||||
// virtualRebase(v[0], false);
|
// virtualRebase(v[0], false);
|
||||||
// virtualRebase(v[Q], false);
|
// virtualRebase(v[Q], false);
|
||||||
@ -353,6 +355,14 @@ namespace conformal {
|
|||||||
phase = 0;
|
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() {
|
void movetophase() {
|
||||||
|
|
||||||
int ph = int(phase);
|
int ph = int(phase);
|
||||||
@ -448,6 +458,11 @@ namespace conformal {
|
|||||||
spiral_multiplier = cld(0, 2 * M_PI) / cld(h[0], h[1]);
|
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;
|
band_shift = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1026,8 +1041,10 @@ namespace conformal {
|
|||||||
|
|
||||||
dialog::addSelItem(XLAT("projection"), current_proj_name(), 'm');
|
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');
|
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');
|
dialog::addSelItem(XLAT("extend the ends"), fts(extra_line_steps), 'p');
|
||||||
|
|
||||||
#if CAP_SDL
|
#if CAP_SDL
|
||||||
@ -1053,7 +1070,7 @@ namespace conformal {
|
|||||||
void handleKeyC(int sym, int uni) {
|
void handleKeyC(int sym, int uni) {
|
||||||
dialog::handleNavigation(sym, uni);
|
dialog::handleNavigation(sym, uni);
|
||||||
|
|
||||||
if(uni == 'e') {
|
if(uni == 'e' || uni == 'E') {
|
||||||
if(on) clear();
|
if(on) clear();
|
||||||
else {
|
else {
|
||||||
if(canmove && !cheater) {
|
if(canmove && !cheater) {
|
||||||
@ -1061,7 +1078,8 @@ namespace conformal {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(canmove && cheater) cheater++;
|
if(canmove && cheater) cheater++;
|
||||||
create();
|
if(uni == 'E') create_recenter_to_view();
|
||||||
|
else create_playerpath();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(uni == 'o')
|
else if(uni == 'o')
|
||||||
@ -1148,7 +1166,7 @@ namespace conformal {
|
|||||||
bool ih = includeHistory;
|
bool ih = includeHistory;
|
||||||
includeHistory = autobandhistory;
|
includeHistory = autobandhistory;
|
||||||
pmodel = mdBand;
|
pmodel = mdBand;
|
||||||
create();
|
create_playerpath();
|
||||||
createImage(dospiral);
|
createImage(dospiral);
|
||||||
clear();
|
clear();
|
||||||
pmodel = spm;
|
pmodel = spm;
|
||||||
@ -1253,6 +1271,7 @@ namespace conformal {
|
|||||||
conformal::killhistory.clear();
|
conformal::killhistory.clear();
|
||||||
conformal::findhistory.clear();
|
conformal::findhistory.clear();
|
||||||
conformal::movehistory.clear();
|
conformal::movehistory.clear();
|
||||||
|
conformal::path_for_lineanimation.clear();
|
||||||
conformal::includeHistory = false;
|
conformal::includeHistory = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
4
hyper.h
4
hyper.h
@ -1443,7 +1443,9 @@ namespace conformal {
|
|||||||
extern int bandhalf;
|
extern int bandhalf;
|
||||||
extern ld extra_line_steps;
|
extern ld extra_line_steps;
|
||||||
|
|
||||||
void create();
|
void create(cell *start, cell *target);
|
||||||
|
void create_playerpath();
|
||||||
|
void create_recenter_to_view();
|
||||||
void clear();
|
void clear();
|
||||||
void model_menu();
|
void model_menu();
|
||||||
void history_menu();
|
void history_menu();
|
||||||
|
@ -1237,6 +1237,7 @@ void panning(hyperpoint hf, hyperpoint ht) {
|
|||||||
int cells_drawn;
|
int cells_drawn;
|
||||||
|
|
||||||
void fullcenter() {
|
void fullcenter() {
|
||||||
|
conformal::path_for_lineanimation.clear();
|
||||||
if(playerfound && false) centerpc(INF);
|
if(playerfound && false) centerpc(INF);
|
||||||
else {
|
else {
|
||||||
bfs();
|
bfs();
|
||||||
|
2
quit.cpp
2
quit.cpp
@ -216,7 +216,7 @@ hint hints[] = {
|
|||||||
bool h = conformal::includeHistory;
|
bool h = conformal::includeHistory;
|
||||||
conformal::rotation = 0;
|
conformal::rotation = 0;
|
||||||
conformal::includeHistory = true;
|
conformal::includeHistory = true;
|
||||||
conformal::create();
|
conformal::create_playerpath();
|
||||||
cancel = [m,r,h] () {
|
cancel = [m,r,h] () {
|
||||||
conformal::clear(); pmodel = m;
|
conformal::clear(); pmodel = m;
|
||||||
conformal::rotation = r;
|
conformal::rotation = r;
|
||||||
|
4
tour.cpp
4
tour.cpp
@ -735,7 +735,7 @@ slide default_slides[] = {
|
|||||||
"memory.",
|
"memory.",
|
||||||
[] (presmode mode) {
|
[] (presmode mode) {
|
||||||
static int smart;
|
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;
|
smart = vid.use_smart_range, vid.use_smart_range = 2;
|
||||||
if(mode == 3) {
|
if(mode == 3) {
|
||||||
conformal::clear(), pmodel = mdDisk;
|
conformal::clear(), pmodel = mdDisk;
|
||||||
@ -748,7 +748,7 @@ slide default_slides[] = {
|
|||||||
#if CAP_SDL
|
#if CAP_SDL
|
||||||
slidecommand = "render spiral";
|
slidecommand = "render spiral";
|
||||||
if(mode == 4) conformal::createImage(true);
|
if(mode == 4) conformal::createImage(true);
|
||||||
if(mode == 11) conformal::create();
|
if(mode == 11) conformal::create_playerpath();
|
||||||
if(mode == 13) conformal::clear();
|
if(mode == 13) conformal::clear();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user