if( button_down(k_srbind_sit) ){
v3_zero( localplayer.rb.v );
w->state.activity = k_walk_activity_sit;
+ w->state.transition_t = 0.0f;
return;
}
static void player_walk_pose_transition(
struct player_walk_animator *animator, struct skeleton_anim *anim,
enum walk_transition_type type,
- mdl_keyframe apose[32], player_pose *pose ){
+ mdl_keyframe apose[32], f32 *mask, player_pose *pose ){
mdl_keyframe bpose[32];
q_mul( kf_board->q, qyaw, kf_board->q );
q_normalize( kf_board->q );
- skeleton_lerp_pose( sk, apose, bpose, blend, pose->keyframes );
+ if( mask ){
+ for( i32 i=0; i<sk->bone_count-1; i ++ )
+ keyframe_lerp( apose+i, bpose+i, blend*mask[i], pose->keyframes+i );
+ }
+ else
+ skeleton_lerp_pose( sk, apose, bpose, blend, pose->keyframes );
}
static void player__walk_pose( void *_animator, player_pose *pose ){
}
else if( animator->activity == k_walk_activity_odrop_in ){
player_walk_pose_transition(
- animator, w->anim_drop_in, k_walk_transition_out, apose, pose );
+ animator, w->anim_drop_in, k_walk_transition_out, apose,
+ NULL, pose );
}
else if( animator->activity == k_walk_activity_oair ){
player_walk_pose_transition(
- animator, w->anim_jump_to_air, k_walk_transition_out, apose, pose );
+ animator, w->anim_jump_to_air, k_walk_transition_out, apose,
+ NULL, pose );
}
else if( animator->activity == k_walk_activity_oregular ){
player_walk_pose_transition(
- animator, w->anim_intro, k_walk_transition_out, apose, pose );
+ animator, w->anim_intro, k_walk_transition_out, apose,
+ NULL, pose );
}
else if( animator->activity == k_walk_activity_ipopoff ){
- player_walk_pose_transition(
- animator, w->anim_popoff, k_walk_transition_in, apose, pose );
+ if( animator->run > 0.2f ){
+ f32 t = 1.0f-vg_minf( animator->run-0.2f, 1.0f ),
+ mask[ 32 ];
+
+ for( u32 i=0; i<32; i ++ )
+ mask[i] = 1.0f;
+
+ mask[ localplayer.id_ik_foot_l-1 ] = t;
+ mask[ localplayer.id_ik_foot_r-1 ] = t;
+ mask[ localplayer.id_ik_knee_l-1 ] = t;
+ mask[ localplayer.id_ik_knee_r-1 ] = t;
+ mask[ localplayer.id_hip-1 ] = t;
+ player_walk_pose_transition(
+ animator, w->anim_popoff, k_walk_transition_in, apose,
+ mask, pose );
+ }
+ else{
+ player_walk_pose_transition(
+ animator, w->anim_popoff, k_walk_transition_in, apose,
+ NULL, pose );
+ }
}
else {
skeleton_copy_pose( sk, apose, pose->keyframes );
bitpack_qv3f( ctx, 24, -1024.0f, 1024.0f, animator->root_co );
bitpack_qquat( ctx, animator->root_q );
bitpack_qf32( ctx, 8, 0.0f, 1.0f, &animator->fly );
- bitpack_qf32( ctx, 8, 0.0f, 1.0f, &animator->run );
- bitpack_qf32( ctx, 8, 0.0f, 1.0f, &animator->walk );
+ bitpack_qf32( ctx, 8, 0.0f, k_runspeed, &animator->run );
bitpack_qf32( ctx, 16, 0.0f, 120.0f, &animator->walk_timer );
for( int i=0; i<1; i++ ){ /* without this you get a warning from gcc. lol */