temp.points = 0;
temp.time = time_centiseconds;
+#if 0
highscores_push_record( &temp );
+#endif
struct track_info *ti = &track_infos[ route->official_track_id ];
ti->push = 1;
if( ti->achievement_id ){
+#if 0
steam_set_achievement( ti->achievement_id );
steam_store_achievements();
+#endif
}
}
else{
mdl_pstr(&world->meta,route->pstr_name) );
double total_time = 0.0;
- u32 last_version;
+ u32 last_version=0;
int validated = 1;
for( u32 i=0; i<route->checkpoints_count; i++ ){
route->checkpoints_start+k );
ent_gate *gk = mdl_arritm( &world->ent_gate, cp->gate_index );
- if( gk == rg ){
+ gk = mdl_arritm( &world->ent_gate, gk->target );
+ if( gk == dest ){
route->active_checkpoint = k;
world_routes_time_lap( world, route );
break;
}
VG_STATIC void world_routes_place_curve( world_instance *world,
- v4f h[4], v3f n0, v3f n2 )
+ v4f h[3], v3f n0, v3f n2 )
{
float t;
v3f p, pd;
- int last_valid;
+ int last_valid=0;
float total_length = 0.0f,
travel_length = 0.0;
ray_hit ha, hb;
ha.dist = 8.0f;
hb.dist = 8.0f;
- if( ray_world( world, sa, down, &ha ) &&
- ray_world( world, sb, down, &hb ))
- {
- scene_vert va, vb;
-
- v3_muladds( ha.pos, up, 0.06f, va.co );
- v3_muladds( hb.pos, up, 0.06f, vb.co );
-
- scene_vert_pack_norm( &va, up );
- scene_vert_pack_norm( &vb, up );
-
- float t1 = (travel_length / total_length) * patch_count;
- va.uv[0] = t1;
- va.uv[1] = 0.0f;
- vb.uv[0] = t1;
- vb.uv[1] = 1.0f;
-
- scene_push_vert( world->scene_lines, &va );
- scene_push_vert( world->scene_lines, &vb );
-
- if( last_valid ){
- /* Connect them with triangles */
- scene_push_tri( world->scene_lines, (u32[3]){
- last_valid+0-2, last_valid+1-2, last_valid+2-2} );
- scene_push_tri( world->scene_lines, (u32[3]){
- last_valid+1-2, last_valid+3-2, last_valid+2-2} );
+
+ int resa = ray_world( world, sa, down, &ha ),
+ resb = ray_world( world, sb, down, &hb );
+
+ if( resa && resb ){
+ struct world_surface *surfa = ray_hit_surface( world, &ha ),
+ *surfb = ray_hit_surface( world, &hb );
+
+ if( (surfa->info.flags & k_material_flag_skate_surface) &&
+ (surfb->info.flags & k_material_flag_skate_surface) )
+ {
+ scene_vert va, vb;
+
+ float gap = vg_fractf(cur_x*0.5f)*0.02f;
+
+ v3_muladds( ha.pos, up, 0.06f+gap, va.co );
+ v3_muladds( hb.pos, up, 0.06f+gap, vb.co );
+
+ scene_vert_pack_norm( &va, up );
+ scene_vert_pack_norm( &vb, up );
+
+ float t1 = (travel_length / total_length) * patch_count;
+ va.uv[0] = t1;
+ va.uv[1] = 0.0f;
+ vb.uv[0] = t1;
+ vb.uv[1] = 1.0f;
+
+ scene_push_vert( world->scene_lines, &va );
+ scene_push_vert( world->scene_lines, &vb );
+
+ if( last_valid ){
+ /* Connect them with triangles */
+ scene_push_tri( world->scene_lines, (u32[3]){
+ last_valid+0-2, last_valid+1-2, last_valid+2-2} );
+ scene_push_tri( world->scene_lines, (u32[3]){
+ last_valid+1-2, last_valid+3-2, last_valid+2-2} );
+ }
+
+ last_valid = world->scene_lines->vertex_count;
}
-
- last_valid = world->scene_lines->vertex_count;
+ else
+ last_valid = 0;
}
else
last_valid = 0;
ent_gate *start_gate = mdl_arritm( &world->ent_gate, c0->gate_index );
start_gate = mdl_arritm( &world->ent_gate, start_gate->target );
- ent_gate *end_gate = mdl_arritm( &world->ent_gate, c1->gate_index );
+ ent_gate *end_gate = mdl_arritm( &world->ent_gate, c1->gate_index ),
+ *collector = mdl_arritm( &world->ent_gate, end_gate->target );
v4f p[3];
else{
v3_copy( end_gate->co[0], p[2] );
v3_add( (v3f){0.0f,0.1f,0.0f}, p[2], p[2] );
- p[2][3] = end_gate->ref_count;
- p[2][3] -= (float)end_gate->ref_total * 0.5f;
- end_gate->ref_count ++;
+ p[2][3] = collector->ref_count;
+
+ if( i == route->checkpoints_count-1)
+ p[2][3] -= 1.0f;
+
+ p[2][3] -= (float)collector->ref_total * 0.5f;
+ //collector->ref_count ++;
}
/* p0,p1,p2 bezier patch is complete
}
for( u32 i=0; i<mdl_arrcount(&world->ent_route_node); i++ ){
- ent_route_node *rn = mdl_arritm( &world->ent_route, i );
+ ent_route_node *rn = mdl_arritm( &world->ent_route_node, i );
rn->ref_count = 0;
rn->ref_total = 0;
}
ent_gate *start_gate = mdl_arritm( &world->ent_gate, c0->gate_index );
start_gate = mdl_arritm( &world->ent_gate, start_gate->target );
-
- ent_gate *end_gate = mdl_arritm( &world->ent_gate, c1->gate_index );
start_gate->ref_total ++;
if( !c0->path_count )
ent_route_node *rn = mdl_arritm( &world->ent_route_node,
index->index );
rn->ref_total ++;
-
- if( j+1 < c0->path_count ){
- }
- else{
- end_gate->ref_total ++;
- }
}
}
}
gate = mdl_arritm(&world->ent_gate, gate->target );
for( u32 k=0; k<4; k++ ){
+ if( gate->routes[k] == i ){
+ vg_error( "already assigned route to gate\n" );
+ break;
+ }
if( gate->routes[k] == 0xffff ){
gate->routes[k] = i;
break;
}
}
+ for( u32 i=0; i<mdl_arrcount(&world->ent_gate); i++ ){
+ ent_gate *gate = mdl_arritm( &world->ent_gate, i );
+
+ vg_info( "ROUTES :: %hu %hu %hu %hu\n", gate->routes[0],
+ gate->routes[1],
+ gate->routes[2],
+ gate->routes[3] );
+ }
+
world_routes_clear( world );
}
GLuint shader, GLuint location,
int slot );
-VG_STATIC void render_world_routes( world_instance *world, camera *cam )
+VG_STATIC void render_world_routes( world_instance *world, camera *cam,
+ int layer_depth )
{
m4x3f identity_matrix;
m4x3_identity( identity_matrix );
shader_model_gate_uColour( colour );
- u32 next = route->checkpoints_start +
- (route->active_checkpoint+1) % route->checkpoints_count;
+ u32 next = route->active_checkpoint+1+layer_depth;
+ next = next % route->checkpoints_count;
+ next += route->checkpoints_start;
ent_checkpoint *cp = mdl_arritm( &world->ent_checkpoint, next );
ent_gate *gate = mdl_arritm( &world->ent_gate, cp->gate_index );