mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-03-26 21:37:02 +00:00
ads-game:: view history while paused
This commit is contained in:
parent
37ab1b523d
commit
9799ff1ccf
@ -189,6 +189,14 @@ bool ads_turn(int idelta) {
|
||||
else if(a[16+9]) tc = pt;
|
||||
else if(a[16+10]) tc = -pt;
|
||||
|
||||
if(!paused) {
|
||||
auto& v = ci_at[hybrid::get_where(vctr).first].shipstates;
|
||||
v.emplace_back();
|
||||
v.back().at = ads_inverse(current * vctrV) * spin((ang+90)*degree);
|
||||
v.back().start = ship_pt;
|
||||
v.back().duration = pt;
|
||||
}
|
||||
|
||||
current.T = cspin(3, 2, tc) * current.T;
|
||||
|
||||
optimize_shift(current);
|
||||
|
@ -2,6 +2,8 @@ namespace hr {
|
||||
|
||||
namespace ads_game {
|
||||
|
||||
color_t shipcolor = 0x2020FFFF;
|
||||
|
||||
cross_result findflat(shiftpoint h) {
|
||||
return cross0(current * rgpushxto0(h));
|
||||
}
|
||||
@ -125,6 +127,31 @@ void draw_game_cell(cell *cs, ads_matrix V, ld plev) {
|
||||
}
|
||||
}
|
||||
|
||||
/* todo: binary search */
|
||||
if(paused) for(auto& rock: ci.shipstates) {
|
||||
ld t;
|
||||
hybrid::in_actual([&]{
|
||||
dynamicval<eGeometry> b(geometry, gRotSpace);
|
||||
auto h = V * rock.at;
|
||||
t = cross0(current * h).shift;
|
||||
});
|
||||
|
||||
if(t < -1e-6 || t > rock.duration + 1e-6) continue;
|
||||
vector<hyperpoint> pts;
|
||||
|
||||
auto& shape = shape_ship;
|
||||
for(int i=0; i<isize(shape); i += 2) {
|
||||
hybrid::in_actual([&]{
|
||||
auto h = V * rock.at * rgpushxto0(normalize(hyperpoint(shape[i], shape[i+1], 1, 0)));
|
||||
pts.push_back(cross0(current * h).h);
|
||||
});
|
||||
}
|
||||
|
||||
for(auto h: pts) curvepoint(h);
|
||||
curvepoint(pts[0]);
|
||||
queuecurve(shiftless(Id), 0xFF, shipcolor, PPR::LINE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void view_ads_game() {
|
||||
@ -208,7 +235,6 @@ void view_ads_game() {
|
||||
|
||||
if(!game_over && !paused) {
|
||||
poly_outline = 0xFF;
|
||||
color_t shipcolor = 0x2020FFFF;
|
||||
if(ship_pt < invincibility_pt) {
|
||||
ld u = (invincibility_pt-ship_pt) / how_much_invincibility;
|
||||
poly_outline = gradient(shipcolor, rsrc_color[rtHull], 0, 0.5 + cos(5*u*TAU), 1);
|
||||
|
@ -24,10 +24,17 @@ struct ads_object {
|
||||
|
||||
enum eWalltype { wtNone, wtDestructible, wtSolid, wtGate };
|
||||
|
||||
struct shipstate {
|
||||
ads_matrix at;
|
||||
ld start;
|
||||
ld duration;
|
||||
};
|
||||
|
||||
struct cellinfo {
|
||||
int mpd_terrain; /* 0 = fully generated terrain */
|
||||
int rock_dist; /* rocks generated in this radius */
|
||||
vector<std::unique_ptr<ads_object>> rocks;
|
||||
vector<shipstate> shipstates;
|
||||
eWalltype type;
|
||||
cellinfo() {
|
||||
mpd_terrain = 4;
|
||||
|
Loading…
x
Reference in New Issue
Block a user