Small cleanup.

This commit is contained in:
Themaister 2011-06-11 22:46:51 +02:00
parent a2fea86c92
commit d744167865
1 changed files with 18 additions and 15 deletions

View File

@ -91,6 +91,9 @@ static bool sdl_key_pressed(int key)
#ifndef HAVE_DINPUT #ifndef HAVE_DINPUT
static bool sdl_joykey_pressed(sdl_input_t *sdl, int port_num, uint16_t joykey) static bool sdl_joykey_pressed(sdl_input_t *sdl, int port_num, uint16_t joykey)
{ {
if (joykey == NO_BTN)
return false;
// Check hat. // Check hat.
if (GET_HAT_DIR(joykey)) if (GET_HAT_DIR(joykey))
{ {
@ -131,8 +134,9 @@ static bool sdl_joykey_pressed(sdl_input_t *sdl, int port_num, uint16_t joykey)
static bool sdl_axis_pressed(sdl_input_t *sdl, int port_num, uint32_t joyaxis) static bool sdl_axis_pressed(sdl_input_t *sdl, int port_num, uint32_t joyaxis)
{ {
if (joyaxis != AXIS_NONE) if (joyaxis == AXIS_NONE)
{ return false;
if (AXIS_NEG_GET(joyaxis) < sdl->num_axes[port_num]) if (AXIS_NEG_GET(joyaxis) < sdl->num_axes[port_num])
{ {
Sint16 val = SDL_JoystickGetAxis(sdl->joysticks[port_num], AXIS_NEG_GET(joyaxis)); Sint16 val = SDL_JoystickGetAxis(sdl->joysticks[port_num], AXIS_NEG_GET(joyaxis));
@ -147,7 +151,6 @@ static bool sdl_axis_pressed(sdl_input_t *sdl, int port_num, uint32_t joyaxis)
if (scaled > g_settings.input.axis_threshold) if (scaled > g_settings.input.axis_threshold)
return true; return true;
} }
}
return false; return false;
} }