- player.rewind_incrementer = 0;
-
- if( player.rewind_length > 1 )
- {
- player.rewind_total_length +=
- v3_dist( player.rewind_buffer[player.rewind_length-1].pos,
- player.rewind_buffer[player.rewind_length-2].pos );
- }
- }
-}
-
-/* Deal with input etc */
-static void player_update_pre(void)
-{
- struct player_phys *phys = &player.phys;
-
- if( player.rewinding )
- {
- return;
- }
-
- if( vg_get_button_down( "reset" ) )
- {
- double delta = world_routes.time - world_routes.last_use;
-
- if( delta <= RESET_MAX_TIME )
- {
- player.rewinding = 1;
- player.rewind_sound_wait = 1;
- player.rewind_time = (float)player.rewind_length - 0.0001f;
- player_save_rewind_frame();
- audio_lock();
- audio_play_oneshot( &audio_rewind[0], 1.0f );
- audio_unlock();
-
- /* based on analytical testing. DONT CHANGE!
- *
- * time taken: y = (x^(4/5)) * 74.5
- * inverse : x = (2/149)^(4/5) * y^(4/5)
- */
-
- float constant = powf( 2.0f/149.0f, 4.0f/5.0f ),
- curve = powf( player.rewind_total_length, 4.0f/5.0f );
-
- player.rewind_predicted_time = constant * curve;
- player.diag_rewind_start = vg.time;
- player.diag_rewind_time = player.rewind_time;
-
- player.is_dead = 0;
- player.death_tick_allowance = 30;
- player_restore_frame();
-
- if( !phys->on_board )
- {
- player.angles[0] = atan2f( -phys->rb.forward[2],
- -phys->rb.forward[0] );
- }
-
- player.mdl.shoes[0] = 1;
- player.mdl.shoes[1] = 1;
-
- world_routes_notify_reset();
-
- /* apply 1 frame of movement */
- player_do_motion();
- }
- }
-
- if( vg_get_button_down( "switchmode" ) )
- {
- phys->on_board ^= 0x1;
-
- audio_lock();
- if( phys->on_board )
- {
- v3_muladds( phys->rb.v, phys->rb.forward, 0.2f, phys->rb.v );
- audio_play_oneshot( &audio_lands[6], 1.0f );
- }
- else
- {
- audio_play_oneshot( &audio_lands[5], 1.0f );
- }
-
- audio_unlock();
- }
-}
-
-static void player_update_fixed(void) /* 2 */
-{
- if( player.rewinding )
- return;
-
- if( player.death_tick_allowance )
- player.death_tick_allowance --;
-
- struct player_phys *phys = &player.phys;
-
- if( player.is_dead )
- {
- player_ragdoll_iter();
- }
- else
- {
- player.rewind_incrementer ++;
-
- if( player.rewind_incrementer > (u32)(0.25/VG_TIMESTEP_FIXED) )
- {
- player_save_rewind_frame();
- }
-
- player_do_motion();
- }
-}
-
-static void player_update_post(void)
-{
- for( int i=0; i<player.land_log_count; i++ )
- vg_line_cross( player.land_target_log[i],
- player.land_target_colours[i], 0.25f);
-
- if( player.is_dead )
- {
- player_debug_ragdoll();
-
- if( !freecam )
- player_animate_death_cam();
- }
- else
- {
- player_animate();