unlock rendering
[carveJwlIkooP6JGAAIwe30JlM.git] / player_skate.h
index 5177763964cf62d6746b1dd7567512cbe453910b..3d1a9806c93fb70d3dc01d74daa2832199e7ce8d 100644 (file)
@@ -24,9 +24,10 @@ struct player_skate{
       activity,
       activity_prev;
 
-      float reverse,
-            slip;
+      u32 grind_cooldown,
+          surface_cooldown;
 
+      f32 reverse, slip, delayed_slip_dir;
       int manual_direction;
 
       /* tricks */
@@ -36,7 +37,17 @@ struct player_skate{
 
       v3f   trick_vel,     /* measured in units of TAU/s */
             trick_euler;   /* measured in units of TAU */
+      v3f trick_residualv, /* spring */
+          trick_residuald;
+
       float trick_time;
+      enum  trick_type{
+         k_trick_type_none,
+         k_trick_type_kickflip,
+         k_trick_type_shuvit,
+         k_trick_type_treflip
+      }
+      trick_type;
       float gravity_bias;
 
       v3f up_dir;
@@ -63,37 +74,66 @@ struct player_skate{
       v3f    air_init_v,
              air_init_co;
 
+      float land_dist;
+      v3f land_normal;
       v4f smoothed_rotation;
    }
-   state,
-   state_gate_storage;
+   state;
+
+   struct player_skate_animator {
+      v3f root_co;
+      v4f root_q;
+
+      v3f offset,
+          local_cog;
+
+      f32 slide,
+          z,
+          x,
+          fly,
+          grind,
+          grind_balance,
+          stand,
+          push,
+          jump,
+          airdir,
+          weight,
+          trick_foot,
+          slap,
+          subslap,
+          reverse,
+          delayed_slip_dir,
+          grabbing;
+
+      v2f wobble;
+      f32 foot_offset[2];
+
+      v4f qfixuptotal;
+      v4f qflip;
+
+      v3f board_euler;
+      f32 board_lean;
+      v2f steer, grab;
+
+      f32 jump_charge;
+
+      /* linear anims */
+      f32 push_time, jump_time;
+      u8 jump_dir;
+      u8 trick_type;
+   }
+   animator;
 
-   /* animation /audio */
+   /* animation /audio
+    * --------------------------------------------------------------*/
    struct skeleton_anim *anim_stand, *anim_highg, *anim_slide,
                         *anim_air, *anim_grind, *anim_grind_jump,
                         *anim_push,  *anim_push_reverse,
                         *anim_ollie, *anim_ollie_reverse,
                         *anim_grabs, *anim_stop;
-   v3f 
-       board_trick_residualv,
-       board_trick_residuald;
-
-   float blend_slide,
-         blend_z,
-         blend_x,
-         blend_fly,
-         blend_grind,
-         blend_grind_balance,
-         blend_stand,
-         blend_push,
-         blend_jump,
-         blend_airdir,
-         blend_weight,
-         subslap;
 
    /* vectors representing the direction of the axels in localspace */
    v3f truckv0[2];
-   v2f wobble;
 
    audio_channel *aud_main, *aud_slide, *aud_air;
    enum mdl_surface_prop surface, audio_surface;
@@ -110,15 +150,12 @@ struct player_skate{
    }
    main_sample_type;
 
-   player_pose holdout;
-
    /*
     * Physics 
     * ----------------------------------------------------
     */
 
-   float substep,
-         substep_delta;
+   float substep, substep_delta;
 
    struct jump_info{
       v3f   log[50];
@@ -145,19 +182,12 @@ struct player_skate{
    possible_jumps[36];
    u32 possible_jump_count;
 
-   float land_dist;
-   v3f land_normal;
-
    v3f surface_picture,
        weight_distribution,
        grind_vec,
        grind_dir;
 
-   u32 grind_cooldown,
-       surface_cooldown;
-
    float grind_strength;
-
    struct grind_limit{
       v3f ra, n;
       float p;
@@ -166,6 +196,48 @@ struct player_skate{
    u32 limit_count;
 };
 
+struct player_skate_animator_q {
+   v3f root_co;
+   v4f root_q;
+
+   i8 offset[3];
+   i8 local_cog[3];
+   i8 slide,
+      z,
+      x,
+      fly,
+      grind,
+      grind_balance,
+      stand,
+      push,
+      jump,
+      airdir,
+      weight,
+      trick_foot,
+      slap,
+      subslap,
+      reverse,
+      delayed_slip_dir,
+      grabbing;
+
+   i8 wobble[2];
+   i8 foot_offset[2];
+
+   i16 qfixuptotal[4];
+   i16 qflip;
+
+   i16 board_euler[3];
+   i8 steer[2], grab[2];
+
+   u8 jump_charge;
+
+   /* linear anims */
+   i8 push_time, jump_time;
+   u8 jump_dir;
+   u8 trick_type;
+}
+animator;
+
 VG_STATIC float 
    k_friction_lat          = 12.0f,
    k_friction_resistance   = 0.01f,
@@ -184,6 +256,7 @@ VG_STATIC float
    k_cog_damp              = 0.02f,
    k_cog_mass_ratio        = 0.9f,
 
+   k_mmthrow_steer         = 1.0f,
    k_mmthrow_scale         = 6.0f,
    k_mmcollect_lat         = 2.0f,
    k_mmcollect_vert        = 0.0f,
@@ -244,6 +317,7 @@ VG_STATIC void player__skate_register(void)
    VG_VAR_F32( k_mmcollect_lat,        flags=VG_VAR_CHEAT );
    VG_VAR_F32( k_mmcollect_vert,       flags=VG_VAR_CHEAT );
    VG_VAR_F32( k_mmdecay,              flags=VG_VAR_CHEAT );
+   VG_VAR_F32( k_mmthrow_steer,        flags=VG_VAR_CHEAT );
 }
 
 VG_STATIC void player__skate_bind         ( player_instance *player );
@@ -251,14 +325,14 @@ VG_STATIC void player__skate_pre_update   ( player_instance *player );
 VG_STATIC void player__skate_update       ( player_instance *player );
 VG_STATIC void player__skate_post_update  ( player_instance *player );
 VG_STATIC void player__skate_im_gui       ( player_instance *player );
-VG_STATIC void player__skate_animate      ( player_instance *player,
-                                            player_animation *anim );
+VG_STATIC void player__skate_animate      ( player_instance *player );
+VG_STATIC void player__skate_pose( player_instance *player, player_pose *pose );
 VG_STATIC void player__skate_post_animate ( player_instance *player );
 VG_STATIC void player__skate_reset        ( player_instance *player,
                                             ent_spawn *rp );
-VG_STATIC void player__skate_restore( player_instance *player );
 
 VG_STATIC void player__skate_clear_mechanics( player_instance *player );
 VG_STATIC void player__skate_reset_animator( player_instance *player );
 VG_STATIC void player__approximate_best_trajectory( player_instance *player );
+
 #endif /* PLAYER_SKATE_H */