diff --git a/src/input.c b/src/input.c index 33266f2..50a9af5 100644 --- a/src/input.c +++ b/src/input.c @@ -111,7 +111,7 @@ unsigned int input_afterburnSensibility = 200; /**< ms between taps to afterbur /* From player.c */ extern double player_turn; -static char* keyconv[SDLK_LAST]; /**< Key conversion table. */ +static const char* keyconv[SDLK_LAST]; /**< Key conversion table. */ static void input_keyConvGen(void); static void input_keyConvDestroy(void); @@ -538,9 +538,9 @@ static void input_key(int keynum, double value, int kabs) { /* --Events-- */ -static void input_joyaxis(const unsigned int axis, const int value); -static void input_joyevent(int event, const unsigned int button); -static void input_keyevent(int event, SDLKey key, SDLMod mod); +static void input_joyaxis(const SDLKey axis, const int value); +static void input_joyevent(const int event, const SDLKey button); +static void input_keyevent(const int event, const SDLKey key, const SDLMod mod); /* Joystick. */ @@ -549,7 +549,7 @@ static void input_keyevent(int event, SDLKey key, SDLMod mod); * @param axis Axis generated by the event. * @param value Value of the axis. */ -static void input_joyaxis(const unsigned int axis, const int value) { +static void input_joyaxis(const SDLKey axis, const int value) { int i; for(i = 0; strcmp(keybindNames[i], "end"); i++) if(input_keybinds[i]->type == KEYBIND_JAXIS && @@ -562,7 +562,7 @@ static void input_joyaxis(const unsigned int axis, const int value) { * @param event Event type (down/up). * @param button Button generating the event. */ -static void input_joyevent(int event, const unsigned int button) { +static void input_joyevent(const int event, const SDLKey button) { int i; for(i = 0; strcmp(keybindNames[i], "end");i++) if(input_keybinds[i]->type == KEYBIND_JBUTTON && @@ -578,15 +578,17 @@ static void input_joyevent(int event, const unsigned int button) { * @param key Key generating the event. * @param mod Modifiers active when event was generated. */ -static void input_keyevent(int event, SDLKey key, SDLMod mod) { +static void input_keyevent(const int event, SDLKey key, const SDLMod mod) { int i; + SDLMod mod_filtered; - mod &= ~(KMOD_CAPS | KMOD_NUM | KMOD_MODE); /* We want to ignore "global" modifiers. */ + /* We want to ignore "global" modifiers. */ + mod_filtered = mod & ~(KMOD_CAPS | KMOD_NUM | KMOD_MODE); for(i = 0; strcmp(keybindNames[i], "end"); i++) { if((input_keybinds[i]->type == KEYBIND_KEYBOARD) && (input_keybinds[i]->key == key)) { - if((input_keybinds[i]->mod == mod) || + if((input_keybinds[i]->mod == mod_filtered) || (input_keybinds[i]->mod == KMOD_ALL) || (event == KEY_RELEASE)) /**< Release always gets through. */ input_key(i, event, 0);