mstarr

Current CS GO accel code

Oct 12th, 2014
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. //full credit to altimor
  2.  
  3. float mx = *x, my = *y;
  4.  
  5. float scale;
  6. float mouse_sensitivity = (gHUD.GetSensitivity() != 0) ? gHUD.GetSensitivity() : sensitivity.GetFloat();
  7.  
  8. if(m_customaccel == 3) {
  9. float raw_dist = sqrt(mx * mx + my * my);
  10. float power = max(0.0f, m_customaccel_exponent - 1.0f);
  11.  
  12. float scale = powf(raw_dist, power);
  13. *x *= mouse_sensitivity * scale;
  14. *y *= mouse_sensitivity * scale;
  15. }
  16. else if(m_customaccel != 0) {
  17. float raw_mouse_movement_distance = sqrt( mx * mx + my * my );
  18. float acceleration_scale = m_customaccel_scale.GetFloat();
  19. float accelerated_sensitivity_max = m_customaccel_max.GetFloat();
  20. float accelerated_sensitivity_exponent = m_customaccel_exponent.GetFloat();
  21. float accelerated_sensitivity = ( (float)pow( raw_mouse_movement_distance, accelerated_sensitivity_exponent ) * acceleration_scale + mouse_sensitivity );
  22.  
  23. if ( accelerated_sensitivity_max > 0.0001f &&
  24. accelerated_sensitivity > accelerated_sensitivity_max )
  25. {
  26. accelerated_sensitivity = accelerated_sensitivity_max;
  27. }
  28.  
  29. *x *= accelerated_sensitivity;
  30. *y *= accelerated_sensitivity;
  31.  
  32. // Further re-scale by yaw and pitch magnitude if user requests alternate mode 2
  33. // This means that they will need to up their value for m_customaccel_scale greatly (>40x) since m_pitch/yaw default
  34. // to 0.022
  35. if ( m_customaccel.GetInt() == 2 )
  36. {
  37. *x *= m_yaw.GetFloat();
  38. *y *= m_pitch->GetFloat();
  39. }
  40. }
  41. else {
  42. *x *= mouse_sensitivity;
  43. *y *= mouse_sensitivity;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment