basic dead device and some comments for next time
[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 copy_ragdoll_pose_to_avatar( &player->ragdoll, player->playeravatar );
27 }
28
29 VG_STATIC void player_dead_ui( player_interface *player,
30 player_attachment *at )
31 {
32 }
33
34 VG_STATIC void player_dead_bind( player_interface *player,
35 player_attachment *at )
36 {
37 copy_avatar_pose_to_ragdoll( player->playeravatar, &player->ragdoll,
38 player->rb.v );
39 }
40
41 VG_STATIC void player_dead_pose( player_interface *player,
42 player_attachment *at,
43 player_pose pose, m4x3f transform )
44 {
45 }
46
47 /* FIXME: player_device_common */
48 VG_STATIC void player_skate_get_camera( player_interface *player,
49 player_attachment *at, camera *cam );
50 VG_STATIC void skate_camera_vector_look( camera *cam, v3f v, float C, float k );
51
52 VG_STATIC void player_dead_get_camera( player_interface *player,
53 player_attachment *at, camera *cam )
54 {
55 struct player_avatar *av = player->playeravatar;
56
57 v3f vp = {-0.1f,1.8f,0.0f},
58 vd = {-1.0f,0.0f,0.0f};
59
60 m4x3_mulv( av->sk.final_mtx[ av->id_head-1 ], vp, cam->pos );
61 m3x3_mulv( av->sk.final_mtx[ av->id_head-1 ], vd, vd );
62
63 v3_zero( cam->angles );
64 cam->fov = 119.0f;
65
66 skate_camera_vector_look( cam, vd, 1.0f, 0.0f );
67 }
68
69 VG_STATIC void player_dead_transport( player_interface *player,
70 player_attachment *at,
71 teleport_gate *gate )
72 {
73 }
74
75 VG_STATIC player_device player_device_dead =
76 {
77 .pre_update = player_dead_pre_update,
78 .update = player_dead_update,
79 .post_update = player_dead_post_update,
80 .get_camera = player_dead_get_camera,
81 .debug_ui = player_dead_ui,
82 .bind = player_dead_bind,
83 #if 0
84 .pose = player_dead_pose,
85 #endif
86 .gate_transport= player_dead_transport
87 };
88 #endif /* PLAYER_DEVICE_DEAD_H */