update vg
[carveJwlIkooP6JGAAIwe30JlM.git] / player_dead.c
1 #ifndef PLAYER_DEAD_C
2 #define PLAYER_DEAD_C
3
4 #include "player.h"
5
6 VG_STATIC void player__dead_update ( player_instance *player )
7 {
8 player_ragdoll_iter( &player->ragdoll );
9 }
10
11 VG_STATIC void player__dead_animate ( player_instance *player,
12 player_animation *anim )
13 {
14 v3_zero( anim->root_co );
15 q_identity( anim->root_q );
16
17 for( int i=0; i<vg_list_size( anim->pose ); i ++ ){
18 v3_zero( anim->pose[i].co );
19 v3_fill( anim->pose[i].s, 1.0f );
20 q_identity( anim->pose[i].q );
21 }
22 }
23
24 VG_STATIC void player__dead_post_animate( player_instance *player )
25 {
26 struct player_avatar *av = player->playeravatar;
27 struct player_dead *d = &player->_dead;
28
29 copy_ragdoll_pose_to_avatar( &player->ragdoll, player->playeravatar );
30 player->cam_velocity_influence = 1.0f;
31
32 struct ragdoll_part *part = &player->ragdoll.parts[ av->id_hip-1 ];
33
34 v3_lerp( d->co_lpf, part->obj.rb.co, vg.time_frame_delta*4.0f, d->co_lpf );
35 v3_lerp( d->v_lpf, part->obj.rb.v, vg.time_frame_delta*4.0f, d->v_lpf );
36 v3_lerp( d->w_lpf, part->obj.rb.w, vg.time_frame_delta*4.0f, d->w_lpf );
37
38 v3_copy( d->co_lpf, player->rb.co );
39 v3_copy( d->v_lpf, player->rb.v );
40 v3_copy( d->w_lpf, player->rb.w );
41 }
42
43 VG_STATIC void player__dead_im_gui ( player_instance *player )
44 {
45
46 }
47
48 VG_STATIC void player__dead_transition ( player_instance *player )
49 {
50 player->subsystem = k_player_subsystem_dead;
51 copy_avatar_pose_to_ragdoll( player->playeravatar, &player->ragdoll,
52 player->rb.v );
53
54 struct player_avatar *av = player->playeravatar;
55 struct ragdoll_part *part = &player->ragdoll.parts[ av->id_hip-1 ];
56 struct player_dead *d = &player->_dead;
57 v3_copy( part->obj.rb.co, d->co_lpf );
58 v3_copy( part->obj.rb.v, d->v_lpf );
59 v3_copy( part->obj.rb.w, d->w_lpf );
60 }
61
62 #endif /* PLAYER_DEAD_C */