add logs for fall off reason
[carveJwlIkooP6JGAAIwe30JlM.git] / player_glide.h
1 #ifndef PLAYER_GLIDE_H
2 #define PLAYER_GLIDE_H
3
4 #include "player.h"
5
6 struct player_glide {
7 struct skeleton_anim *anim_glide;
8
9 struct player_glide_animator {
10 v3f root_co;
11 v4f root_q;
12 }
13 animator;
14
15 v3f info_lift,
16 info_slip,
17 info_drag;
18
19 u32 ticker;
20
21 rigidbody rb;
22
23 f32 t;
24
25 struct {
26 v3f co, euler;
27 m4x3f mdl;
28
29 union {
30 rb_capsule inf;
31 f32 r;
32 };
33
34 enum rb_shape shape;
35 bool is_damage;
36 }
37 parts[4];
38
39 mdl_context glider;
40 GLuint *glider_textures;
41 glmesh glider_mesh;
42 }
43 static player_glide = {
44 .parts = {
45 {
46 .co = { 1.0f, 0.5f, -1.0f },
47 .euler = { VG_TAUf*0.25f, VG_TAUf*0.125f, 0.0f },
48 .shape = k_rb_shape_capsule,
49 .inf = { .h = 2.82842712475f, .r = 0.25f },
50 },
51 {
52 .co = { -1.0f, 0.5f, -1.0f },
53 .euler = { VG_TAUf*0.25f, -VG_TAUf*0.125f, 0.0f },
54 .shape = k_rb_shape_capsule,
55 .inf = { .h = 2.82842712475f, .r = 0.25f },
56 },
57 {
58 .co = { 0.0f, 0.5f, 1.0f },
59 .euler = { VG_TAUf*0.25f, VG_TAUf*0.25f, 0.0f },
60 .shape = k_rb_shape_capsule,
61 .inf = { .h = 6.0f, .r = 0.25f },
62 },
63 {
64 .co = { 0.0f, -0.5f, 0.0f },
65 .euler = { VG_TAUf*0.25f, VG_TAUf*0.25f, 0.0f },
66 .shape = k_rb_shape_capsule,
67 .inf = { .h = 2.0f, .r = 0.25f },
68 .is_damage = 1,
69 },
70
71 #if 0
72 {
73 .co = { 0.0f, 0.0f, 0.0f },
74 .euler = { 0.0f, 0.0f, 0.0f },
75 .shape = k_rb_shape_sphere,
76 .r = 0.5f
77 }
78 #endif
79 }
80 };
81
82 static void player_glide_pre_update(void);
83 static void player_glide_update(void);
84 static void player_glide_post_update(void);
85 static void player_glide_animate(void);
86 static void player_glide_pose( void *animator, player_pose *pose );
87
88 static void player_glide_post_animate(void);
89 static void player_glide_im_gui(void);
90 static void player_glide_bind(void);
91 static void player_glide_transition(void);
92 static bool glider_physics( v2f steer );
93 static void player_glide_animator_exchange( bitpack_ctx *ctx, void *data );
94
95 struct player_subsystem_interface static player_subsystem_glide = {
96 .pre_update = player_glide_pre_update,
97 .update = player_glide_update,
98 .post_update = player_glide_post_update,
99 .animate = player_glide_animate,
100 .pose = player_glide_pose,
101 .post_animate = player_glide_post_animate,
102 .network_animator_exchange = player_glide_animator_exchange,
103 .im_gui = player_glide_im_gui,
104 .bind = player_glide_bind,
105
106 .animator_data = &player_glide.animator,
107 .animator_size = sizeof(player_glide.animator),
108 .name = "Glide"
109 };
110
111 #endif /* PLAYER_GLIDE_H */