From: hgn Date: Fri, 31 Mar 2023 10:52:31 +0000 (+0100) Subject: 0 X-Git-Url: https://harrygodden.com/git/?a=commitdiff_plain;h=d3d41f80ec992fe4e40b8531721b7874b8a7c400;p=carveJwlIkooP6JGAAIwe30JlM.git 0 --- diff --git a/player_skate.c b/player_skate.c index af41d53..b372aa2 100644 --- a/player_skate.c +++ b/player_skate.c @@ -502,7 +502,6 @@ void player__approximate_best_trajectory( player_instance *player ) v3_muladds( ve, basis[1], -gravity * t, ve ); if( skate_grind_scansq( player, closest, ve, 0.5f, &grind ) ){ - /* check alignment */ v2f v0 = { v3_dot( ve, basis[0] ), v3_dot( ve, basis[2] ) }, @@ -520,9 +519,9 @@ void player__approximate_best_trajectory( player_instance *player ) /* check speed */ if( (fabsf(v3_dot( ve, grind.dir ))>=k_grind_axel_min_vel) && - (a >= a_min) ) + (a >= a_min) && + (fabsf(grind.dir[1]) < 0.70710678118654752f)) { - vg_success( "ding\n" ); grind_located = 1; grind_located_gravity = inf->gravity; } @@ -556,25 +555,6 @@ void player__approximate_best_trajectory( player_instance *player ) u32 *tri = &world->scene_geo->arrindices[ idx*3 ]; struct world_surface *surf = world_tri_index_surface(world, tri[0]); -#if 0 - v3f v0, v1; - v3f pa, pb, pc; - - v3_copy( world->scene_geo->arrvertices[tri[0]].co, pa ); - v3_copy( world->scene_geo->arrvertices[tri[1]].co, pb ); - v3_copy( world->scene_geo->arrvertices[tri[2]].co, pc ); - - v3_sub( pb, pa, v0 ); - v3_sub( pc, pa, v1 ); - v3_cross( v0, v1, inf->n ); - v3_normalize( inf->n ); -#endif - /* TODO: - * grind predictions, we want to FORCE it to land in the correct - * location, taking the cloest endpoint or midpoint to be the - * snapper. - */ - inf->type = k_prediction_land; v3f ve; @@ -1155,6 +1135,14 @@ VG_STATIC void skate_integrate( player_instance *player ) * 1 2 or 3 */ +VG_STATIC void skate_copy_holdout( player_instance *player ) +{ + struct player_skate *s = &player->_skate; + struct player_avatar *av = player->playeravatar; + struct skeleton *sk = &av->sk; + skeleton_copy_pose( sk, s->holdout, player->holdout_pose ); +} + VG_STATIC int player_skate_trick_input( player_instance *player ) { return (player->input_trick0->button.value) | @@ -1174,22 +1162,13 @@ VG_STATIC void player__skate_pre_update( player_instance *player ) v3_copy( player->cam.angles, angles ); angles[2] = 0.0f; - player->holdout_time = 0.25f; + skate_copy_holdout( player ); + player->holdout_time = 0.34f; player__skate_kill_audio( player ); player__walk_transition( player, angles ); return; } - if( vg_input_button_down( player->input_reset ) ){ - player->rb.co[1] += 2.0f; - s->state.cog[1] += 2.0f; - q_axis_angle( player->rb.q, (v3f){1.0f,0.0f,0.0f}, VG_PIf * 0.25f ); - v3_zero( player->rb.w ); - v3_zero( player->rb.v ); - - rb_update_transform( &player->rb ); - } - int trick_id; if( (s->state.activity <= k_skate_activity_air_to_grind) && (trick_id = player_skate_trick_input( player )) ) @@ -2678,7 +2657,7 @@ VG_STATIC void player__skate_im_gui( player_instance *player ) } VG_STATIC void player__skate_animate( player_instance *player, - player_animation *dest ) + player_animation *dest ) { struct player_skate *s = &player->_skate; struct player_avatar *av = player->playeravatar; @@ -2819,11 +2798,7 @@ VG_STATIC void player__skate_animate( player_instance *player, { float target = -player->input_js1h->axis.value; -#if 1 s->blend_airdir = vg_lerpf( s->blend_airdir, target, 2.4f*vg.time_delta ); -#else - s->blend_airdir = 0.0f; -#endif float air_frame = (s->blend_airdir*0.5f+0.5f) * (15.0f/30.0f); skeleton_sample_anim( sk, s->anim_air, air_frame, apose ); @@ -3112,7 +3087,7 @@ VG_STATIC void player__skate_animate( player_instance *player, v3_add( rco, rotation_point, dest->root_co ); } - skeleton_copy_pose( sk, dest->pose, player->holdout_pose ); + skeleton_copy_pose( sk, dest->pose, s->holdout ); } VG_STATIC void player__skate_post_animate( player_instance *player ) @@ -3140,19 +3115,45 @@ VG_STATIC void player__skate_reset_animator( player_instance *player ) s->blend_slide = 0.0f; s->blend_z = 0.0f; s->blend_x = 0.0f; + s->blend_grind = 0.0f; + s->blend_grind_balance = 0.0f; s->blend_stand = 0.0f; s->blend_push = 0.0f; s->blend_jump = 0.0f; s->blend_airdir = 0.0f; + s->blend_weight = 0.0f; + s->subslap = 0.0f; + v2_zero( s->wobble ); + + v3_zero( s->board_trick_residuald ); + v3_zero( s->board_trick_residualv ); + v3_zero( s->truckv0[0] ); + v3_zero( s->truckv0[1] ); } VG_STATIC void player__skate_clear_mechanics( player_instance *player ) { struct player_skate *s = &player->_skate; s->state.jump_charge = 0.0f; + s->state.charging_jump = 0; + s->state.jump_dir = 0; + v3_zero( s->state.flip_axis ); + s->state.flip_time = 0.0f; s->state.flip_rate = 0.0f; s->state.reverse = 0.0f; s->state.slip = 0.0f; + s->state.grabbing = 0.0f; + v2_zero( s->state.grab_mouse_delta ); + s->state.slap = 0.0f; + s->state.jump_time = 0.0; + s->state.start_push = 0.0; + s->state.cur_push = 0.0; + s->state.air_start = 0.0; + + v3_zero( s->state.air_init_v ); + v3_zero( s->state.air_init_co ); + + s->state.gravity_bias = k_gravity; v3_copy( player->rb.co, s->state.prev_pos ); v4_copy( player->rb.q, s->state.smoothed_rotation ); v3_zero( s->state.throw_v ); @@ -3162,6 +3163,10 @@ VG_STATIC void player__skate_clear_mechanics( player_instance *player ) s->grind_cooldown = 0; s->surface_cooldown = 0; v3_muladds( player->rb.co, player->rb.to_world[1], 1.0f, s->state.cog ); + v3_copy( player->rb.to_world[1], s->state.up_dir ); + v3_copy( player->rb.to_world[1], s->surface_picture ); + v3_zero( s->weight_distribution ); + v3_copy( player->rb.co, s->state.prev_pos ); } VG_STATIC void player__skate_reset( player_instance *player, diff --git a/player_skate.h b/player_skate.h index 2b7c60e..5bca1a6 100644 --- a/player_skate.h +++ b/player_skate.h @@ -27,11 +27,7 @@ struct player_skate activity, activity_prev; - float /* steery, - steerx, - steery_s, - steerx_s, */ - reverse, + float reverse, slip; int manual_direction; @@ -75,7 +71,6 @@ struct player_skate state, state_gate_storage; - /* animation /audio */ struct skeleton_anim *anim_stand, *anim_highg, *anim_slide, *anim_air, *anim_grind, *anim_grind_jump, @@ -118,6 +113,8 @@ struct player_skate } main_sample_type; + player_pose holdout; + /* * Physics * ---------------------------------------------------- diff --git a/player_walk.c b/player_walk.c index 6b7788c..6d02052 100644 --- a/player_walk.c +++ b/player_walk.c @@ -698,8 +698,7 @@ VG_STATIC void player__walk_animate( player_instance *player, float walk_yaw = player_get_heading_yaw( player ); - if( w->state.outro_anim ) - { + if( w->state.outro_anim ){ struct player_avatar *av = player->playeravatar; float outro_length = (float)w->state.outro_anim->length / w->state.outro_anim->rate, @@ -711,8 +710,7 @@ VG_STATIC void player__walk_animate( player_instance *player, outro_time, bpose ); skeleton_lerp_pose( sk, apose, bpose, outro_t * 10.0f, dest->pose ); - if( w->state.outro_type == k_walk_outro_drop_in ) - { + if( w->state.outro_type == k_walk_outro_drop_in ){ float inv_rate = 1.0f / w->state.outro_anim->rate, anim_frames = w->state.outro_anim->length * inv_rate, step_frames = 12.0f * inv_rate, @@ -744,8 +742,7 @@ VG_STATIC void player__walk_animate( player_instance *player, /* the drop in bit */ - if( step_t >= 1.0f ) - { + if( step_t >= 1.0f ){ v4f final_q; player_walk_drop_in_overhang_transform( player, dop_t, player->rb.co, final_q ); @@ -760,8 +757,7 @@ VG_STATIC void player__walk_animate( player_instance *player, } return; } - else - { + else{ v3_muladds( dest->root_co, player->rb.to_world[1], -0.1f * outro_t, dest->root_co ); @@ -769,8 +765,7 @@ VG_STATIC void player__walk_animate( player_instance *player, player->holdout_time = 1.0f; } } - else - { + else{ skeleton_copy_pose( sk, apose, dest->pose ); }