Stop the sensitivity toggle from affecting the deadzone size; fix comparisons.
The division & sensitivity toggling should, I think, really be happening in the joystick code in PlayerEntityControls.m. However, this gets things working better for now. git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@2150 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
parent
ccd2f024b5
commit
7c0d723be0
@ -143,6 +143,7 @@ enum {
|
||||
- (NSPoint) getRollPitchAxis;
|
||||
- (NSPoint) getViewAxis;
|
||||
- (double) getAxisState:(int)function;
|
||||
- (double) getSensitivity;
|
||||
- (const BOOL *) getAllButtonStates;
|
||||
|
||||
@end
|
||||
|
@ -84,6 +84,12 @@ JoystickHandler *sSharedStickHandler = nil;
|
||||
}
|
||||
|
||||
|
||||
- (double) getSensitivity
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
|
||||
- (const BOOL *) getAllButtonStates
|
||||
{
|
||||
return butstate;
|
||||
|
@ -2306,6 +2306,7 @@ static NSTimeInterval time_last_frame;
|
||||
MyOpenGLView *gameView = [UNIVERSE gameView];
|
||||
NSPoint virtualStick = NSZeroPoint;
|
||||
double reqYaw = 0.0;
|
||||
double deadzone;
|
||||
|
||||
// TODO: Rework who owns the stick.
|
||||
if(!stickHandler)
|
||||
@ -2313,6 +2314,7 @@ static NSTimeInterval time_last_frame;
|
||||
stickHandler=[gameView getStickHandler];
|
||||
}
|
||||
numSticks=[stickHandler getNumSticks];
|
||||
deadzone = STICK_DEADZONE / [stickHandler getSensitivity];
|
||||
|
||||
/* DJS: Handle inputs on the joy roll/pitch axis.
|
||||
Mouse control on takes precidence over joysticks.
|
||||
@ -2330,8 +2332,8 @@ static NSTimeInterval time_last_frame;
|
||||
virtualStick=[stickHandler getRollPitchAxis];
|
||||
if((virtualStick.x == STICK_AXISUNASSIGNED ||
|
||||
virtualStick.y == STICK_AXISUNASSIGNED) ||
|
||||
(virtualStick.x > -STICK_DEADZONE && virtualStick.x < STICK_DEADZONE &&
|
||||
virtualStick.y > -STICK_DEADZONE && virtualStick.y < STICK_DEADZONE))
|
||||
(fabs(virtualStick.x) < deadzone &&
|
||||
fabs(virtualStick.y) < deadzone))
|
||||
{
|
||||
// Not assigned or deadzoned - set to zero.
|
||||
virtualStick.x=0;
|
||||
@ -2345,7 +2347,7 @@ static NSTimeInterval time_last_frame;
|
||||
}
|
||||
// handle yaw separately from pitch/roll
|
||||
reqYaw = [stickHandler getAxisState: AXIS_YAW];
|
||||
if((reqYaw == STICK_AXISUNASSIGNED) || (reqYaw > -STICK_DEADZONE && reqYaw < STICK_DEADZONE))
|
||||
if((reqYaw == STICK_AXISUNASSIGNED) || fabs(reqYaw) < deadzone)
|
||||
{
|
||||
// Not assigned or deadzoned - set to zero.
|
||||
reqYaw=0;
|
||||
@ -2394,7 +2396,7 @@ static NSTimeInterval time_last_frame;
|
||||
if (flightRoll < stick_roll)
|
||||
flightRoll = stick_roll;
|
||||
}
|
||||
rolling = (fabs(virtualStick.x) > STICK_DEADZONE);
|
||||
rolling = (fabs(virtualStick.x) >= deadzone);
|
||||
}
|
||||
if (!rolling)
|
||||
{
|
||||
@ -2443,7 +2445,7 @@ static NSTimeInterval time_last_frame;
|
||||
if (flightPitch < stick_pitch)
|
||||
flightPitch = stick_pitch;
|
||||
}
|
||||
pitching = (fabs(virtualStick.y) > STICK_DEADZONE);
|
||||
pitching = (fabs(virtualStick.y) >= deadzone);
|
||||
}
|
||||
if (!pitching)
|
||||
{
|
||||
@ -2493,7 +2495,7 @@ static NSTimeInterval time_last_frame;
|
||||
if (flightYaw < stick_yaw)
|
||||
flightYaw = stick_yaw;
|
||||
}
|
||||
yawing = (fabs(reqYaw) > STICK_DEADZONE);
|
||||
yawing = (fabs(reqYaw) >= deadzone);
|
||||
}
|
||||
if (!yawing)
|
||||
{
|
||||
|
@ -171,6 +171,7 @@ enum {
|
||||
- (int) getNumSticks;
|
||||
- (BOOL) getButtonState: (int)function;
|
||||
- (double) getAxisState: (int)function;
|
||||
- (double) getSensitivity;
|
||||
|
||||
// This one just returns a pointer to the entire state array to
|
||||
// allow for multiple lookups with only one objc_sendMsg
|
||||
|
@ -128,6 +128,11 @@ MA 02110-1301, USA.
|
||||
}
|
||||
|
||||
|
||||
- (double) getSensitivity
|
||||
{
|
||||
return precisionMode ? STICK_PRECISIONFAC : 1.0;
|
||||
}
|
||||
|
||||
- (NSArray *)listSticks
|
||||
{
|
||||
int i;
|
||||
|
Loading…
x
Reference in New Issue
Block a user