Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //full credit to altimor
- float mx = *x, my = *y;
- float scale;
- float mouse_sensitivity = (gHUD.GetSensitivity() != 0) ? gHUD.GetSensitivity() : sensitivity.GetFloat();
- if(m_customaccel == 3) {
- float raw_dist = sqrt(mx * mx + my * my);
- float power = max(0.0f, m_customaccel_exponent - 1.0f);
- float scale = powf(raw_dist, power);
- *x *= mouse_sensitivity * scale;
- *y *= mouse_sensitivity * scale;
- }
- else if(m_customaccel != 0) {
- float raw_mouse_movement_distance = sqrt( mx * mx + my * my );
- float acceleration_scale = m_customaccel_scale.GetFloat();
- float accelerated_sensitivity_max = m_customaccel_max.GetFloat();
- float accelerated_sensitivity_exponent = m_customaccel_exponent.GetFloat();
- float accelerated_sensitivity = ( (float)pow( raw_mouse_movement_distance, accelerated_sensitivity_exponent ) * acceleration_scale + mouse_sensitivity );
- if ( accelerated_sensitivity_max > 0.0001f &&
- accelerated_sensitivity > accelerated_sensitivity_max )
- {
- accelerated_sensitivity = accelerated_sensitivity_max;
- }
- *x *= accelerated_sensitivity;
- *y *= accelerated_sensitivity;
- // Further re-scale by yaw and pitch magnitude if user requests alternate mode 2
- // This means that they will need to up their value for m_customaccel_scale greatly (>40x) since m_pitch/yaw default
- // to 0.022
- if ( m_customaccel.GetInt() == 2 )
- {
- *x *= m_yaw.GetFloat();
- *y *= m_pitch->GetFloat();
- }
- }
- else {
- *x *= mouse_sensitivity;
- *y *= mouse_sensitivity;
- }
Advertisement
Add Comment
Please, Sign In to add comment