Bug#767685: prboom-plus: Cannot move diagonally with joystick
Eric Duhamel
ericxdu23 at gmail.com
Sat Nov 1 20:28:52 UTC 2014
Source: prboom-plus
Severity: normal
Dear Maintainer,
I started using PrBoom-Plus to play Freedoom using a
gamepad with a joystick. While playing, I tried to move forward
and left at the same time by tilting the joystick diagonally.
However, the engine would not respond to input when the joystick
was in this position, and would only respond if the joystick was
tilted full-left or full-forward. I would expect to be able to
move forward and left at the same time in this situation.
I took a look at the code in PrBoom-Plus for joysticks
and found a rather high threshhold ( > 30000 ), while I noticed
my joystick barely reaches over 27000 when titled diagonally.
I've heard many modern joysticks are like this. I made the
following patch that seems to fix the problem based on
PrBoom-Plus in Debian Unstable.
***** BEGIN RAW DIFF for prboom-plus_2.5.1.4~svn4403+dfsg1-1 *****
--- a/src/SDL/i_joy.c
+++ b/src/SDL/i_joy.c
@@ -80,10 +80,10 @@
(SDL_JoystickGetButton(joystick, 6)<<6) |
(SDL_JoystickGetButton(joystick, 7)<<7);
axis_value = SDL_JoystickGetAxis(joystick, 0) / 3000;
- if (abs(axis_value)<10) axis_value=0;
+ if (abs(axis_value)<7) axis_value=0;
ev.data2 = axis_value;
axis_value = SDL_JoystickGetAxis(joystick, 1) / 3000;
- if (abs(axis_value)<10) axis_value=0;
+ if (abs(axis_value)<7) axis_value=0;
ev.data3 = axis_value;
D_PostEvent(&ev);
***** END RAW DIFF for prboom-plus_2.5.1.4~svn4403+dfsg1-1 *****
-- System Information:
Debian Release: jessie/sid
Architecture: i386 (i686)
Kernel: Linux 3.13.0-37-lowlatency (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
More information about the Pkg-games-devel
mailing list