+/*
+ * Copyright (C) 2021-2022 Mt.ZERO Software, Harry Godden - All Rights Reserved
+ */
+
#ifndef ROUTES_H
#define ROUTES_H
k_route_special_type_collector = 2
};
-static void world_routes_interact(void)
-{
- world.routes.last_interaction = vg_time;
-}
-
static void debug_sbpath( struct route_node *rna, struct route_node *rnb,
u32 colour, float xoffset )
{
*/
static void world_routes_ui_notch( u32 route, float time )
{
+ return; /* FIXME: Temporarily disabled */
+
struct subworld_routes *r = &world.routes;
struct route *pr = &r->routes[route];
shader_routeui_use();
glBindVertexArray( pr->ui.vao );
- float fade_amt = vg_time - pr->ui.fade_timer_start;
+ float fade_amt = r->time - pr->ui.fade_timer_start;
fade_amt = vg_clampf( fade_amt / 1.0f, 0.0f, 1.0f );
float fade_block_size = 0.0f,
v4_copy( colour, fade_colour );
fade_colour[3] *= 1.0f-fade_amt;
- float timer_delta = (vg_time - world.routes.last_interaction) * (1.0/60.0),
+ /* 1 minute timer */
+ float timer_delta = (r->time - r->last_use) * (1.0/45.0),
timer_scale = 1.0f - vg_minf( timer_delta, 1.0f );
/*
temp.time = time_centiseconds;
highscores_push_record( &temp );
- track_infos[ pr->track_id ].push = 1;
+
+ struct track_info *pti = &track_infos[ pr->track_id ];
+ pti->push = 1;
+
+ if( pti->achievement_id )
+ {
+ steam_set_achievement( pti->achievement_id );
+ steam_store_achievements();
+ }
}
else
{
pr->ui.fade_start = pr->ui.segment_start;
pr->ui.fade_count = 0;
- pr->ui.fade_timer_start = vg_time;
+ pr->ui.fade_timer_start = r->time;
int orig_seg_count = pr->ui.segment_count;
pr->ui.fade_count ++;
}
- r->routes[route].latest_pass = vg_time;
+ r->routes[route].latest_pass = r->time;
}
/*
*/
static void world_routes_activate_gate( u32 id )
{
- world_routes_interact();
-
struct subworld_routes *r = &world.routes;
struct route_gate *rg = &r->gates[id];
struct route_node *pnode = &r->nodes[rg->node_id],
*pdest = &r->nodes[pnode->next[0]];
+ r->last_use = r->time;
+
struct route_collector *rc = &r->collectors[ pdest->special_id ];
r->active_gate = id;
rg->timing.version = r->current_run_version;
- rg->timing.time = vg_time;
+ rg->timing.time = r->time;
for( u32 i=0; i<r->route_count; i++ )
{
struct route *route = &r->routes[i];
{
route->ui.fade_start = route->ui.segment_start;
route->ui.fade_count = route->ui.segment_count;
- route->ui.fade_timer_start = vg_time;
+ route->ui.fade_timer_start = r->time;
world_routes_ui_clear(i);
vg_success( "CLEARING -> %u %u \n", route->ui.fade_start,
r->current_run_version ++;
rc->timing.version = r->current_run_version;
- rc->timing.time = vg_time;
+ rc->timing.time = r->time;
r->current_run_version ++;
}
static void world_routes_notify_reset(void)
{
struct subworld_routes *r = &world.routes;
- world_routes_interact();
+ r->rewind_from = r->time;
+ r->rewind_to = r->last_use;
+#if 0
for( int i=0; i<r->route_count; i++ )
{
struct route *route = &r->routes[i];
if( route->active )
- world_routes_ui_notch( i, vg_time - route->latest_pass );
+ world_routes_ui_notch( i, r->time - route->latest_pass );
}
+#endif
+}
+
+static void world_routes_rollback_time( double t )
+{
+ struct subworld_routes *r = &world.routes;
+ r->time = vg_lerp( r->rewind_to, r->rewind_from, t );
}
static void world_routes_debug(void)
1, sizeof( struct route ) );
struct route *route = &r->routes[r->route_count];
+ memset( route, 0, sizeof(struct route) );
v3_copy( inf->colour, route->colour );
route->colour[3] = 1.0f;
static void world_routes_update(void)
{
struct subworld_routes *r = &world.routes;
+ r->time += vg.time_delta;
for( int i=0; i<r->route_count; i++ )
{
struct route *route = &r->routes[i];
- route->factive = vg_lerpf( route->factive, route->active, 0.01f );
+ route->factive = vg_lerpf( route->factive, route->active,
+ 0.6f*vg.time_delta );
if( route->active )
{
- world_routes_ui_updatetime( i, vg_time - route->latest_pass );
+ world_routes_ui_updatetime( i, r->time - route->latest_pass );
}
}
}