After thorough investigation, I have discovered a great deal about the internals of how ZDoom 1.23 and its derivatives handle mouse input which I will try to distill here. This post will be updated as more information is discovered.
Odamex's Mouse Input TypesOdamex uses DirectInput for its mouse input on the Windows platform and as of 0.5.6, it provides two mouse types: Doom and Odamex. The input processing for the two types is identical and the only difference is with regard to the
mouse_sensitivity cvar, where the mouse_sensitivity value with the Doom mouse type is always 5 less than the equivalent mouse_sensitivity value for the Odamex mouse type.
For example, Doom mouse type & mouse_sensitivity = 35 is equivalent to Odamex mouse type & mouse_sensitivity = 40.
ZDoom's Mouse Input TypesThe most important factor relating to mouse input in ZDoom-derived ports is the cvar
in_mouse. With the default value of in_mouse = 0, the game selects the default method of mouse input for the OS, which is using DirectInput (also can be explicitly specified with in_mouse = 2). A value of in_mouse = 1 uses USER32.DLL calls (we'll call this
Win32). The overwhelming majority of players will have in_mouse set to 0 and therefore use the DirectInput mouse type.
ZDoom DirectInput MouseDirectInput (part of the DirectX library) retrieves "raw" mouse input values, unscaled by the OS. This bypasses the Windows mouse sensitivity and acceleration settings. When ZDoom uses this mouse type, it scales the mouse movement values along the x-axis by a factor of 4.0 and does not change the movement values along the y-axis.
Users of this mouse type can easily convert their ZDoom mouse settings to Odamex's Doom mouse type using the following equations:
Doom mouse_sensitivity = (ZDoom mouse_sensitivity * 40) - 5
Doom m_pitch = (ZDoom m_pitch / 4)So using the default ZDoom mouse_sensitivity = 1.0, a user should choose mouse_sensitivity = 35 when using the Doom mouse type in Odamex. Using the default ZDoom m_pitch = 1.0, a user should choose m_pitch = 0.25 with the Doom mouse type in Odamex. Since ZDoom does not offer mouse acceleration, players wanting the same feel in Odamex should set mouse_acceleration to 0.
ZDoom Win32 MouseThe Win32 mouse type gets mouse values from the Windows OS like a normal desktop application. Windows first applies its sensitivity scaling to the user's mouse input and then applies its acceleration curve if the user has not disabled it in the Windows Control Panel. Finally, Windows passes the scaled mouse values to the game.
Windows uses a non-linear table to determine how its Control Panel sensitivity setting will scale the mouse input. Players can scale their Zdoom mouse_sensitivity setting by the following table to match their Windows mouse sensitivity setting.
Windows Sensitivity Factors (when acceleration is disabled)
- 1 0.03125
- 2 0.0625
- 3 0.25
- 4 0.5
- 5 0.75
- 6 1.0
- 7 1.5
- 8 2.0
- 9 2.5
- 10 3.0
- 11 3.5
If a player has not disabled acceleration (sometimes also called Enhanced Pointer Precision) in the Windows Control Panel, they also are subjected to Windows mouse acceleration as well as an different set of sensitivity scaling factors, as seen below.
Windows Sensitivity Factors (with acceleration enabled)
- 1 0.1
- 2 0.2
- 3 0.4
- 4 0.6
- 5 0.8
- 6 1.0
- 7 1.2
- 8 1.4
- 9 1.6
- 10 1.8
- 11 2.0
Describing how the mouse pointer algorithm works is beyond the scope of this posting, however, my testing confirms that this reference (
http://www.teamliquid.net/forum/viewmessage.php?topic_id=157790#13) appears to give a very accurate description of the algorithm used in Windows XP and Vista/7.
Finally, when ZDoom uses the Win32 mouse type, it scales the mouse movement values along the x-axis by a factor of 3.0 and scales movement along the y-axis by a factor of 2.0.
The below equations will allow most players to easily convert their mouse to the Doom mouse type in Odamex. Note that the Windows Sensitivity Factor is given in the above table.
Doom mouse_sensitivity = (30 * (ZDoom mouse_sensitivity) * (Windows Sensitivity Factor)) - 5
Doom m_pitch = 0.5 * (ZDoom m_pitch) * (Windows Sensitivity Factor)
mouse_acceleration = 0 or 2.6 (depending on whether it's enabled in Windows Control Panel)
mouse_threshold = 6Given a player who uses the default mouse_sensitivity = 1.0 and m_pitch = 1.0 in their ZDoom-derived port and uses the default mouse settings in the Windows Control Panel of sensitivity = 6 and acceleration turned on, they should use the following settings:
mouse_type = 0 (Doom mouse type)
mouse_sensitivity = 25
m_pitch = 0.5
mouse_acceleration = 2.6
mouse_threshold = 6