X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=player.h;h=c98f10c83654c9744c2e51802cdc2b7223dfd8e1;hb=f7db507815e2822d971031c30f25e02b45e9c914;hp=0edbbdd44493b66ca2f29808c65edf1dcc68b90f;hpb=147ecb98ce2d6a2b24b0d86436913a46888dea84;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/player.h b/player.h index 0edbbdd..c98f10c 100644 --- a/player.h +++ b/player.h @@ -11,6 +11,7 @@ #define PLAYER_REWIND_FRAMES 60*4 +#include "conf.h" #include "audio.h" #include "common.h" #include "world.h" @@ -44,7 +45,6 @@ VG_STATIC float k_walk_accel = 150.0f, k_walk_friction = 8.0f; -VG_STATIC int cl_playermdl_id = 0; VG_STATIC int freecam = 0; VG_STATIC int walk_grid_iterations = 1; VG_STATIC float fc_speed = 10.0f; @@ -90,8 +90,14 @@ VG_STATIC struct gplayer int rewind_sound_wait; v3f land_target; - v3f land_target_log[22]; - u32 land_target_colours[22]; + + struct land_log + { + v3f positions[50]; + u32 colour; + int count; + } + land_log[22]; int land_log_count; v3f handl_target, handr_target, @@ -287,20 +293,12 @@ VG_STATIC void player_init(void) /* 1 }; for( int i=0; icount - 1; j ++ ) + vg_line( log->positions[j], log->positions[j+1], log->colour ); + + vg_line_cross( log->positions[log->count-1], log->colour, 0.25f ); + } if( player.is_dead ) { @@ -583,8 +587,8 @@ VG_STATIC void player_update_post(void) /* CAMERA POSITIONING: LAYER 0 */ - v2_copy( player.angles, camera_angles ); - v3_copy( player.camera_pos, camera_pos ); + v2_copy( player.angles, main_camera.angles ); + v3_copy( player.camera_pos, main_camera.pos ); if( player.rewinding ) { @@ -675,8 +679,6 @@ VG_STATIC void player_update_post(void) player.rewind_sound_wait = 0; } } - - } int i0 = floorf( player.rewind_time ), @@ -695,17 +697,19 @@ VG_STATIC void player_update_post(void) float blend = (4.0f-player.rewind_time) * 0.25f, c = vg_clampf( blend, 0.0f, 1.0f ); - camera_angles[0] = vg_alerpf(override_angles[0], player.angles[0], c); - camera_angles[1] = vg_lerpf (override_angles[1], player.angles[1], c); - v3_lerp( override_pos, player.camera_pos, c, camera_pos ); + main_camera.angles[0] = + vg_alerpf(override_angles[0], player.angles[0], c); + main_camera.angles[1] = + vg_lerpf (override_angles[1], player.angles[1], c); + v3_lerp( override_pos, player.camera_pos, c, main_camera.pos ); } } - camera_update(); + camera_update_transform( &main_camera ); player_audio(); } -VG_STATIC void draw_player( m4x3f cam ) +VG_STATIC void draw_player( camera *cam ) { if( player.is_dead ) player_model_copy_ragdoll(); @@ -713,8 +717,8 @@ VG_STATIC void draw_player( m4x3f cam ) shader_viewchar_use(); vg_tex2d_bind( &tex_characters, 0 ); shader_viewchar_uTexMain( 0 ); - shader_viewchar_uCamera( cam[3] ); - shader_viewchar_uPv( vg.pv ); + shader_viewchar_uCamera( cam->transform[3] ); + shader_viewchar_uPv( cam->mtx.pv ); shader_link_standard_ub( _shader_viewchar.id, 2 ); glUniformMatrix4x3fv( _uniform_viewchar_uTransforms, player.mdl.sk.bone_count,