ref: 03e776bc3cb3be7a0dede3de0fb6af99f43b357f
dir: /doom-mouseglitches/
doom: fix glitchy mouse movement - fix stuttering mouse movement by using all mouse deltas during a tic, not just the last one (G_Responder can be called more than once per tic) - change mouse filtering and sensitivity calculation: divide mouse delta by half, casting to double, and only then multiply by sensitivity 10 * Δ * (sens+5) / 10 → Δ * 0.5 * sens with sens in [1;10] diff -r 121def0aed4d sys/src/games/doom/g_game.c --- a/sys/src/games/doom/g_game.c Thu Jul 12 09:33:33 2018 +0200 +++ b/sys/src/games/doom/g_game.c Sat Jul 14 09:32:51 2018 +0200 @@ -566,8 +566,8 @@ mousebuttons[0] = ev->data1 & 1; mousebuttons[1] = ev->data1 & 2; mousebuttons[2] = ev->data1 & 4; - mousex = ev->data2*(mouseSensitivity+5)/10; - mousey = ev->data3*(mouseSensitivity+5)/10; + mousex += ev->data2*0.5*(mouseSensitivity+1); + mousey += ev->data3*0.5*(mouseSensitivity+1); return true; // eat events case ev_joystick: diff -r 121def0aed4d sys/src/games/doom/i_video.c --- a/sys/src/games/doom/i_video.c Thu Jul 12 09:33:33 2018 +0200 +++ b/sys/src/games/doom/i_video.c Sat Jul 14 09:32:51 2018 +0200 @@ -362,8 +362,8 @@ e.type = ev_mouse; e.data1 = m.buttons; - e.data2 = 10*(m.xy.x - om.xy.x); - e.data3 = 10*(om.xy.y - m.xy.y); + e.data2 = m.xy.x - om.xy.x; + e.data3 = om.xy.y - m.xy.y; D_PostEvent(&e); om = m; diff -r 121def0aed4d sys/src/games/doom/m_menu.c --- a/sys/src/games/doom/m_menu.c Thu Jul 12 09:33:33 2018 +0200 +++ b/sys/src/games/doom/m_menu.c Sat Jul 14 09:32:51 2018 +0200 @@ -945,7 +945,7 @@ W_CacheLumpName(msgNames[showMessages],PU_CACHE)); M_DrawThermo(OptionsDef.x,OptionsDef.y+LINEHEIGHT*(mousesens+1), - 10,mouseSensitivity); + 9,mouseSensitivity); M_DrawThermo(OptionsDef.x,OptionsDef.y+LINEHEIGHT*(scrnsize+1), 9,screenSize); @@ -1099,7 +1099,7 @@ mouseSensitivity--; break; case 1: - if (mouseSensitivity < 9) + if (mouseSensitivity < 8) mouseSensitivity++; break; }