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:
parent
586a4a3a84
commit
6e69ed3390
@ -398,7 +398,7 @@ void SDLDriver::input(InputType type, int id0, int id1, int id2, int value)
|
|||||||
// Notify the completion of the input sensing.
|
// Notify the completion of the input sensing.
|
||||||
menu->handle(GA_SENSE_COMPLETE, 0);
|
menu->handle(GA_SENSE_COMPLETE, 0);
|
||||||
}
|
}
|
||||||
}
|
} // if mode==INPUT_SENSE
|
||||||
else if (ga != GA_NULL)
|
else if (ga != GA_NULL)
|
||||||
{
|
{
|
||||||
if(type==IT_MOUSEBUTTON)
|
if(type==IT_MOUSEBUTTON)
|
||||||
@ -550,14 +550,24 @@ void SDLDriver::input()
|
|||||||
// state. This allows us to regard two directions of an axis
|
// state. This allows us to regard two directions of an axis
|
||||||
// as completely independent input variants (as if they where
|
// as completely independent input variants (as if they where
|
||||||
// two buttons).
|
// 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]
|
if (stickInfos[ev.jaxis.which]
|
||||||
->m_prevAxisDirections[ev.jaxis.axis] == AD_NEGATIVE)
|
->m_prevAxisDirections[ev.jaxis.axis] == AD_NEGATIVE)
|
||||||
input(IT_STICKMOTION, !mode ? 0 : stickIndex,
|
input(IT_STICKMOTION, !mode ? 0 : stickIndex,
|
||||||
ev.jaxis.axis, AD_NEGATIVE, 0);
|
ev.jaxis.axis, AD_NEGATIVE, 1);
|
||||||
else if (stickInfos[ev.jaxis.which]
|
else if (stickInfos[ev.jaxis.which]
|
||||||
->m_prevAxisDirections[ev.jaxis.axis] == AD_POSITIVE)
|
->m_prevAxisDirections[ev.jaxis.axis] == AD_POSITIVE)
|
||||||
input(IT_STICKMOTION, !mode ? 0 : stickIndex,
|
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]
|
stickInfos[ev.jaxis.which]->m_prevAxisDirections[ev.jaxis.axis]
|
||||||
= AD_NEUTRAL;
|
= AD_NEUTRAL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user