improved leaving menu screens by 'left' key (regardless of cursor position)
authorHolger Schemel <info@artsoft.org>
Sat, 14 Jan 2017 20:38:32 +0000 (21:38 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 14 Jan 2017 20:38:32 +0000 (21:38 +0100)
src/screens.c

index 641c5e0714b6648f646adabbe24a922466023369..e7f5c0519719b795efbc6d3f427c7b8943b4cd66 100644 (file)
@@ -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
     {