the pain is gone
[carveJwlIkooP6JGAAIwe30JlM.git] / player_common.c
index 21d52aa76871c6f978d10f3bda4334ae614e5671..110ee1640e33d0fd85816c44ee6d05a67a5b629d 100644 (file)
@@ -3,6 +3,7 @@
 
 #include "player.h"
 #include "conf.h"
+#include "input.h"
 
 VG_STATIC float
    k_cam_spring            = 20.0f,
@@ -226,6 +227,8 @@ VG_STATIC void player__cam_iterate( player_instance *player )
                  player->cam_override_strength );
    v3_lerp( player->cam.pos, player->cam_override_pos, 
             player->cam_override_strength, player->cam.pos );
+   player->cam.fov = vg_lerpf( player->cam.fov, player->cam_override_fov, 
+                               player->cam_override_strength );
 
    /* portal transitions */
    player_camera_portal_correction( player );
@@ -241,39 +244,15 @@ VG_STATIC void player_look( player_instance *player, v3f angles )
       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;
-      static v2f vel;
-      static v2f vel_smooth;
+   v2f jlook;
+   joystick_state( k_srjoystick_look, jlook );
 
-      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{
-         v2_zero( vel );
-      }
-
-      v2_lerp( vel_smooth, vel, vg.time_delta*8.0f, vel_smooth );
-      
-      v2_muladds( angles, vel_smooth, vg.time_delta, angles );
-      v2_copy( input, last_input );
-   }
-   else{
-      angles[0] += player->input_js2h->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[0] += jlook[0] * vg.time_delta * 4.0f;
+   float input_y = jlook[1] * vg.time_delta * 4.0f;
+   if( cl_invert_y )
+      input_y *= -1.0f;
 
-      angles[1] += input_y;
-   }
+   angles[1] += input_y;
 
    angles[1] = vg_clampf( angles[1], -VG_PIf*0.5f, VG_PIf*0.5f );
 }