diff --git a/rogueviz/ads/ads-game.cpp b/rogueviz/ads/ads-game.cpp index f6075288..91895fac 100644 --- a/rogueviz/ads/ads-game.cpp +++ b/rogueviz/ads/ads-game.cpp @@ -342,6 +342,9 @@ auto shot_hooks = param_f(time_scale, "rh_time_scale") -> editable(0, 1, 0.1, "Relative Hell time label scale", "scaling factor for the time labels", 'T'); + param_f(time_shift, "rh_time_shift") + -> editable(0, 1, 0.1, "Relative Hell time label shift", "shift for the time labels", 'U'); + param_i(XSCALE, "ds_xscale") -> editable(4, 512, 8, "x precision of Earth-de Sitter", "", 'x'); param_i(YSCALE, "ds_yscale") diff --git a/rogueviz/ads/display.cpp b/rogueviz/ads/display.cpp index f5bfd620..faa5dd98 100644 --- a/rogueviz/ads/display.cpp +++ b/rogueviz/ads/display.cpp @@ -23,6 +23,14 @@ void apply_duality(shiftmatrix& S) { vector under_mouse; hyperpoint mousetester; +void view_time(const shiftmatrix& S, ld t, color_t col) { + if(!view_proper_times) return; + auto S1 = S; + if(time_shift) S1.T = rgpushxto0(S1.T * C0) * ypush(time_shift); + string str = hr::format(tformat, t / (main_rock ? ds_time_unit : ads_time_unit)); + queuestr(S1, time_scale, str, col, 8); + } + void draw_game_cell(const cell_to_draw& cd) { bool hv = mtwisted; using cellptr = cell*; @@ -104,10 +112,7 @@ void draw_game_cell(const cell_to_draw& cd) { ld ads_scale = get_scale(); - if(view_proper_times) { - string str = hr::format(tformat, cd.center.shift / ads_time_unit); - queuestr(shiftless(rgpushxto0(cd.center.h)), time_scale, str, 0xFF4040, 8); - } + if(col >> 8) view_time(shiftless(rgpushxto0(cd.center.h)), cd.center.shift, 0xFF4040); // need i-loop because new rocks can be created in handle_turret @@ -177,10 +182,7 @@ void draw_game_cell(const cell_to_draw& cd) { 0x000000FF, rock.col, obj_prio[rock.type]); } - if(view_proper_times && rock.type != oParticle) { - string str = hr::format(tformat, rock.pt_main.shift / ads_time_unit); - queuestr(shiftless(rgpushxto0(rock.pt_main.h)), time_scale, str, 0xFFFFFF, 8); - } + if(rock.type != oParticle) view_time(shiftless(rgpushxto0(rock.pt_main.h)), rock.pt_main.shift, 0xFFFFFF); } if(paused || which_cross) if(hv) for(auto& rock: ci.shipstates) { @@ -240,10 +242,7 @@ void draw_game_cell(const cell_to_draw& cd) { queuecurve(shiftless(Id), 0xFF, col, PPR::MONSTER_FOOT); }); - if(ok && view_proper_times) { - string str = hr::format(tformat, (cr.shift + rock.start) / ads_time_unit); - queuestr(shiftless(rgpushxto0(cr.h)), time_scale, str, 0xC0C0C0, 8); - } + if(ok) view_time(shiftless(rgpushxto0(cr.h)), cr.shift + rock.start, 0xC0C0C0); } if(paused && c == vctr_ship && !game_over && !in_replay && !hv) { @@ -389,10 +388,7 @@ void view_ads_game() { }); poly_outline = 0xFF; - if(view_proper_times) { - string str = hr::format(tformat, ship_pt / ads_time_unit); - queuestr(shiftless(Id), time_scale, str, 0xFFFFFF, 8); - } + view_time(shiftless(Id), ship_pt, 0xFFFFFF); } } diff --git a/rogueviz/ads/ds-game.cpp b/rogueviz/ads/ds-game.cpp index f9b9277d..737f899a 100644 --- a/rogueviz/ads/ds-game.cpp +++ b/rogueviz/ads/ds-game.cpp @@ -616,11 +616,10 @@ void view_ds_game() { queuecurve(shiftless(sphereflip), ghost_color, 0, obj_prio[rock.type]).flags |= POLY_NO_FOG | POLY_FORCEWIDE; } - if(view_proper_times && rock.type != oParticle) { + if(rock.type != oParticle) { ld t = rock.pt_main.shift; if(rock.type == oMainRock) t += current.shift; - string str = hr::format(tformat, t / ds_time_unit); - queuestr(shiftless(sphereflip * rgpushxto0(rock.pt_main.h)), time_scale, str, 0xFFFF00, 8); + view_time(shiftless(sphereflip * rgpushxto0(rock.pt_main.h)), t, 0xFFFF00); } if(rock.pt_main.h[2] > 0.1 && rock.life_end == HUGE_VAL) { @@ -676,10 +675,7 @@ void view_ds_game() { } }); - if(view_proper_times) { - string str = hr::format(tformat, (cr.shift + ss.start) / ds_time_unit); - queuestr(shiftless(sphereflip * rgpushxto0(cr.h)), time_scale, str, 0xC0C0C0, 8); - } + view_time(shiftless(sphereflip * rgpushxto0(cr.h)), cr.shift + ss.start, 0xC0C0C0); } if(!game_over && !paused) { @@ -705,10 +701,7 @@ void view_ds_game() { }); poly_outline = 0xFF; - if(view_proper_times) { - string str = hr::format(tformat, ship_pt / ds_time_unit); - queuestr(shiftless(sphereflip), time_scale, str, 0xFFFFFF, 8); - } + view_time(shiftless(sphereflip), ship_pt, 0xFFFFFF); } if(paused && !game_over && !in_replay && !hv && !which_cross) { diff --git a/rogueviz/ads/globals.cpp b/rogueviz/ads/globals.cpp index be362e2b..31d6880c 100644 --- a/rogueviz/ads/globals.cpp +++ b/rogueviz/ads/globals.cpp @@ -66,6 +66,7 @@ void change_scale(ld s); vector displayed; ld time_scale = .5; +ld time_shift = 0; color_t missile_color = 0xFF0000FF; diff --git a/rogueviz/ads/menu.cpp b/rogueviz/ads/menu.cpp index c0151d69..3b750934 100644 --- a/rogueviz/ads/menu.cpp +++ b/rogueviz/ads/menu.cpp @@ -205,9 +205,10 @@ void game_menu() { add_edit(pause_speed); add_edit(view_proper_times); add_edit(DS_(time_unit)); - if(view_proper_times) - add_edit(time_scale); - else dialog::addBreak(100); + if(view_proper_times) { + add_edit(time_scale); add_edit(time_shift); + } + else dialog::addBreak(200); dialog::addItem(XLAT("set view mode"), 'v'); dialog::add_action_push(edit_view_mode);