1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-07-01 09:33:17 +00:00

ads-game:: display time for shipstate

This commit is contained in:
Zeno Rogue 2022-09-19 23:16:41 +02:00
parent f375d609c6
commit 8f086f7bb5

View File

@ -136,14 +136,14 @@ void draw_game_cell(const cell_to_draw& cd) {
/* todo: binary search */ /* todo: binary search */
if(paused) for(auto& rock: ci.shipstates) { if(paused) for(auto& rock: ci.shipstates) {
ld t; cross_result cr;
hybrid::in_actual([&]{ hybrid::in_actual([&]{
dynamicval<eGeometry> b(geometry, gRotSpace); dynamicval<eGeometry> b(geometry, gRotSpace);
auto h = V * rock.at; auto h = V * rock.at;
t = cross0(current * h).shift; cr = cross0(current * h);
}); });
if(t < -1e-6 || t > rock.duration + 1e-6) continue; if(cr.shift < -1e-6 || cr.shift > rock.duration + 1e-6) continue;
vector<hyperpoint> pts; vector<hyperpoint> pts;
auto& shape = shape_ship; auto& shape = shape_ship;
@ -157,6 +157,9 @@ void draw_game_cell(const cell_to_draw& cd) {
for(auto h: pts) curvepoint(h); for(auto h: pts) curvepoint(h);
curvepoint(pts[0]); curvepoint(pts[0]);
queuecurve(shiftless(Id), 0xFF, shipcolor, PPR::LINE); queuecurve(shiftless(Id), 0xFF, shipcolor, PPR::LINE);
string str = format(tformat, (cr.shift + rock.start) / time_unit);
queuestr(shiftless(rgpushxto0(cr.h)), .1, str, 0xC0C0C0, 8);
} }
if(paused && c == vctr_ship && !game_over) { if(paused && c == vctr_ship && !game_over) {