Advertisement
Guest User

Untitled

a guest
Aug 20th, 2010
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. void CL_MouseMove( usercmd_t *cmd ) {
  2. float mx, my;
  3. float accelSensitivity;
  4. float rate;
  5.  
  6. // allow mouse smoothing
  7. if ( m_filter->integer ) {
  8. mx = ( cl.mouseDx[0] + cl.mouseDx[1] ) * 0.5;
  9. my = ( cl.mouseDy[0] + cl.mouseDy[1] ) * 0.5;
  10. } else {
  11. mx = cl.mouseDx[cl.mouseIndex];
  12. my = cl.mouseDy[cl.mouseIndex];
  13. }
  14. cl.mouseIndex ^= 1;
  15. cl.mouseDx[cl.mouseIndex] = 0;
  16. cl.mouseDy[cl.mouseIndex] = 0;
  17.  
  18. rate = sqrt( mx * mx + my * my ) / (float)frame_msec;
  19. accelSensitivity = cl_sensitivity->value + rate * cl_mouseAccel->value;
  20.  
  21. // scale by FOV
  22. accelSensitivity *= cl.cgameSensitivity;
  23.  
  24. if ( rate && cl_showMouseRate->integer ) {
  25. Com_Printf( "%f : %f\n", rate, accelSensitivity );
  26. }
  27.  
  28. mx *= accelSensitivity;
  29. my *= accelSensitivity;
  30.  
  31. if (!mx && !my) {
  32. return;
  33. }
  34.  
  35. // add mouse X/Y movement to cmd
  36. if ( in_strafe.active ) {
  37. cmd->rightmove = ClampChar( cmd->rightmove + m_side->value * mx );
  38. } else {
  39. cl.viewangles[YAW] -= m_yaw->value * mx;
  40. }
  41.  
  42. if ( (in_mlooking || cl_freelook->integer) && !in_strafe.active ) {
  43. cl.viewangles[PITCH] += m_pitch->value * my;
  44. } else {
  45. cmd->forwardmove = ClampChar( cmd->forwardmove - m_forward->value * my );
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement