semantics and world reloading
[carveJwlIkooP6JGAAIwe30JlM.git] / player_common.c
index f807e3a580f2213b41700d96fc85b9c7e15d73ef..ee597d0271e4ba0c2cc3d65e310d62a6eb6da0ca 100644 (file)
@@ -5,6 +5,7 @@
 #include "player.h"
 #include "conf.h"
 #include "input.h"
+#include "menu.h"
 
 VG_STATIC float
    k_cam_spring            = 20.0f,
@@ -239,23 +240,23 @@ VG_STATIC void player_look( player_instance *player, v3f angles )
 {
    if( vg_ui.wants_mouse ) return;
 
+   float sensitivity = 1.0f-menu.factive;
+
    angles[2] = 0.0f;
 
    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( cl_invert_y ) mouse_input[1] *= -1.0f;
+   v2_muladds( angles, mouse_input, 0.0025f * sensitivity, angles );
 
    v2f jlook;
    joystick_state( k_srjoystick_look, jlook );
 
-   angles[0] += jlook[0] * vg.time_delta * 4.0f;
+   angles[0] += jlook[0] * vg.time_delta * 4.0f * sensitivity;
    float input_y = jlook[1] * vg.time_delta * 4.0f;
-   if( cl_invert_y )
-      input_y *= -1.0f;
+   if( cl_invert_y ) input_y *= -1.0f;
 
-   angles[1] += input_y;
+   angles[1] += input_y * sensitivity;
    angles[1] = vg_clampf( angles[1], -VG_PIf*0.5f, VG_PIf*0.5f );
 }