X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=player.h;h=c98f10c83654c9744c2e51802cdc2b7223dfd8e1;hb=f7db507815e2822d971031c30f25e02b45e9c914;hp=7b5eeaa882158316eb7c9befe4f91700679cdb8a;hpb=75703291fbf045008a3b1ebb20fc46a2617b6b3b;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/player.h b/player.h index 7b5eeaa..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; @@ -299,14 +299,6 @@ VG_STATIC void player_init(void) /* 1 rb_init( &player.collide_front ); rb_init( &player.collide_back ); - vg_convar_push( (struct vg_convar){ - .name = "cl_playermdl_id", - .data = &cl_playermdl_id, - .data_type = k_convar_dtype_i32, - .opt_i32 = { .min=0, .max=2, .clamp=1 }, - .persistent = 1 - }); - vg_convar_push( (struct vg_convar){ .name = "gwalk_speed", .data = &k_walkspeed, @@ -595,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 ) { @@ -687,8 +679,6 @@ VG_STATIC void player_update_post(void) player.rewind_sound_wait = 0; } } - - } int i0 = floorf( player.rewind_time ), @@ -707,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(); @@ -725,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,