mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-23 21:07:17 +00:00
nilrider:: loaded_or_planned flag
This commit is contained in:
parent
b0587572ae
commit
0dace6f3c2
@ -21,6 +21,7 @@ ld aimspeed_key_x = 1, aimspeed_key_y = 1, aimspeed_mouse_x = 1, aimspeed_mouse_
|
||||
vector<string> move_names = { "camera down", "move left", "camera up", "move right", "fine control", "pause", "reverse time", "view simulation", "menu" };
|
||||
|
||||
int reversals = 0;
|
||||
bool loaded_or_planned = false;
|
||||
|
||||
void frame() {
|
||||
if(planning_mode && !view_replay) return;
|
||||
@ -74,6 +75,7 @@ bool turn(int delta) {
|
||||
}
|
||||
else {
|
||||
reversals = 0;
|
||||
loaded_or_planned = false;
|
||||
timer = 0;
|
||||
}
|
||||
}
|
||||
@ -187,6 +189,16 @@ void run() {
|
||||
};
|
||||
}
|
||||
|
||||
void clear_path(level *l) {
|
||||
l->history.clear();
|
||||
l->current = l->start;
|
||||
l->history.push_back(l->start);
|
||||
timer = 0;
|
||||
paused = false;
|
||||
reversals = 0;
|
||||
loaded_or_planned = false;
|
||||
}
|
||||
|
||||
void pick_level() {
|
||||
clearMessages();
|
||||
dialog::init(XLAT("select the track"), 0xC0C0FFFF, 150, 100);
|
||||
@ -196,6 +208,7 @@ void pick_level() {
|
||||
curlev = l;
|
||||
recompute_plan_transform = true;
|
||||
l->init();
|
||||
clear_path(l);
|
||||
popScreen();
|
||||
});
|
||||
}
|
||||
@ -292,6 +305,7 @@ void replays() {
|
||||
curlev->history.clear();
|
||||
auto& current = curlev->current;
|
||||
current = curlev->start;
|
||||
loaded_or_planned = true;
|
||||
for(auto h: r.headings) {
|
||||
current.heading_angle = int_to_heading(h);
|
||||
curlev->history.push_back(current);
|
||||
@ -329,9 +343,7 @@ void main_menu() {
|
||||
if(!planning_mode) {
|
||||
dialog::addItem("restart", 'r');
|
||||
dialog::add_action([] {
|
||||
curlev->current = curlev->start;
|
||||
timer = 0;
|
||||
paused = false;
|
||||
clear_path(curlev);
|
||||
popScreen();
|
||||
});
|
||||
|
||||
|
@ -197,5 +197,6 @@ extern map<char, array<string, 16> > submaps;
|
||||
hyperpoint sym_to_heis(hyperpoint H);
|
||||
|
||||
extern int reversals;
|
||||
extern bool loaded_or_planned;
|
||||
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ namespace nilrider {
|
||||
hyperpoint get_spline(ld t);
|
||||
|
||||
bool level::simulate() {
|
||||
loaded_or_planned = true;
|
||||
if(history.empty())
|
||||
history.push_back(start);
|
||||
auto at = history.back();
|
||||
|
@ -324,7 +324,9 @@ void timestamp::draw_instruments(level* l, ld t) {
|
||||
string s = format("%d:%02d.%02d", int(t / 60), int(t) % 60, int(frac(t) * 100));
|
||||
displaystr(vid.xres - vid.fsize, vid.fsize*2, 0, vid.fsize * 2, s, 0, 16);
|
||||
|
||||
if(reversals) s = format("+%d", reversals);
|
||||
if(loaded_or_planned) s = "R";
|
||||
else if(reversals) s = format("+%d", reversals);
|
||||
else return;
|
||||
displaystr(vid.xres - vid.fsize, vid.fsize*4, 0, vid.fsize, s, 0, 16);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user