1 #ifndef PLAYER_DEVICE_DEAD_H
2 #define PLAYER_DEVICE_DEAD_H
4 #include "player_interface.h"
6 #include "player_model.h"
8 struct player_device_dead
12 VG_STATIC
void player_dead_pre_update( player_interface
*player
,
13 player_attachment
*at
)
17 VG_STATIC
void player_dead_update( player_interface
*player
,
18 player_attachment
*at
)
20 player_ragdoll_iter( &player
->ragdoll
);
23 VG_STATIC
void player_dead_post_update( player_interface
*player
,
24 player_attachment
*at
)
28 VG_STATIC
void player_dead_ui( player_interface
*player
,
29 player_attachment
*at
)
33 VG_STATIC
void player_dead_bind( player_interface
*player
,
34 player_attachment
*at
)
36 copy_avatar_pose_to_ragdoll( player
->playeravatar
, &player
->ragdoll
,
40 /* FIXME: This should be an optional function */
41 VG_STATIC
void player_dead_animate( player_interface
*player
,
42 player_attachment
*at
)
44 v3_zero( at
->pose_root_co
);
45 q_identity( at
->pose_root_q
);
47 for( int i
=0; i
<vg_list_size( at
->pose
); i
++ )
49 v3_zero( at
->pose
[i
].co
);
50 v3_fill( at
->pose
[i
].s
, 1.0f
);
51 q_identity( at
->pose
[i
].q
);
55 VG_STATIC
void player_dead_post_animate( player_interface
*player
,
56 player_attachment
*at
)
58 struct player_avatar
*av
= player
->playeravatar
;
60 v3_zero( at
->cam_1st
.pos
);
61 v3_zero( at
->cam_1st
.angles
);
62 at
->cam_1st
.fov
= 90.0f
;
64 /* FIXME: This overwrites pose blending, however, do we need to blend with
65 * this device, anyway? */
66 copy_ragdoll_pose_to_avatar( &player
->ragdoll
, player
->playeravatar
);
69 v3f vp
= {-0.1f
,1.8f
,0.0f
},
70 vd
= {-1.0f
,0.0f
,0.0f
};
72 m4x3_mulv( av
->sk
.final_mtx
[ av
->id_head
-1 ], vp
, cam
->pos
);
73 m3x3_mulv( av
->sk
.final_mtx
[ av
->id_head
-1 ], vd
, vd
);
75 v3_zero( cam
->angles
);
78 skate_camera_vector_look( cam
, vd
, 1.0f
, 0.0f
);
82 VG_STATIC
void player_dead_transport( player_interface
*player
,
83 player_attachment
*at
,
88 VG_STATIC player_device player_device_dead
=
90 .pre_update
= player_dead_pre_update
,
91 .update
= player_dead_update
,
92 .post_update
= player_dead_post_update
,
93 .animate
= player_dead_animate
,
94 .post_animate
= player_dead_post_animate
,
95 .debug_ui
= player_dead_ui
,
96 .bind
= player_dead_bind
,
98 .pose
= player_dead_pose
,
101 #endif /* PLAYER_DEVICE_DEAD_H */