projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added support for 'select' key on certain devices (handled as 'return' key)
[rocksndiamonds.git]
/
src
/
libgame
/
sdl.c
diff --git
a/src/libgame/sdl.c
b/src/libgame/sdl.c
index ee43dc05b0c1b1795328b129d1ca0a563f0398e2..8751f1b999dfa4de510e8eacf78aee61a9684e11 100644
(file)
--- a/
src/libgame/sdl.c
+++ b/
src/libgame/sdl.c
@@
-2603,7
+2603,7
@@
static boolean sdl_is_controller[MAX_PLAYERS];
static boolean SDLOpenJoystick(int nr)
{
static boolean SDLOpenJoystick(int nr)
{
- if (nr < 0 || nr > MAX_PLAYERS)
+ if (nr < 0 || nr >
=
MAX_PLAYERS)
return FALSE;
#if defined(TARGET_SDL2)
return FALSE;
#if defined(TARGET_SDL2)
@@
-2631,7
+2631,7
@@
static boolean SDLOpenJoystick(int nr)
static void SDLCloseJoystick(int nr)
{
static void SDLCloseJoystick(int nr)
{
- if (nr < 0 || nr > MAX_PLAYERS)
+ if (nr < 0 || nr >
=
MAX_PLAYERS)
return;
#if 1
return;
#if 1
@@
-2659,7
+2659,7
@@
static void SDLCloseJoystick(int nr)
boolean SDLCheckJoystickOpened(int nr)
{
boolean SDLCheckJoystickOpened(int nr)
{
- if (nr < 0 || nr > MAX_PLAYERS)
+ if (nr < 0 || nr >
=
MAX_PLAYERS)
return FALSE;
#if defined(TARGET_SDL2)
return FALSE;
#if defined(TARGET_SDL2)
@@
-2680,6
+2680,9
@@
static void setJoystickAxis(int nr, int axis_id_raw, int axis_value)
int axis_id = axis_id_raw % 2;
#endif
int axis_id = axis_id_raw % 2;
#endif
+ if (nr < 0 || nr >= MAX_PLAYERS)
+ return;
+
if (axis_id == -1)
return;
if (axis_id == -1)
return;
@@
-2723,6
+2726,9
@@
static void setJoystickButton(int nr, int button_id_raw, int button_state)
int button_id = button_id_raw % 2;
#endif
int button_id = button_id_raw % 2;
#endif
+ if (nr < 0 || nr >= MAX_PLAYERS)
+ return;
+
if (button_id == -1)
return;
if (button_id == -1)
return;
@@
-2913,8
+2919,8
@@
void SDLInitJoysticks()
joystick_nr = -1;
}
joystick_nr = -1;
}
- /*
misuse joystick file descriptor variable to store joystick numb
er */
- joystick.
fd
[i] = joystick_nr;
+ /*
store configured joystick number for each play
er */
+ joystick.
nr
[i] = joystick_nr;
}
/* now open all connected joysticks (regardless if configured or not) */
}
/* now open all connected joysticks (regardless if configured or not) */
@@
-2960,11
+2966,12
@@
static void DrawTouchInputOverlay()
static int alpha_step = 5;
static int alpha_last = 0;
static int alpha = 0;
static int alpha_step = 5;
static int alpha_last = 0;
static int alpha = 0;
+ boolean active = (overlay.enabled && overlay.active);
- if (!
overlay.
active && deactivated)
+ if (!active && deactivated)
return;
return;
- if (
overlay.
active)
+ if (active)
{
if (alpha < alpha_max)
alpha = MIN(alpha + alpha_step, alpha_max);
{
if (alpha < alpha_max)
alpha = MIN(alpha + alpha_step, alpha_max);