X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fevents.c;h=b21f3706fef27c21a7d176820c7a117733aa0066;hb=a97d51220232bd25cc77bddb2c655fb521ccf519;hp=c1a5cbc18eb15c9abdc60b8a0a5ff36468a71ee2;hpb=de4a228f8a3b4889d484bc955bae463cee2c6a25;p=rocksndiamonds.git diff --git a/src/events.c b/src/events.c index c1a5cbc1..b21f3706 100644 --- a/src/events.c +++ b/src/events.c @@ -1760,6 +1760,15 @@ static void HandleKeysSpecial(Key key) DumpBrush_Small(); } } + + /* special key shortcuts for all game modes */ + if (is_string_suffix(cheat_input, ":dump-event-actions") || + is_string_suffix(cheat_input, ":dea") || + is_string_suffix(cheat_input, ":DEA")) + { + DumpGadgetIdentifiers(); + DumpScreenIdentifiers(); + } } void HandleKeysDebug(Key key) @@ -2423,24 +2432,38 @@ void HandleJoystick() void HandleSpecialGameControllerButtons(Event *event) { #if defined(TARGET_SDL2) + int key_status; + Key key; + switch (event->type) { case SDL_CONTROLLERBUTTONDOWN: - if (event->cbutton.button == SDL_CONTROLLER_BUTTON_START) - HandleKey(KSYM_space, KEY_PRESSED); - else if (event->cbutton.button == SDL_CONTROLLER_BUTTON_BACK) - HandleKey(KSYM_Escape, KEY_PRESSED); - + key_status = KEY_PRESSED; break; case SDL_CONTROLLERBUTTONUP: - if (event->cbutton.button == SDL_CONTROLLER_BUTTON_START) - HandleKey(KSYM_space, KEY_RELEASED); - else if (event->cbutton.button == SDL_CONTROLLER_BUTTON_BACK) - HandleKey(KSYM_Escape, KEY_RELEASED); + key_status = KEY_RELEASED; + break; + default: + return; + } + + switch (event->cbutton.button) + { + case SDL_CONTROLLER_BUTTON_START: + key = KSYM_space; break; + + case SDL_CONTROLLER_BUTTON_BACK: + key = KSYM_Escape; + break; + + default: + return; } + + HandleKey(key, key_status); #endif }