#define PLAYER_COMMON_C
#include "player.h"
+#include "conf.h"
+
+VG_STATIC float
+ k_cam_spring = 20.0f,
+ k_cam_damp = 6.7f;
VG_STATIC void player_vector_angles( v3f angles, v3f v, float C, float k )
{
angles[0] = yaw;
angles[1] = pitch;
+ angles[2] = 0.0f;
}
VG_STATIC float player_get_heading_yaw( player_instance *player )
vg.frame_delta * 8.0f, player->tpv_offset_smooth );
/* fov -- simple blend */
- /* FIXME: cl_fov */
- player->cam.fov = vg_lerpf( 97.0f, 128.0f, player->camera_type_blend );
+ float fov_skate = vg_lerpf( 97.0f, 135.0f, cl_fov ),
+ fov_walk = vg_lerpf( 90.0f, 110.0f, cl_fov );
+
+ player->cam.fov = vg_lerpf( fov_walk, fov_skate, player->camera_type_blend );
/*
* first person camera
VG_STATIC void player_look( player_instance *player, v3f angles )
{
angles[2] = 0.0f;
- v2_muladds( angles, vg.mouse_delta, 0.0025f, angles );
+
+ v2f mouse_input;
+ v2_copy( vg.mouse_delta, mouse_input );
+ if( cl_invert_y )
+ mouse_input[1] *= -1.0f;
+ v2_muladds( angles, mouse_input, 0.0025f, angles );
if( vg_input.controller_should_use_trackpad_look ){
static v2f last_input;
v2f input = { player->input_js2h->axis.value,
player->input_js2v->axis.value };
+ if( cl_invert_y )
+ input[1] *= -1.0f;
+
if( (v2_length2(last_input) > 0.001f) && (v2_length2(input) > 0.001f) ){
v2_sub( input, last_input, vel );
v2_muls( vel, 1.0f/vg.time_delta, vel );
}
else{
angles[0] += player->input_js2h->axis.value * vg.time_delta * 4.0f;
- angles[1] += player->input_js2v->axis.value * vg.time_delta * 4.0f;
+
+ float input_y = player->input_js2v->axis.value * vg.time_delta * 4.0f;
+ if( cl_invert_y )
+ input_y *= -1.0f;
+
+ angles[1] += input_y;
}
angles[1] = vg_clampf( angles[1], -VG_PIf*0.5f, VG_PIf*0.5f );