1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-24 17:10:36 +00:00

nilrider:: ghost repeat period

This commit is contained in:
Zeno Rogue 2024-08-20 13:58:11 +02:00
parent 890a3540f5
commit 630bbe3945
2 changed files with 21 additions and 6 deletions

View File

@ -66,13 +66,19 @@ void frame() {
for(auto g: curlev->ghosts) { for(auto g: curlev->ghosts) {
ld t = curlev->current.timer; ld t = curlev->current.timer;
int a = 0, b = isize(g.history); ld maxt = g.history.back().timer;
while(a != b) { auto gr = ghost_repeat;
int s = (a + b) / 2; if(gr <= 0) gr = 1e6;
if(g.history[s].timer < t) a = s + 1; t -= floor(t / gr) * gr;
else b = s; for(; t < maxt; t += gr) {
int a = 0, b = isize(g.history);
while(a != b) {
int s = (a + b) / 2;
if(g.history[s].timer < t) a = s + 1;
else b = s;
}
if(b < isize(g.history)) g.history[b].draw_unilcycle(V, g.cs);
} }
if(b < isize(g.history)) g.history[b].draw_unilcycle(V, g.cs);
} }
} }
@ -412,6 +418,7 @@ void settings() {
add_edit(min_gfx_slope); add_edit(min_gfx_slope);
add_edit(stepped_display); add_edit(stepped_display);
add_edit(simulation_speed); add_edit(simulation_speed);
add_edit(ghost_repeat);
dialog::addBreak(100); dialog::addBreak(100);
add_edit(my_scheme.wheel1); add_edit(my_scheme.wheel1);
add_edit(my_scheme.wheel2); add_edit(my_scheme.wheel2);
@ -698,6 +705,11 @@ void initialize() {
"If you want to go faster, make this higher.", 'z') "If you want to go faster, make this higher.", 'z')
-> set_sets([] { dialog::bound_low(0); dialog::scaleLog(); }); -> set_sets([] { dialog::bound_low(0); dialog::scaleLog(); });
param_f(ghost_repeat, "ghost_repeat")
-> editable(0.01, 999, 0, "ghost repeat period",
"will repeat ghosts every time interval (in seconds).", 'z')
-> set_sets([] { dialog::bound_low(0.01); dialog::scaleLog(); });
param_color(my_scheme.wheel1, "color:wheel1", true, my_scheme.wheel1)->editable("wheel color 1", "", 'w'); param_color(my_scheme.wheel1, "color:wheel1", true, my_scheme.wheel1)->editable("wheel color 1", "", 'w');
param_color(my_scheme.wheel2, "color:wheel2", true, my_scheme.wheel2)->editable("wheel color 2", "", 'x'); param_color(my_scheme.wheel2, "color:wheel2", true, my_scheme.wheel2)->editable("wheel color 2", "", 'x');
param_color(my_scheme.seat, "color:seat", true, my_scheme.seat)->editable("seat color", "", 'p'); param_color(my_scheme.seat, "color:seat", true, my_scheme.seat)->editable("seat color", "", 'p');

View File

@ -260,6 +260,9 @@ inline ld gravity = 1 / 16.;
/** the distance of camera from the wheel */ /** the distance of camera from the wheel */
inline ld whdist = 0.5; inline ld whdist = 0.5;
/** ghost repeat period */
inline ld ghost_repeat = 5;
/** minimum slope for rendering */ /** minimum slope for rendering */
inline ld min_gfx_slope = +90._deg; inline ld min_gfx_slope = +90._deg;