u32 last_version=0;
f64 last_time = 0.0;
+ ent_checkpoint *last_cp = NULL;
u32 valid_sections=0;
struct time_block{
- f32 length;
+ f32 length, best;
int clean;
}
- *blocks = alloca( sizeof(struct time_block) * route->checkpoints_count );
+ blocks[ route->checkpoints_count ];
for( u32 i=0; i<route->checkpoints_count; i++ ){
u32 cpid = i+route->active_checkpoint+1;
struct time_block *block = &blocks[ valid_sections ++ ];
block->clean = (rg->flags & k_ent_gate_clean_pass)? 1: 0;
block->length = rg->timing_time - last_time;
+ block->best = last_cp? last_cp->best_time: 0.0f;
}
else valid_sections = 0;
last_version = rg->timing_version;
last_time = rg->timing_time;
+ last_cp = cp;
}
if( last_version+1 == world_static.current_run_version ){
struct time_block *block = &blocks[ valid_sections ++ ];
block->clean = localplayer.rewinded_since_last_gate? 0: 1;
block->length = world_static.time - last_time;
+ block->best = last_cp->best_time;
}
else
valid_sections = 0;
for( u32 i=0; i<valid_sections; i ++ ){
struct time_block *block = &blocks[ i ];
- ui_px w = block->length * 6.0f;
+ ui_px w = 20 + (block->length * 6.0f);
ui_rect rect = { x, inout_cursor[1], w, h };
ui_fill( rect, colour );
if( block->clean )
ui_outline( rect, 1, 0xff00ffff, 0 );
+ if( block->best != 0.0f ){
+ char buf[32];
+ vg_str str;
+ vg_strnull( &str, buf, 32 );
+
+ f32 diff = block->length - block->best,
+ as = fabsf(diff),
+ s = floorf( as ),
+ ds = floorf( vg_fractf( as ) * 10.0f );
+
+ if( (block->best != 0.0f) && (fabsf(diff) > 0.02f) ){
+ if( diff > 0.0f )
+ vg_strcatch( &str, '+' );
+ else
+ vg_strcatch( &str, '-' );
+
+ vg_strcati32( &str, s );
+ vg_strcatch( &str, '.' );
+ vg_strcati32( &str, ds );
+
+ ui_text( rect, buf, 1, k_ui_align_middle_center, 0 );
+ }
+ }
+
x += w + 4;
}