1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-06-27 07:22:51 +00:00

rogueviz:: ads:: time_shift setting

This commit is contained in:
Zeno Rogue 2025-06-22 15:57:26 +02:00
parent 56767f0d8f
commit 296abbe7c4
5 changed files with 24 additions and 30 deletions

View File

@ -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")

View File

@ -23,6 +23,14 @@ void apply_duality(shiftmatrix& S) {
vector<ads_object*> 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);
}
}

View File

@ -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) {

View File

@ -66,6 +66,7 @@ void change_scale(ld s);
vector<struct ads_object*> displayed;
ld time_scale = .5;
ld time_shift = 0;
color_t missile_color = 0xFF0000FF;

View File

@ -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);