X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=player_skate.c;h=e591d171db98f6a3c46ee2e3d91855fa97e88914;hb=71b7175073e0c764c3c5cb0c7ceee0f8cca09e58;hp=63315a80d6830889219717348ff47c5641d9ef96;hpb=60b814f700fb47b6730d603dd85a5affad67272e;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/player_skate.c b/player_skate.c index 63315a8..e591d17 100644 --- a/player_skate.c +++ b/player_skate.c @@ -2716,6 +2716,7 @@ static void player__skate_animate(void){ animator->grind_balance = vg_lerpf( animator->grind_balance, grind_frame, 5.0f*vg.time_delta ); + animator->activity = state->activity; /* pushing */ animator->push_time = vg.time - state->start_push; @@ -2872,6 +2873,7 @@ static void player__skate_animate(void){ } else q_identity( animator->qfixuptotal ); rb_extrapolate( &localplayer.rb, animator->root_co, animator->root_q ); + v3_copy( localplayer.rb.v, animator->root_v ); } static void player__skate_pose( void *_animator, player_pose *pose ){ @@ -3097,6 +3099,63 @@ static void player__skate_pose( void *_animator, player_pose *pose ){ } } +static void player__skate_effects( void *_animator, m4x3f *final_mtx, + struct player_board *board, + struct player_effects_data *effect_data ){ + + struct skeleton *sk = &localplayer.skeleton; + struct player_skate_animator *animator = _animator; + + if( animator->grind > 0.5f ){ + v3f vp0, vp1, vpc; + if( board ){ + v3_copy((v3f){0.0f,0.02f, board->truck_positions[0][2]}, vp1 ); + v3_copy((v3f){0.0f,0.02f, board->truck_positions[1][2]}, vp0 ); + } + else{ + v3_zero( vp0 ); + v3_zero( vp1 ); + } + + v3f *board_mtx = final_mtx[ localplayer.id_board ]; + m4x3_mulv( board_mtx, vp0, vp0 ); + m4x3_mulv( board_mtx, vp1, vp1 ); + v3_add( vp0, vp1, vpc ); + v3_muls( vpc, 0.5f, vpc ); + + int back = 0, front = 0, mid = 0; + + if( animator->activity == k_skate_activity_grind_5050 ){ + back = 1; + front = 1; + } + else if( animator->activity == k_skate_activity_grind_back50 ){ + back = 1; + } + else if( animator->activity == k_skate_activity_grind_front50 ){ + front = 1; + } + else if( animator->activity == k_skate_activity_grind_boardslide ){ + mid = 1; + } + + if( back ){ + effect_spark_apply( &effect_data->spark, vp0, + animator->root_v, vg.time_delta ); + } + + if( front ){ + effect_spark_apply( &effect_data->spark, vp1, + animator->root_v, vg.time_delta ); + } + + if( mid ){ + effect_spark_apply( &effect_data->spark, vpc, + animator->root_v, vg.time_delta ); + } + } +} + static void player__skate_post_animate(void){ struct player_skate_state *state = &player_skate.state; localplayer.cam_velocity_influence = 1.0f; @@ -3205,6 +3264,8 @@ static void player__skate_animator_exchange( bitpack_ctx *ctx, void *data ){ bitpack_qf32( ctx, 16, 0.0f, 120.0f, &animator->push_time ); bitpack_qf32( ctx, 16, 0.0f, 120.0f, &animator->jump_time ); + bitpack_qv3f( ctx, 16, -100.0f, 100.0f, animator->root_v ); + bitpack_bytes( ctx, 1, &animator->activity ); } static void player__skate_sfx_oneshot( u8 id, v3f pos, f32 volume ){