Bugfix: under certain conditions a gamepad could appear to

be locked, i.e. it would steer to the left or right while
the joystick is in 'neutral' position.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2805 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2008-12-29 08:12:24 +00:00
parent 586a4a3a84
commit 6e69ed3390

View File

@ -398,7 +398,7 @@ void SDLDriver::input(InputType type, int id0, int id1, int id2, int value)
// Notify the completion of the input sensing.
menu->handle(GA_SENSE_COMPLETE, 0);
}
}
} // if mode==INPUT_SENSE
else if (ga != GA_NULL)
{
if(type==IT_MOUSEBUTTON)
@ -550,14 +550,24 @@ void SDLDriver::input()
// state. This allows us to regard two directions of an axis
// as completely independent input variants (as if they where
// two buttons).
// FIXME: I don't really see the advantage of this. It esp. has
// the problem that if '0' is passed as steering value to then
// player kart, the steering switches back to the previously
// steering value (think of a sequence press left, press right,
// release right --> steering must switch back to 'left').
// This can result (esp. if the joystick is released quickly)
// in the gamepad apparently being locked in one direction.
// As a work around we pass on a value of '1' - which
// corresponds to a rotation of 1/32767 - straight enough for
// all practical purposes.
if (stickInfos[ev.jaxis.which]
->m_prevAxisDirections[ev.jaxis.axis] == AD_NEGATIVE)
input(IT_STICKMOTION, !mode ? 0 : stickIndex,
ev.jaxis.axis, AD_NEGATIVE, 0);
ev.jaxis.axis, AD_NEGATIVE, 1);
else if (stickInfos[ev.jaxis.which]
->m_prevAxisDirections[ev.jaxis.axis] == AD_POSITIVE)
input(IT_STICKMOTION, !mode ? 0 : stickIndex,
ev.jaxis.axis, AD_POSITIVE, 0);
ev.jaxis.axis, AD_POSITIVE, 1);
stickInfos[ev.jaxis.which]->m_prevAxisDirections[ev.jaxis.axis]
= AD_NEUTRAL;