X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=player.h;h=92667821e84363b2ffda5c4134e9a6cc637c31d0;hb=0ae443b3f6b4b753f9a2eba58da597ae8cb14b4f;hp=840858371c204165e0beea0c9834a50b06a05fd9;hpb=23a1be081ab9e378cba49a23b8ed4d4082b580c1;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/player.h b/player.h index 8408583..9266782 100644 --- a/player.h +++ b/player.h @@ -301,48 +301,65 @@ VG_STATIC void player_update_pre(void) if( vg_get_button_down( "reset" ) ) { - double delta = world.time - world.last_use; - - if( (delta <= RESET_MAX_TIME) && (world.last_use != 0.0) ) + if( player.is_dead ) { - player.rewinding = 1; - player.rewind_sound_wait = 1; - player.rewind_time = (float)player.rewind_length - 0.0001f; - player_save_rewind_frame(); + reset_player( 0, NULL ); audio_lock(); - audio_play_oneshot( &audio_rewind[0], 1.0f ); + audio_play_oneshot( &audio_ui[0], 1.0f ); audio_unlock(); + } + else + { + double delta = world.time - world.last_use; - /* 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; + if( (delta <= RESET_MAX_TIME) && (world.last_use != 0.0) ) + { + 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(); + 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] ); - } + 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; + player.mdl.shoes[0] = 1; + player.mdl.shoes[1] = 1; - world_routes_notify_reset(); + world_routes_notify_reset(); - /* apply 1 frame of movement */ - player_do_motion(); + /* apply 1 frame of movement */ + player_do_motion(); + } + else + { + /* cant do that */ + audio_lock(); + audio_play_oneshot( &audio_rewind[4], 1.0f ); + audio_unlock(); + } } } @@ -577,6 +594,7 @@ VG_STATIC void player_kill(void) { player.is_dead = 1; player_ragdoll_copy_model( player.phys.rb.v ); + world_routes_clear(); } }