X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=player_walk.c;h=1e15afcd0ed2eb68835904ebd008394d05413d71;hb=refs%2Fheads%2Fmenu2;hp=68415dd7d4c619907ec295ba8e3460415928452d;hpb=5f6a4f9df6c8accc89f1920bfe9ace3cbac4c4b6;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/player_walk.c b/player_walk.c index 68415dd..1e15afc 100644 --- a/player_walk.c +++ b/player_walk.c @@ -1,5 +1,3 @@ -#pragma once - #include "vg/vg_rigidbody_collision.h" #include "skaterift.h" @@ -24,6 +22,7 @@ struct player_subsystem_interface player_subsystem_walk = .post_animate = player__walk_post_animate, .pose = player__walk_pose, .network_animator_exchange = player__walk_animator_exchange, + .sfx_oneshot = player__walk_sfx_oneshot, .animator_data = &player_walk.animator, .animator_size = sizeof(player_walk.animator), @@ -470,17 +469,7 @@ static void player_walk_update_generic(void){ v3_zero( localplayer.rb.w ); world_instance *world = world_current_instance(); - - if( world->water.enabled ){ - if( localplayer.rb.co[1]+0.4f < world->water.height ){ - player__networked_sfx( k_player_subsystem_walk, 32, - k_player_walk_soundeffect_splash, - localplayer.rb.co, 1.0f ); - vg_info( "player fell of due to walking into walker\n" ); - player__dead_transition( k_player_die_type_generic ); - return; - } - } + if( !world_water_player_safe( world, 0.4f ) ) return; enum walk_activity prev_state = w->state.activity; @@ -926,7 +915,8 @@ void player__walk_animate(void){ } static void player_walk_pose_sit( struct player_walk_animator *animator, - player_pose *pose ){ + player_pose *pose ) +{ mdl_keyframe bpose[32]; struct player_walk *w = &player_walk; @@ -1048,7 +1038,9 @@ void player__walk_pose( void *_animator, player_pose *pose ){ /* sit */ if( (animator->activity == k_walk_activity_sit) || - (animator->activity == k_walk_activity_sit_up) ){ + (animator->activity == k_walk_activity_sit_up) ) + { + skeleton_copy_pose( sk, apose, pose->keyframes ); player_walk_pose_sit( animator, pose ); } else if( animator->activity == k_walk_activity_odrop_in ){ @@ -1102,16 +1094,18 @@ void player__walk_post_animate(void){ } -void player__walk_im_gui(void){ +void player__walk_im_gui( ui_context *ctx ) +{ struct player_walk *w = &player_walk; - player__debugtext( 1, "V: %5.2f %5.2f %5.2f (%5.2fm/s)", + player__debugtext( ctx, 1, "V: %5.2f %5.2f %5.2f (%5.2fm/s)", localplayer.rb.v[0], localplayer.rb.v[1], localplayer.rb.v[2], v3_length(localplayer.rb.v) ); - player__debugtext( 1, "CO: %5.2f %5.2f %5.2f",localplayer.rb.co[0], + player__debugtext( ctx, + 1, "CO: %5.2f %5.2f %5.2f",localplayer.rb.co[0], localplayer.rb.co[1], localplayer.rb.co[2] ); - player__debugtext( 1, "transition: %5.2f ", w->state.transition_t ); - player__debugtext( 1, "activity: %s\n", + player__debugtext( ctx, 1, "transition: %5.2f ", w->state.transition_t ); + player__debugtext( ctx, 1, "activity: %s\n", (const char *[]){ "air", "ground", "sit", @@ -1122,7 +1116,7 @@ void player__walk_im_gui(void){ "odrop_in", "oregular" } [w->state.activity] ); - player__debugtext( 1, "surface: %s\n", + player__debugtext( ctx, 1, "surface: %s\n", (const char *[]){ "concrete", "wood", "grass", @@ -1204,7 +1198,8 @@ void player__walk_animator_exchange( bitpack_ctx *ctx, void *data ){ bitpack_qf32( ctx, 16, -100.0f, 100.0f, &animator->board_yaw ); } -void player__walk_sfx_oneshot( u8 id, v3f pos, f32 volume ){ +void player__walk_sfx_oneshot( u8 id, v3f pos, f32 volume ) +{ audio_lock(); if( id == k_player_walk_soundeffect_splash ){