int JoystickExt(int player_nr, boolean use_as_joystick_nr)
{
- int joystick_fd = joystick.fd[player_nr];
+ int joystick_nr = joystick.nr[player_nr];
int js_x, js_y;
boolean js_b1, js_b2;
int left, right, up, down;
int result = JOY_NO_ACTION;
if (use_as_joystick_nr)
- joystick_fd = player_nr;
+ joystick_nr = player_nr;
if (joystick.status != JOYSTICK_ACTIVATED)
return JOY_NO_ACTION;
- if (joystick_fd < 0)
+ if (joystick_nr < 0)
return JOY_NO_ACTION;
- if (!ReadJoystick(joystick_fd, &js_x, &js_y, &js_b1, &js_b2))
+ if (!ReadJoystick(joystick_nr, &js_x, &js_y, &js_b1, &js_b2))
{
Error(ERR_WARN, "cannot read joystick device '%s'",
setup.input[player_nr].joy.device_name);
joystick_nr = -1;
}
- /* misuse joystick file descriptor variable to store joystick number */
- joystick.fd[i] = joystick_nr;
+ /* store configured joystick number for each player */
+ joystick.nr[i] = joystick_nr;
}
/* now open all connected joysticks (regardless if configured or not) */
/* always start with reliable default values */
joystick.status = JOYSTICK_NOT_AVAILABLE;
for (i = 0; i < MAX_PLAYERS; i++)
- joystick.fd[i] = -1; /* joystick device closed */
+ joystick.nr[i] = -1; /* no joystick configured */
SDLInitJoysticks();
}