From b5fb0b07e5ab3af54a5d541d59ae661eaee3bfae Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sat, 14 Jan 2017 21:38:32 +0100 Subject: [PATCH] improved leaving menu screens by 'left' key (regardless of cursor position) --- src/screens.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/src/screens.c b/src/screens.c index 641c5e07..e7f5c051 100644 --- a/src/screens.c +++ b/src/screens.c @@ -2451,6 +2451,27 @@ void HandleMenuScreen(int mx, int my, int dx, int dy, int button, choice = choice_store[mode] = first_entry + y; } + else if (dx < 0) + { + PlaySound(SND_MENU_ITEM_SELECTING); + + for (i = 0; menu_info[i].type != 0; i++) + { + if (menu_info[i].type & TYPE_LEAVE_MENU) + { + void (*menu_callback_function)(void) = menu_info[i].value; + + FadeSetLeaveMenu(); + + menu_callback_function(); + + /* absolutely needed because function changes 'menu_info'! */ + break; + } + } + + return; + } } else if (!(menu_info[first_entry + y].type & TYPE_GHOSTED)) { @@ -3976,6 +3997,30 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button, ti->cl_cursor = y; } + else if (dx < 0) + { + if (game_status == GAME_MODE_SETUP) + { + if (setup_mode == SETUP_MODE_CHOOSE_GAME_SPEED || + setup_mode == SETUP_MODE_CHOOSE_SCROLL_DELAY || + setup_mode == SETUP_MODE_CHOOSE_SNAPSHOT_MODE) + execSetupGame(); + else if (setup_mode == SETUP_MODE_CHOOSE_WINDOW_SIZE || + setup_mode == SETUP_MODE_CHOOSE_SCALING_TYPE || + setup_mode == SETUP_MODE_CHOOSE_RENDERING) + execSetupGraphics(); + else if (setup_mode == SETUP_MODE_CHOOSE_VOLUME_SIMPLE || + setup_mode == SETUP_MODE_CHOOSE_VOLUME_LOOPS || + setup_mode == SETUP_MODE_CHOOSE_VOLUME_MUSIC) + execSetupSound(); + else if (setup_mode == SETUP_MODE_CHOOSE_TOUCH_CONTROL || + setup_mode == SETUP_MODE_CHOOSE_MOVE_DISTANCE || + setup_mode == SETUP_MODE_CHOOSE_DROP_DISTANCE) + execSetupTouch(); + else + execSetupArtwork(); + } + } } else { -- 2.34.1