+ shader_routeui_uOffset( (v4f){ cx*k_bar_scale_x, base,
+ k_bar_scale_x, height } );
+
+ world_routes_ui_draw_segment( segment );
+ cx += segment->length;
+ }
+
+ /*
+ * Draw main bar
+ */
+ shader_routeui_uColour( colour );
+ for( u32 i=0; i<pr->ui.segment_count; i++ )
+ {
+ u32 j = (pr->ui.segment_start + i) % k_max_ui_segments;
+ struct route_ui_segment *segment = &pr->ui.segments[j];
+
+ shader_routeui_uOffset( (v4f){ cx*k_bar_scale_x, base,
+ k_bar_scale_x, height } );
+
+ world_routes_ui_draw_segment( segment );
+ cx += segment->length;
+
+ main_block_size += segment->length;
+ }
+
+ pr->ui.xpos = vg_lerpf( pr->ui.xpos, -main_block_size * 0.5f, 0.03f );
+}
+
+static void world_routes_local_set_record( u32 route, double lap_time )
+{
+ vg_success( " NEW LAP TIME: %f\n", lap_time );
+
+ struct subworld_routes *r = &world.routes;
+ struct route *pr = &r->routes[route];
+
+ if( pr->track_id != 0xffffffff )
+ {
+ double time_centiseconds = lap_time * 100.0;
+ if( time_centiseconds > (float)0xfffe )
+ return;
+
+ highscore_record temp;
+ temp.trackid = pr->track_id;
+ temp.datetime = time(NULL);
+ temp.playerid = 0;
+ temp.points = 0;
+ temp.time = time_centiseconds;
+
+ highscores_push_record( &temp );
+ track_infos[ pr->track_id ].push = 1;
+ }
+ else
+ {
+ vg_warn( "There is no associated track for this record...\n" );
+ }
+}
+
+/*
+ * Will scan the whole run for two things;
+ * 1: we set a new record for the total, complete loop around the course
+ * 2: the time of each segment will be recorded into the data buffer
+ * (not implemented: TODO)
+ */
+static void world_routes_verify_run( u32 route )
+{
+ struct subworld_routes *r = &world.routes;
+ struct route *pr = &r->routes[route];
+
+ u32 stack[64];
+ u32 si = world_routes_get_path( r->routes[route].start, stack );
+
+ /*
+ * we only care about gates that ref gates, so shuffle down the array
+ */
+ struct route_timing *timings[64];
+ u32 sj = 0, maxv = 0, begin = 0;
+ for( u32 i=0; i<si; i++ )
+ {
+ if( r->nodes[stack[i]].special_type == k_route_special_type_collector )
+ timings[sj ++] = &r->collectors[r->nodes[stack[i]].special_id].timing;
+ else if( r->nodes[stack[i]].special_type == k_route_special_type_gate )
+ timings[sj ++] = &r->gates[r->nodes[stack[i]].special_id].timing;
+ }
+
+ for( u32 i=0; i<sj; i++ )
+ {
+ if( timings[i]->version > maxv )