projects
/
carveJwlIkooP6JGAAIwe30JlM.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b16b962
)
allow reset on death
author
hgn
<hgodden00@gmail.com>
Sat, 3 Dec 2022 17:38:47 +0000
(17:38 +0000)
committer
hgn
<hgodden00@gmail.com>
Sat, 3 Dec 2022 17:38:47 +0000
(17:38 +0000)
player.h
patch
|
blob
|
history
diff --git
a/player.h
b/player.h
index 0ed16b6f3a5f89af72d8b714ce1476da0e80840a..cb36975a266bec614e2ccd53b99b7f377f3f53cd 100644
(file)
--- a/
player.h
+++ b/
player.h
@@
-437,63
+437,58
@@
VG_STATIC void player_update_pre(void)
struct player_phys *phys = &player.phys;
if( player.rewinding )
struct player_phys *phys = &player.phys;
if( player.rewinding )
- {
return;
return;
- }
if( vg_input_button_down( player.input_reset ) && !menu_enabled() )
{
if( vg_input_button_down( player.input_reset ) && !menu_enabled() )
{
- if( player.is_dead )
+ double delta = world.time - world.last_use;
+
+ if( (delta <= RESET_MAX_TIME) && (world.last_use != 0.0) )
{
{
- reset_player( 0, NULL );
+ player.rewinding = 1;
+ player.rewind_sound_wait = 1;
+ player.rewind_time = (float)player.rewind_length - 0.0001f;
+ player_save_rewind_frame();
audio_lock();
audio_lock();
- audio_play_oneshot( &audio_
ui
[0], 1.0f );
+ audio_play_oneshot( &audio_
rewind
[0], 1.0f );
audio_unlock();
audio_unlock();
- }
- else
- {
- double delta = world.time - world.last_use;
-
- 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)
-
*/
+ /* 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;
+ 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
+ {
+ if( player.is_dead )
+ {
+ reset_player( 0, NULL );
}
else
{
}
else
{
@@
-744,7
+739,6
@@
VG_STATIC void player_kill(void)
{
player.is_dead = 1;
player_ragdoll_copy_model( player.phys.rb.v );
{
player.is_dead = 1;
player_ragdoll_copy_model( player.phys.rb.v );
- world_routes_clear();
}
}
}
}