add logs for fall off reason
[carveJwlIkooP6JGAAIwe30JlM.git] / player_glide.h
index e50fde3755b77d14e0032a69bdaebab02b7caf64..9889eb4f35f322ed13d669fdb1c5cc339ddba694 100644 (file)
@@ -4,7 +4,7 @@
 #include "player.h"
 
 struct player_glide {
-   struct skeleton_anim *anim_temp;
+   struct skeleton_anim *anim_glide;
 
    struct player_glide_animator {
       v3f root_co;
@@ -17,8 +17,67 @@ struct player_glide {
        info_drag;
 
    u32 ticker;
+
+   rigidbody rb;
+
+   f32 t;
+
+   struct {
+      v3f co, euler;
+      m4x3f mdl;
+      
+      union {
+         rb_capsule inf;
+         f32 r;
+      };
+
+      enum rb_shape shape;
+      bool is_damage;
+   }
+   parts[4];
+
+   mdl_context glider;
+   GLuint *glider_textures;
+   glmesh glider_mesh;
 }
-static player_glide;
+static player_glide = {
+   .parts = {
+      {
+         .co    = { 1.0f, 0.5f, -1.0f },
+         .euler = { VG_TAUf*0.25f,  VG_TAUf*0.125f, 0.0f },
+         .shape = k_rb_shape_capsule,
+         .inf   = { .h = 2.82842712475f, .r = 0.25f },
+      },
+      {
+         .co    = { -1.0f, 0.5f, -1.0f },
+         .euler = { VG_TAUf*0.25f, -VG_TAUf*0.125f, 0.0f },
+         .shape = k_rb_shape_capsule,
+         .inf   = { .h = 2.82842712475f, .r = 0.25f },
+      },
+      {
+         .co    = {  0.0f, 0.5f, 1.0f },
+         .euler = { VG_TAUf*0.25f, VG_TAUf*0.25f, 0.0f },
+         .shape = k_rb_shape_capsule,
+         .inf   = { .h = 6.0f, .r = 0.25f },
+      },
+      {
+         .co    = {  0.0f, -0.5f, 0.0f },
+         .euler = { VG_TAUf*0.25f, VG_TAUf*0.25f, 0.0f },
+         .shape = k_rb_shape_capsule,
+         .inf   = { .h = 2.0f, .r = 0.25f },
+         .is_damage = 1,
+      },
+
+#if 0
+      {
+         .co    = { 0.0f, 0.0f, 0.0f },
+         .euler = { 0.0f, 0.0f, 0.0f },
+         .shape = k_rb_shape_sphere,
+         .r     = 0.5f
+      }
+#endif
+   }
+};
 
 static void player_glide_pre_update(void);
 static void player_glide_update(void);
@@ -29,6 +88,9 @@ static void player_glide_pose( void *animator, player_pose *pose );
 static void player_glide_post_animate(void);
 static void player_glide_im_gui(void);
 static void player_glide_bind(void);
+static void player_glide_transition(void);
+static bool glider_physics( v2f steer );
+static void player_glide_animator_exchange( bitpack_ctx *ctx, void *data );
 
 struct player_subsystem_interface static player_subsystem_glide = {
    .pre_update = player_glide_pre_update,
@@ -37,6 +99,7 @@ struct player_subsystem_interface static player_subsystem_glide = {
    .animate = player_glide_animate,
    .pose = player_glide_pose,
    .post_animate = player_glide_post_animate,
+   .network_animator_exchange = player_glide_animator_exchange,
    .im_gui = player_glide_im_gui,
    .bind = player_glide_bind,