diff --git a/rogueviz/nilrider/level.cpp b/rogueviz/nilrider/level.cpp index bab993c2..f22de812 100644 --- a/rogueviz/nilrider/level.cpp +++ b/rogueviz/nilrider/level.cpp @@ -240,6 +240,7 @@ void level::init() { d.y = y; for(int i=0; i<7; i++) d.colors[i] = gradient(0xFFD500FF, 0xFF, 0, i, 8); + d.colors[6] = d.colors[0]; triangles.emplace_back(d); } } diff --git a/rogueviz/nilrider/nilrider.cpp b/rogueviz/nilrider/nilrider.cpp index 4744857e..d87a0430 100644 --- a/rogueviz/nilrider/nilrider.cpp +++ b/rogueviz/nilrider/nilrider.cpp @@ -131,7 +131,7 @@ void run() { } } } - curlev->current.draw_instruments(timer); + curlev->current.draw_instruments(curlev, timer); if(paused && !planning_mode) { displayButton(current_display->xcenter, current_display->ycenter, mousing ? XLAT("paused -- click to unpause") : XLAT("paused -- press p to continue"), 'p', 8); diff --git a/rogueviz/nilrider/nilrider.h b/rogueviz/nilrider/nilrider.h index 1717b28d..8edb1553 100644 --- a/rogueviz/nilrider/nilrider.h +++ b/rogueviz/nilrider/nilrider.h @@ -21,7 +21,7 @@ struct timestamp { bool tick(level*);/**< one tick of the simulation -- returns false if the unicycle has stopped or crashed */ void centerview(level*); void draw_unilcycle(const shiftmatrix&); - void draw_instruments(ld t); + void draw_instruments(level*, ld t); ld energy_in_squares(); bool collect(level*); void be_consistent(); @@ -186,4 +186,6 @@ extern map > submaps; hyperpoint sym_to_heis(hyperpoint H); +extern int reversals; + } diff --git a/rogueviz/nilrider/timestamp.cpp b/rogueviz/nilrider/timestamp.cpp index adea7d4a..407dd792 100644 --- a/rogueviz/nilrider/timestamp.cpp +++ b/rogueviz/nilrider/timestamp.cpp @@ -165,12 +165,13 @@ void timestamp::centerview(level *lev) { playermoved = false; } -void timestamp::draw_instruments(ld t) { +void timestamp::draw_instruments(level* l, ld t) { dynamicval g(geometry, gEuclid); dynamicval pm(pmodel, mdDisk); dynamicval ga(vid.always3, false); dynamicval gi(ginf[gEuclid].g, giEuclid2); initquickqueue(); + check_cgi(); cgi.require_shapes(); ld rad = 40; @@ -269,12 +270,57 @@ void timestamp::draw_instruments(ld t) { curvepoint(hpxy(rad/4, 0)); queuecurve(sId * atscreenpos(cx, cy, pix) * spin(e_to_angle(energy_in_squares())), 0xFF, 0xFF8080FF, PPR::ZERO); + cx += rad; + + int tid = 0; + + for(int i=0; itriangles); i++) { + bool have = collected_triangles & Flag(i); + color_t f = l->triangles[i].colors[6]; + if(have) { + poly_outline = 0xFF; + } + else { + poly_outline = f; + f = 0x40; + } + + queuepoly(sId * atscreenpos(cx+rad/2, cy+(tid&1?1:-1)*rad/3, pix * rad * 1.2) * spin(90*degree), cgi.shTriangle, f); + tid++; + if(tid == 2) { tid = 0; cx += rad/1.4; } + } + if(tid) cx += rad/1.4; + cx += 5; + + int gid = 0; + for(auto& g: l->goals) { + bool gfailed = failed & Flag(gid); + bool gsuccess = goals & Flag(gid); + if(lshiftclick) gfailed = true, gsuccess = false; + if(anyctrlclick) gfailed = false, gsuccess = true; + string s = format("%d:%02d.%02d", int(t / 60), int(t) % 60, int(frac(t) * 100)); + shiftmatrix T = sId * atscreenpos(cx+rad/2, cy+(gid-1)*rad/1.2, pix * rad * 1.2); + poly_outline = 0xFF; color_t f = darkena(g.color, 0, 0xFF); + if(gsuccess) { + queuepoly(T * spin(90*degree), cgi.shGrail, f); + displaystr(cx+rad, cy+(gid-1)*rad/1.2, 0, vid.fsize*.75, s, 0, 0); + } + else { + poly_outline = f; f = 0x40; + queuepoly(T * spin(90*degree), cgi.shGrail, f); + if(gfailed) { poly_outline = 0xFF; queuepoly(T, cgi.shPirateX, 0xC00000FF); } + } + gid++; + } + quickqueue(); glflush(); string s = format("%d:%02d.%02d", int(t / 60), int(t) % 60, int(frac(t) * 100)); - displaystr(vid.xres - vid.fsize, vid.fsize*2, 0, vid.fsize * 2, s, 0, 16); + + if(reversals) s = format("+%d", reversals); + displaystr(vid.xres - vid.fsize, vid.fsize*4, 0, vid.fsize, s, 0, 16); } }