dead
[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 {
19 v3_zero( anim->pose[i].co );
20 v3_fill( anim->pose[i].s, 1.0f );
21 q_identity( anim->pose[i].q );
22 }
23 }
24
25 VG_STATIC void player__dead_post_animate( player_instance *player )
26 {
27 struct player_avatar *av = player->playeravatar;
28 struct player_dead *d = &player->_dead;
29
30 copy_ragdoll_pose_to_avatar( &player->ragdoll, player->playeravatar );
31 player->cam_velocity_influence = 1.0f;
32
33 struct ragdoll_part *part = &player->ragdoll.parts[ av->id_hip-1 ];
34
35 v3_lerp( d->co_lpf, part->rb.co, vg.frame_delta*4.0f, d->co_lpf );
36 v3_lerp( d->v_lpf, part->rb.v, vg.frame_delta*4.0f, d->v_lpf );
37 v3_lerp( d->w_lpf, part->rb.w, vg.frame_delta*4.0f, d->w_lpf );
38
39 v3_copy( d->co_lpf, player->rb.co );
40 v3_copy( d->v_lpf, player->rb.v );
41 v3_copy( d->w_lpf, player->rb.w );
42 }
43
44 VG_STATIC void player__dead_im_gui ( player_instance *player )
45 {
46
47 }
48
49 VG_STATIC void player__dead_transition ( player_instance *player )
50 {
51 player->subsystem = k_player_subsystem_dead;
52 copy_avatar_pose_to_ragdoll( player->playeravatar, &player->ragdoll,
53 player->rb.v );
54
55 struct player_avatar *av = player->playeravatar;
56 struct ragdoll_part *part = &player->ragdoll.parts[ av->id_hip-1 ];
57 struct player_dead *d = &player->_dead;
58 v3_copy( part->rb.co, d->co_lpf );
59 v3_copy( part->rb.v, d->v_lpf );
60 v3_copy( part->rb.w, d->w_lpf );
61 }
62
63 #endif /* PLAYER_DEAD_C */