foxygit / doom Log in
commit 9972c330a53315b3cf7e20dcca562f4fa8c26b89
Author:     Simon Howard <fraggle@soulsphere.org>
AuthorDate: Mon Mar 25 09:49:10 2019 -1000
Commit:     Simon Howard <fraggle@soulsphere.org>
CommitDate: Mon Mar 25 09:49:10 2019 -1000

    Fix mouse speed box in accelerating case.

    This got broken in #797. The calculation in the accelerating case when
    the speed is below the threshold is not the same as in the
    non-accelerating case. This was causing the thermometer to be very low
    when below the threshold rather than a smooth transition.
---
 src/v_video.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/v_video.c b/src/v_video.c
index a73d3be0..0efc0422 100644
--- a/src/v_video.c
+++ b/src/v_video.c
@@ -959,7 +959,11 @@ void V_DrawMouseSpeedBox(int speed)

     // Calculate line length

-    if (draw_acceleration && speed >= mouse_threshold)
+    if (!draw_acceleration)
+    {
+        linelen = speed / linelen_multiplier;
+    }
+    else if (speed >= mouse_threshold)
     {
         // Undo acceleration and get back the original mouse speed
         original_speed = speed - mouse_threshold;
@@ -970,7 +974,7 @@ void V_DrawMouseSpeedBox(int speed)
     }
     else
     {
-        linelen = speed / linelen_multiplier;
+        linelen = (speed * redline_x) / mouse_threshold;
     }

     // Draw horizontal "thermometer"