X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=player_walk.c;h=38429c7c531be3c6dabf9266a9d094df0886ae63;hb=78cc452a8343821ba47c0905d755657847dafd25;hp=eacdeeb2f4634ced916fd6528df10f0c0cba80c5;hpb=7b4f1548e85202dd34e4f849e56e042d73dbb6f2;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/player_walk.c b/player_walk.c index eacdeeb..38429c7 100644 --- a/player_walk.c +++ b/player_walk.c @@ -932,7 +932,7 @@ enum walk_transition_type { 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]; @@ -961,7 +961,12 @@ static void player_walk_pose_transition( 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; ibone_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 ){ @@ -1018,19 +1023,41 @@ 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 );