automatic camera inversing across portals
[carveJwlIkooP6JGAAIwe30JlM.git] / player_device_dead.h
1 #ifndef PLAYER_DEVICE_DEAD_H
2 #define PLAYER_DEVICE_DEAD_H
3
4 #include "player_interface.h"
5 #include "skeleton.h"
6 #include "player_model.h"
7
8 struct player_device_dead
9 {
10 };
11
12 VG_STATIC void player_dead_pre_update( player_interface *player,
13 player_attachment *at )
14 {
15 }
16
17 VG_STATIC void player_dead_update( player_interface *player,
18 player_attachment *at )
19 {
20 player_ragdoll_iter( &player->ragdoll );
21 }
22
23 VG_STATIC void player_dead_post_update( player_interface *player,
24 player_attachment *at )
25 {
26 }
27
28 VG_STATIC void player_dead_ui( player_interface *player,
29 player_attachment *at )
30 {
31 }
32
33 VG_STATIC void player_dead_bind( player_interface *player,
34 player_attachment *at )
35 {
36 copy_avatar_pose_to_ragdoll( player->playeravatar, &player->ragdoll,
37 player->rb.v );
38 }
39
40 /* FIXME: This should be an optional function */
41 VG_STATIC void player_dead_animate( player_interface *player,
42 player_attachment *at )
43 {
44 v3_zero( at->pose_root_co );
45 q_identity( at->pose_root_q );
46
47 for( int i=0; i<vg_list_size( at->pose ); i ++ )
48 {
49 v3_zero( at->pose[i].co );
50 v3_fill( at->pose[i].s, 1.0f );
51 q_identity( at->pose[i].q );
52 }
53 }
54
55 VG_STATIC void player_dead_post_animate( player_interface *player,
56 player_attachment *at )
57 {
58 struct player_avatar *av = player->playeravatar;
59
60 v3_zero( at->cam_1st.pos );
61 v3_zero( at->cam_1st.angles );
62 at->cam_1st.fov = 90.0f;
63
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 );
67
68 #if 0
69 v3f vp = {-0.1f,1.8f,0.0f},
70 vd = {-1.0f,0.0f,0.0f};
71
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 );
74
75 v3_zero( cam->angles );
76 cam->fov = 119.0f;
77
78 skate_camera_vector_look( cam, vd, 1.0f, 0.0f );
79 #endif
80 }
81
82 VG_STATIC void player_dead_transport( player_interface *player,
83 player_attachment *at,
84 teleport_gate *gate )
85 {
86 }
87
88 VG_STATIC player_device player_device_dead =
89 {
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,
97 #if 0
98 .pose = player_dead_pose,
99 #endif
100 };
101 #endif /* PLAYER_DEVICE_DEAD_H */