move audio comp to its own thing
[carveJwlIkooP6JGAAIwe30JlM.git] / player_walk.h
index 28e38a4347825b18bd1c9670e53ea6a9c2b38f3a..1cab8eb2ea5d988d8841792bd3f81be17c7fa06b 100644 (file)
@@ -13,7 +13,6 @@ struct player_walk{
    struct player_walk_state{
       v3f prev_pos;
       v3f drop_in_target,
-          drop_in_foot_anchor,
           drop_in_start,
           drop_in_normal;
 
@@ -23,29 +22,28 @@ struct player_walk{
       enum walk_activity{
          k_walk_activity_air,
          k_walk_activity_ground,
-         k_walk_activity_sleep,
-         k_walk_activity_lockedmove,
          k_walk_activity_sit,
-         k_walk_activity_sit_up
+         k_walk_activity_sit_up,
+
+         /* transitions */
+         k_walk_activity_inone,
+         k_walk_activity_ipopoff,
+         k_walk_activity_oair,
+         k_walk_activity_odrop_in,
+         k_walk_activity_oregular,
+
+         k_walk_activity_max,
       }
       activity;
 
-      enum walk_outro{
-         k_walk_outro_none,
-         k_walk_outro_jump_to_air,
-         k_walk_outro_drop_in,
-         k_walk_outro_regular,
-         k_walk_outro_max
-      }
-      outro_type;
-      double outro_start_time;
+      f32 transition_t;
 
       int jump_queued;
       f64 jump_input_time;
 
       f32 walk_timer;
-      f32 sit_t;
       int step_phase;
+      v3f steer;
    }
    state;
 
@@ -54,7 +52,7 @@ struct player_walk{
    enum mdl_surface_prop surface;
    struct skeleton_anim *anim_walk, *anim_run, *anim_idle, *anim_jump,
                         *anim_jump_to_air, *anim_drop_in, *anim_intro,
-                        *anim_sit;
+                        *anim_sit, *anim_popoff;
 
    struct player_walk_animator {
       v3f root_co;
@@ -63,13 +61,10 @@ struct player_walk{
           run,
           walk;
 
-      f32 walk_timer, yaw, pitch;
+      f32 walk_timer, yaw, pitch, board_yaw;
 
-      v3f foot_anchor;
-      enum walk_outro outro_type;
-      f32 outro_t,
-          commit_t,
-          sit_t;
+      enum walk_activity activity;
+      f32 transition_t;
    }
    animator;
 }
@@ -80,12 +75,13 @@ enum player_walk_soundeffect {
 };
 
 static f32
-   k_walkspeed             = 10.0f,
+   k_walkspeed             = 4.4f,
+   k_runspeed              = 10.0f,
    k_airspeed              = 1.2f,
    k_stopspeed             = 4.0f,
    k_walk_accel            = 10.0f,
    k_walk_air_accel        = 7.0f,
-   k_walk_friction         = 10.0f,
+   k_walk_friction         = 6.0f,
    k_walk_step_height      = 0.2f,
 
    k_sit_yaw_limit         = VG_PIf/1.7f,
@@ -93,6 +89,7 @@ static f32
 
 static void player__walk_register(void){
    VG_VAR_F32( k_walkspeed,      flags=VG_VAR_CHEAT );
+   VG_VAR_F32( k_runspeed,       flags=VG_VAR_CHEAT );
    VG_VAR_F32( k_stopspeed,      flags=VG_VAR_CHEAT );
    VG_VAR_F32( k_airspeed,       flags=VG_VAR_CHEAT );
    VG_VAR_F32( k_walk_friction,  flags=VG_VAR_CHEAT );
@@ -108,10 +105,10 @@ static void player__walk_pose        (void *animator, player_pose *pose);
 static void player__walk_post_animate(void);
 static void player__walk_im_gui      (void);
 static void player__walk_bind        (void);
-static void player__walk_transition  (void);
 static void player__walk_reset       (void);
 static void player__walk_restore     (void);
 static void player__walk_animator_exchange( bitpack_ctx *ctx, void *data );
+static void player__walk_transition( bool grounded, f32 board_yaw );
 
 struct player_subsystem_interface static player_subsystem_walk = {
    .system_register = player__walk_register,