rnd-20060816-2-src
[rocksndiamonds.git] / src / screens.c
index 25b3bfd886dc3f83ef92f240d7658087d59cb59d..05956c4c369b741eeed51faf4ae8138b61d0b6c7 100644 (file)
 #define SETUP_MODE_SHORTCUT_1          4
 #define SETUP_MODE_SHORTCUT_2          5
 #define SETUP_MODE_GRAPHICS            6
-#define SETUP_MODE_SOUND               7
-#define SETUP_MODE_ARTWORK             8
-#define SETUP_MODE_CHOOSE_GRAPHICS     9
-#define SETUP_MODE_CHOOSE_SOUNDS       10
-#define SETUP_MODE_CHOOSE_MUSIC                11
+#define SETUP_MODE_CHOOSE_SCREEN_MODE  7
+#define SETUP_MODE_SOUND               8
+#define SETUP_MODE_ARTWORK             9
+#define SETUP_MODE_CHOOSE_GRAPHICS     10
+#define SETUP_MODE_CHOOSE_SOUNDS       11
+#define SETUP_MODE_CHOOSE_MUSIC                12
 
-#define MAX_SETUP_MODES                        12
+#define MAX_SETUP_MODES                        13
 
 /* for input setup functions */
 #define SETUPINPUT_SCREEN_POS_START    0
@@ -121,6 +122,7 @@ static void HandleSetupScreen_Generic(int, int, int, int, int);
 static void HandleSetupScreen_Input(int, int, int, int, int);
 static void CustomizeKeyboard(int);
 static void CalibrateJoystick(int);
+static void execSetupGraphics(void);
 static void execSetupArtwork(void);
 static void HandleChooseTree(int, int, int, int, int, TreeInfo **);
 
@@ -146,6 +148,9 @@ static struct GadgetInfo *screen_gadget[NUM_SCREEN_GADGETS];
 static int setup_mode = SETUP_MODE_MAIN;
 static int info_mode = INFO_MODE_MAIN;
 
+static TreeInfo *screen_modes = NULL;
+static TreeInfo *screen_mode_current = NULL;
+
 #define DRAW_OFFSET_MODE(x)    (x >= GAME_MODE_MAIN &&                 \
                                 x <= GAME_MODE_SETUP ? x :             \
                                 x == GAME_MODE_PSEUDO_TYPENAME ?       \
@@ -224,30 +229,6 @@ void DrawHeadline()
   DrawTextSCentered(MENU_TITLE2_YPOS, FONT_TITLE_2, PROGRAM_COPYRIGHT_STRING);
 }
 
-static void ToggleFullscreenIfNeeded()
-{
-  if (setup.fullscreen != video.fullscreen_enabled)
-  {
-    /* save old door content */
-    BlitBitmap(backbuffer, bitmap_db_door,
-              DX, DY, DXSIZE, DYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
-
-    /* toggle fullscreen */
-    ChangeVideoModeIfNeeded(setup.fullscreen);
-    setup.fullscreen = video.fullscreen_enabled;
-
-    /* redraw background to newly created backbuffer */
-    BlitBitmap(graphic_info[IMG_GLOBAL_BORDER].bitmap, backbuffer,
-              0,0, WIN_XSIZE,WIN_YSIZE, 0,0);
-
-    /* restore old door content */
-    BlitBitmap(bitmap_db_door, backbuffer,
-              DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, DX, DY);
-
-    redraw_mask = REDRAW_ALL;
-  }
-}
-
 static int getLastLevelButtonPos()
 {
   return 10;
@@ -318,7 +299,7 @@ void DrawTitleScreen()
   StopAnimation();
 }
 
-static void DrawMainMenuExt(int fade_delay)
+void DrawMainMenuExt(int redraw_mask, boolean do_fading)
 {
   static LevelDirTree *leveldir_last_valid = NULL;
   boolean levelset_has_changed = FALSE;
@@ -444,7 +425,7 @@ static void DrawMainMenuExt(int fade_delay)
 #endif
 #endif
 
-  DrawMicroLevel(MICROLEVEL_XPOS, MICROLEVEL_YPOS, TRUE);
+  DrawPreviewLevel(TRUE);
 
 #if 1
 
@@ -551,7 +532,10 @@ static void DrawMainMenuExt(int fade_delay)
 
 #if 1
 #if 1
-  FadeIn(fade_delay);
+  if (do_fading)
+    FadeIn(redraw_mask);
+  else
+    BackToFront();
 #else
   BackToFront();
 #endif
@@ -566,9 +550,14 @@ static void DrawMainMenuExt(int fade_delay)
 #endif
 }
 
+void DrawAndFadeInMainMenu(int redraw_mask)
+{
+  DrawMainMenuExt(redraw_mask, TRUE);
+}
+
 void DrawMainMenu()
 {
-  DrawMainMenuExt(0);
+  DrawMainMenuExt(REDRAW_ALL, FALSE);
 }
 
 #if 0
@@ -608,8 +597,6 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
   boolean return_to_main_menu = FALSE;
   boolean use_fading_main_menu = TRUE;
   boolean use_cross_fading = TRUE;
-  int fade_delay = 500;
-  int post_delay = fade_delay / 2;
 
   if (button == MB_MENU_INITIALIZE)
   {
@@ -628,7 +615,7 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
 
       FadeSoundsAndMusic();
 
-      FadeOut(fade_delay, post_delay);
+      FadeOut(REDRAW_ALL);
     }
 
     /* force TITLE music on title info screen */
@@ -641,7 +628,7 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
 
     DrawTitleScreenImage(title_nr);
 
-    FadeIn(fade_delay);
+    FadeIn(REDRAW_ALL);
 
     return;
   }
@@ -664,7 +651,7 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
     title_nr++;
 
     if (!use_cross_fading)
-      FadeOut(fade_delay, post_delay);
+      FadeOut(REDRAW_ALL);
 
     if (title_nr < MAX_NUM_TITLE_SCREENS &&
        graphic_info[IMG_TITLESCREEN_1 + title_nr].bitmap != NULL)
@@ -672,22 +659,22 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
       Bitmap *drawto_last = drawto;
 
       if (use_cross_fading)
-       drawto = bitmap_db_title;
+       drawto = bitmap_db_cross;
 
       DrawTitleScreenImage(title_nr);
 
       drawto = drawto_last;
 
       if (use_cross_fading)
-       FadeCross(fade_delay);
+       FadeCross(REDRAW_ALL);
       else
-       FadeIn(fade_delay);
+       FadeIn(REDRAW_ALL);
     }
     else
     {
       FadeSoundsAndMusic();
 
-      FadeOut(fade_delay, post_delay);
+      FadeOut(REDRAW_ALL);
 
       return_to_main_menu = TRUE;
     }
@@ -695,8 +682,6 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
 
   if (return_to_main_menu)
   {
-    int menu_fade_delay = (use_fading_main_menu ? fade_delay : 0);
-
     RedrawBackground();
 
     if (game_status == GAME_MODE_INFO)
@@ -704,14 +689,14 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
       OpenDoor(DOOR_CLOSE_1 | DOOR_CLOSE_2 | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
 
       info_mode = INFO_MODE_MAIN;
-      DrawInfoScreenExt(menu_fade_delay);
+      DrawInfoScreenExt(use_fading_main_menu);
     }
     else       /* default: return to main menu */
     {
       OpenDoor(DOOR_CLOSE_1 | DOOR_OPEN_2 | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
 
       game_status = GAME_MODE_MAIN;
-      DrawMainMenuExt(menu_fade_delay);
+      DrawMainMenuExt(REDRAW_ALL, use_fading_main_menu);
     }
   }
 }
@@ -747,13 +732,13 @@ void HandleMainMenu_SelectLevel(int step, int direction)
     DrawText(mSX + 11 * 32, mSY + 3 * 32, int2str(level_nr, 3), FONT_VALUE_1);
 
     LoadLevel(level_nr);
-    DrawMicroLevel(MICROLEVEL_XPOS, MICROLEVEL_YPOS, TRUE);
+    DrawPreviewLevel(TRUE);
 
     TapeErase();
     LoadTape(level_nr);
     DrawCompleteVideoDisplay();
 
-    /* needed because DrawMicroLevel() takes some time */
+    /* needed because DrawPreviewLevel() takes some time */
     BackToFront();
     SyncDisplay();
   }
@@ -843,13 +828,13 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button)
               FONT_VALUE_1);
 
       LoadLevel(level_nr);
-      DrawMicroLevel(MICROLEVEL_XPOS, MICROLEVEL_YPOS, TRUE);
+      DrawPreviewLevel(TRUE);
 
       TapeErase();
       LoadTape(level_nr);
       DrawCompleteVideoDisplay();
 
-      /* needed because DrawMicroLevel() takes some time */
+      /* needed because DrawPreviewLevel() takes some time */
       BackToFront();
       SyncDisplay();
 
@@ -939,7 +924,7 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button)
 
   if (game_status == GAME_MODE_MAIN)
   {
-    DrawMicroLevel(MICROLEVEL_XPOS, MICROLEVEL_YPOS, FALSE);
+    DrawPreviewLevel(FALSE);
     DoAnimation();
   }
 }
@@ -1008,7 +993,7 @@ static struct TokenInfo info_info_main[] =
   { 0,                 NULL,                   NULL                    }
 };
 
-static void DrawInfoScreen_Main(int fade_delay)
+static void DrawInfoScreen_Main(boolean do_fading)
 {
   int i;
 
@@ -1034,9 +1019,9 @@ static void DrawInfoScreen_Main(int fade_delay)
 
     DrawText(mSX + xpos * 32, mSY + ypos * 32, info_info[i].text, font_nr);
 
-    if (info_info[i].type & TYPE_ENTER_MENU)
+    if (info_info[i].type & (TYPE_ENTER_MENU|TYPE_ENTER_LIST))
       initCursor(i, IMG_MENU_BUTTON_ENTER_MENU);
-    else if (info_info[i].type & TYPE_LEAVE_MENU)
+    else if (info_info[i].type & (TYPE_LEAVE_MENU|TYPE_LEAVE_LIST))
       initCursor(i, IMG_MENU_BUTTON_LEAVE_MENU);
     else if (info_info[i].type & ~TYPE_SKIP_ENTRY)
       initCursor(i, IMG_MENU_BUTTON);
@@ -1051,7 +1036,11 @@ static void DrawInfoScreen_Main(int fade_delay)
   PlayMenuSound();
   PlayMenuMusic();
 
-  FadeIn(fade_delay);
+  if (do_fading)
+    FadeIn(REDRAW_ALL);
+  else
+    BackToFront();
+
   InitAnimation();
 
 #else
@@ -1109,7 +1098,7 @@ void HandleInfoScreen_Main(int mx, int my, int dx, int dy, int button)
   {
     if (dx)
     {
-      int menu_navigation_type = (dx < 0 ? TYPE_LEAVE_MENU : TYPE_ENTER_MENU);
+      int menu_navigation_type = (dx < 0 ? TYPE_LEAVE : TYPE_ENTER);
 
       if (info_info[choice].type & menu_navigation_type ||
          info_info[choice].type & TYPE_ENTER_SCREEN ||
@@ -1139,7 +1128,7 @@ void HandleInfoScreen_Main(int mx, int my, int dx, int dy, int button)
     }
     else if (!(info_info[y].type & TYPE_GHOSTED))
     {
-      if (info_info[y].type & TYPE_ENTER_OR_LEAVE_MENU)
+      if (info_info[y].type & TYPE_ENTER_OR_LEAVE)
       {
        void (*menu_callback_function)(void) = info_info[choice].value;
 
@@ -1462,6 +1451,7 @@ void HandleInfoScreen_Music(int button)
 
   if (button_released || button == MB_MENU_INITIALIZE)
   {
+    Bitmap *drawto_last = drawto;
     int y = 0;
 
     if (button != MB_MENU_INITIALIZE)
@@ -1478,6 +1468,9 @@ void HandleInfoScreen_Music(int button)
 
     FadeSoundsAndMusic();
 
+    if (button != MB_MENU_INITIALIZE)
+      drawto = bitmap_db_cross;
+
     ClearWindow();
     DrawHeadline();
 
@@ -1539,6 +1532,11 @@ void HandleInfoScreen_Music(int button)
 
     DrawTextSCentered(ybottom, FONT_TEXT_4,
                      "Press any key or button for next page");
+
+    drawto = drawto_last;
+
+    if (button != MB_MENU_INITIALIZE)
+      FadeCross(REDRAW_FIELD);
   }
 
   if (list != NULL && list->is_sound && sound_info[list->music].loop)
@@ -1743,9 +1741,22 @@ void HandleInfoScreen_Credits(int button)
   }
   else if (button == MB_MENU_CHOICE)
   {
+    Bitmap *drawto_last = drawto;
+    boolean show_screen;
+
     screen_nr++;
 
-    if (!DrawInfoScreen_CreditsScreen(screen_nr))
+    drawto = bitmap_db_cross;
+
+    show_screen = DrawInfoScreen_CreditsScreen(screen_nr);
+
+    drawto = drawto_last;
+  
+    if (show_screen)
+    {
+      FadeCross(REDRAW_FIELD);
+    }
+    else
     {
       FadeSoundsAndMusic();
 
@@ -1776,7 +1787,7 @@ void DrawInfoScreen_Program()
   DrawTextSCentered(ystart + 1 * ystep, FONT_TEXT_2,
                    "If you like it, send e-mail to:");
   DrawTextSCentered(ystart + 2 * ystep, FONT_TEXT_3,
-                   "info@artsoft.org");
+                   PROGRAM_EMAIL_STRING);
   DrawTextSCentered(ystart + 3 * ystep, FONT_TEXT_2,
                    "or SnailMail to:");
   DrawTextSCentered(ystart + 4 * ystep + 0, FONT_TEXT_3,
@@ -1787,12 +1798,15 @@ void DrawInfoScreen_Program()
                    "33604 Bielefeld");
   DrawTextSCentered(ystart + 4 * ystep + 60, FONT_TEXT_3,
                    "Germany");
-
   DrawTextSCentered(ystart + 7 * ystep, FONT_TEXT_2,
+                   "More information and levels:");
+  DrawTextSCentered(ystart + 8 * ystep, FONT_TEXT_3,
+                   PROGRAM_WEBSITE_STRING);
+  DrawTextSCentered(ystart + 9 * ystep, FONT_TEXT_2,
                    "If you have created new levels,");
-  DrawTextSCentered(ystart + 8 * ystep, FONT_TEXT_2,
+  DrawTextSCentered(ystart + 10 * ystep, FONT_TEXT_2,
                    "send them to me to include them!");
-  DrawTextSCentered(ystart + 9 * ystep, FONT_TEXT_2,
+  DrawTextSCentered(ystart + 11 * ystep, FONT_TEXT_2,
                    ":-)");
 
   DrawTextSCentered(ybottom, FONT_TEXT_4,
@@ -1882,7 +1896,7 @@ void HandleInfoScreen_LevelSet(int button)
   }
 }
 
-static void DrawInfoScreenExt(int fade_delay)
+static void DrawInfoScreenExt(boolean do_fading)
 {
   SetMainBackgroundImage(IMG_BACKGROUND_INFO);
 
@@ -1899,7 +1913,7 @@ static void DrawInfoScreenExt(int fade_delay)
   else if (info_mode == INFO_MODE_LEVELSET)
     DrawInfoScreen_LevelSet();
   else
-    DrawInfoScreen_Main(fade_delay);
+    DrawInfoScreen_Main(do_fading);
 
   if (info_mode != INFO_MODE_MAIN &&
       info_mode != INFO_MODE_TITLE &&
@@ -2059,11 +2073,7 @@ static void drawChooseTreeList(int first_entry, int num_page_entries,
 #endif
   int last_game_status = game_status;  /* save current game status */
 
-  title_string =
-    (ti->type == TREE_TYPE_LEVEL_DIR ? "Level Sets" :
-     ti->type == TREE_TYPE_GRAPHICS_DIR ? "Custom Graphics" :
-     ti->type == TREE_TYPE_SOUNDS_DIR ? "Custom Sounds" :
-     ti->type == TREE_TYPE_MUSIC_DIR ? "Custom Music" : "");
+  title_string = ti->infotext;
 
 #if 1
   DrawTextSCentered(mSY - SY + yoffset, FONT_TITLE_1, title_string);
@@ -2213,7 +2223,13 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button,
     }
     else if (game_status == GAME_MODE_SETUP)
     {
-      execSetupArtwork();
+      if (game_status == GAME_MODE_SETUP)
+      {
+       if (setup_mode == SETUP_MODE_CHOOSE_SCREEN_MODE)
+         execSetupGraphics();
+       else
+         execSetupArtwork();
+      }
     }
     else
     {
@@ -2366,7 +2382,10 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button,
 
        if (game_status == GAME_MODE_SETUP)
        {
-         execSetupArtwork();
+         if (setup_mode == SETUP_MODE_CHOOSE_SCREEN_MODE)
+           execSetupGraphics();
+         else
+           execSetupArtwork();
        }
        else
        {
@@ -2404,13 +2423,19 @@ void DrawHallOfFame(int highlight_position)
   if (highlight_position < 0) 
     LoadScore(level_nr);
 
+  FadeOut(REDRAW_FIELD);
+
+#if 0
   FadeToFront();
+#endif
   InitAnimation();
 
   PlayMenuSound();
   PlayMenuMusic();
 
   HandleHallOfFame(highlight_position, 0, 0, 0, MB_MENU_INITIALIZE);
+
+  FadeIn(REDRAW_FIELD);
 }
 
 static void drawHallOfFameList(int first_entry, int highlight_position)
@@ -2461,7 +2486,6 @@ void HandleHallOfFame(int mx, int my, int dx, int dy, int button)
   static int first_entry = 0;
   static int highlight_position = 0;
   int step = (button == 1 ? 1 : button == 2 ? 5 : 10);
-  int button_released = !button;
 
   if (button == MB_MENU_INITIALIZE)
   {
@@ -2497,12 +2521,23 @@ void HandleHallOfFame(int mx, int my, int dx, int dy, int button)
       drawHallOfFameList(first_entry, highlight_position);
     }
   }
-  else if (button_released)
+  else if (button == MB_MENU_LEAVE)
   {
     FadeSound(SND_BACKGROUND_SCORES);
+
     game_status = GAME_MODE_MAIN;
+
     DrawMainMenu();
   }
+  else if (button == MB_MENU_CHOICE)
+  {
+    FadeSound(SND_BACKGROUND_SCORES);
+    FadeOut(REDRAW_FIELD);
+
+    game_status = GAME_MODE_MAIN;
+
+    DrawAndFadeInMainMenu(REDRAW_FIELD);
+  }
 
   if (game_status == GAME_MODE_SCORES)
     PlayMenuSoundIfLoop();
@@ -2518,6 +2553,7 @@ void HandleHallOfFame(int mx, int my, int dx, int dy, int button)
 static struct TokenInfo *setup_info;
 static int num_setup_info;
 
+static char *screen_mode_text;
 static char *graphics_set_name;
 static char *sounds_set_name;
 static char *music_set_name;
@@ -2542,10 +2578,75 @@ static void execSetupEditor()
 
 static void execSetupGraphics()
 {
+  if (video.fullscreen_available && screen_modes == NULL)
+  {
+    int i;
+
+    for (i = 0; video.fullscreen_modes[i].width != -1; i++)
+    {
+      TreeInfo *ti = newTreeInfo_setDefaults(TREE_TYPE_UNDEFINED);
+      char identifier[32], name[32];
+      int x = video.fullscreen_modes[i].width;
+      int y = video.fullscreen_modes[i].height;
+      int xx, yy;
+
+      get_aspect_ratio_from_screen_mode(&video.fullscreen_modes[i], &xx, &yy);
+
+      ti->node_top = &screen_modes;
+      ti->sort_priority = x * 10000 + y;
+
+      sprintf(identifier, "%dx%d", x, y);
+      sprintf(name,     "%d x %d [%d:%d]", x, y, xx, yy);
+
+      setString(&ti->identifier, identifier);
+      setString(&ti->name, name);
+      setString(&ti->name_sorting, name);
+      setString(&ti->infotext, "Fullscreen Mode");
+
+      pushTreeInfo(&screen_modes, ti);
+    }
+
+    /* sort fullscreen modes to start with lowest available screen resolution */
+    sortTreeInfo(&screen_modes);
+
+    /* set current screen mode for fullscreen mode to configured setup value */
+    screen_mode_current = getTreeInfoFromIdentifier(screen_modes,
+                                                   setup.fullscreen_mode);
+
+    /* if that fails, set current screen mode to reliable default value */
+    if (screen_mode_current == NULL)
+      screen_mode_current = getTreeInfoFromIdentifier(screen_modes,
+                                                     DEFAULT_FULLSCREEN_MODE);
+
+    /* if that also fails, set current screen mode to first available mode */
+    if (screen_mode_current == NULL)
+      screen_mode_current = screen_modes;
+
+    if (screen_mode_current == NULL)
+      video.fullscreen_available = FALSE;
+  }
+
+  if (video.fullscreen_available)
+  {
+    setup.fullscreen_mode = screen_mode_current->identifier;
+
+    /* needed for displaying screen mode name instead of identifier */
+    screen_mode_text = screen_mode_current->name;
+  }
+
   setup_mode = SETUP_MODE_GRAPHICS;
   DrawSetupScreen();
 }
 
+static void execSetupChooseScreenMode()
+{
+  if (!video.fullscreen_available)
+    return;
+
+  setup_mode = SETUP_MODE_CHOOSE_SCREEN_MODE;
+  DrawSetupScreen();
+}
+
 static void execSetupSound()
 {
   setup_mode = SETUP_MODE_SOUND;
@@ -2683,7 +2784,9 @@ static struct TokenInfo setup_info_editor[] =
 
 static struct TokenInfo setup_info_graphics[] =
 {
-  { TYPE_SWITCH,       &setup.fullscreen,      "Fullscreen Mode:"      },
+  { TYPE_SWITCH,       &setup.fullscreen,      "Fullscreen:"           },
+  { TYPE_ENTER_LIST,   execSetupChooseScreenMode, "Fullscreen Mode:"   },
+  { TYPE_STRING,       &screen_mode_text,      ""                      },
   { TYPE_SWITCH,       &setup.scroll_delay,    "Delayed Scrolling:"    },
 #if 0
   { TYPE_SWITCH,       &setup.soft_scrolling,  "Soft Scrolling:"       },
@@ -2714,11 +2817,11 @@ static struct TokenInfo setup_info_sound[] =
 
 static struct TokenInfo setup_info_artwork[] =
 {
-  { TYPE_ENTER_MENU,   execSetupChooseGraphics,"Custom Graphics"       },
+  { TYPE_ENTER_LIST,   execSetupChooseGraphics,"Custom Graphics:"      },
   { TYPE_STRING,       &graphics_set_name,     ""                      },
-  { TYPE_ENTER_MENU,   execSetupChooseSounds,  "Custom Sounds"         },
+  { TYPE_ENTER_LIST,   execSetupChooseSounds,  "Custom Sounds:"        },
   { TYPE_STRING,       &sounds_set_name,       ""                      },
-  { TYPE_ENTER_MENU,   execSetupChooseMusic,   "Custom Music"          },
+  { TYPE_ENTER_LIST,   execSetupChooseMusic,   "Custom Music:"         },
   { TYPE_STRING,       &music_set_name,        ""                      },
   { TYPE_EMPTY,                NULL,                   ""                      },
 #if 1
@@ -2825,7 +2928,8 @@ static int getSetupTextFont(int type)
              TYPE_YES_NO |
              TYPE_STRING |
              TYPE_ECS_AGA |
-             TYPE_KEYTEXT))
+             TYPE_KEYTEXT |
+             TYPE_ENTER_LIST))
     return FONT_MENU_2;
   else
     return FONT_MENU_1;
@@ -3063,7 +3167,8 @@ static void DrawSetupScreen_Generic()
     if ((value_ptr == &setup.sound_simple && !audio.sound_available) ||
        (value_ptr == &setup.sound_loops  && !audio.loops_available) ||
        (value_ptr == &setup.sound_music  && !audio.music_available) ||
-       (value_ptr == &setup.fullscreen   && !video.fullscreen_available))
+       (value_ptr == &setup.fullscreen   && !video.fullscreen_available) ||
+       (value_ptr == &screen_mode_text   && !video.fullscreen_available))
       setup_info[i].type |= TYPE_GHOSTED;
 
 #if 1
@@ -3084,9 +3189,9 @@ static void DrawSetupScreen_Generic()
 
     DrawText(mSX + xpos * 32, mSY + ypos * 32, setup_info[i].text, font_nr);
 
-    if (setup_info[i].type & TYPE_ENTER_MENU)
+    if (setup_info[i].type & (TYPE_ENTER_MENU|TYPE_ENTER_LIST))
       initCursor(i, IMG_MENU_BUTTON_ENTER_MENU);
-    else if (setup_info[i].type & TYPE_LEAVE_MENU)
+    else if (setup_info[i].type & (TYPE_LEAVE_MENU|TYPE_LEAVE_LIST))
       initCursor(i, IMG_MENU_BUTTON_LEAVE_MENU);
     else if (setup_info[i].type & ~TYPE_SKIP_ENTRY)
       initCursor(i, IMG_MENU_BUTTON);
@@ -3123,6 +3228,7 @@ void HandleSetupScreen_Generic(int mx, int my, int dx, int dy, int button)
     choice_store[setup_mode] = choice;
 
     drawCursor(choice, FC_RED);
+
     return;
   }
   else if (button == MB_MENU_LEAVE)
@@ -3134,6 +3240,7 @@ void HandleSetupScreen_Generic(int mx, int my, int dx, int dy, int button)
        void (*menu_callback_function)(void) = setup_info[y].value;
 
        menu_callback_function();
+
        break;  /* absolutely needed because function changes 'setup_info'! */
       }
     }
@@ -3150,7 +3257,7 @@ void HandleSetupScreen_Generic(int mx, int my, int dx, int dy, int button)
   {
     if (dx)
     {
-      int menu_navigation_type = (dx < 0 ? TYPE_LEAVE_MENU : TYPE_ENTER_MENU);
+      int menu_navigation_type = (dx < 0 ? TYPE_LEAVE : TYPE_ENTER);
 
       if (setup_info[choice].type & menu_navigation_type ||
          setup_info[choice].type & TYPE_BOOLEAN_STYLE)
@@ -3165,6 +3272,44 @@ void HandleSetupScreen_Generic(int mx, int my, int dx, int dy, int button)
       y += dy;
   }
 
+#if 1
+  if (IN_VIS_FIELD(x, y) && y >= 0 && y < num_setup_info)
+  {
+    if (button)
+    {
+      if (y != choice && setup_info[y].type & ~TYPE_SKIP_ENTRY)
+      {
+       drawCursor(y, FC_RED);
+       drawCursor(choice, FC_BLUE);
+       choice = choice_store[setup_mode] = y;
+      }
+    }
+    else if (!(setup_info[y].type & TYPE_GHOSTED))
+    {
+      /* when selecting key headline, execute function for key value change */
+      if (setup_info[y].type & TYPE_KEYTEXT &&
+         setup_info[y + 1].type & TYPE_KEY)
+       y++;
+
+      /* when selecting string value, execute function for list selection */
+      if (setup_info[y].type & TYPE_STRING && y > 0 &&
+         setup_info[y - 1].type & TYPE_ENTER_LIST)
+       y--;
+
+      if (setup_info[y].type & TYPE_ENTER_OR_LEAVE)
+      {
+       void (*menu_callback_function)(void) = setup_info[y].value;
+
+       menu_callback_function();
+      }
+      else
+      {
+       if (setup_info[y].type & TYPE_VALUE)
+         changeSetupValue(y);
+      }
+    }
+  }
+#else
   if (IN_VIS_FIELD(x, y) &&
       y >= 0 && y < num_setup_info && setup_info[y].type & ~TYPE_SKIP_ENTRY)
   {
@@ -3179,7 +3324,7 @@ void HandleSetupScreen_Generic(int mx, int my, int dx, int dy, int button)
     }
     else if (!(setup_info[y].type & TYPE_GHOSTED))
     {
-      if (setup_info[y].type & TYPE_ENTER_OR_LEAVE_MENU)
+      if (setup_info[y].type & TYPE_ENTER_OR_LEAVE)
       {
        void (*menu_callback_function)(void) = setup_info[choice].value;
 
@@ -3196,6 +3341,7 @@ void HandleSetupScreen_Generic(int mx, int my, int dx, int dy, int button)
       }
     }
   }
+#endif
 }
 
 void DrawSetupScreen_Input()
@@ -3847,6 +3993,8 @@ void DrawSetupScreen()
 
   if (setup_mode == SETUP_MODE_INPUT)
     DrawSetupScreen_Input();
+  else if (setup_mode == SETUP_MODE_CHOOSE_SCREEN_MODE)
+    DrawChooseTree(&screen_mode_current);
   else if (setup_mode == SETUP_MODE_CHOOSE_GRAPHICS)
     DrawChooseTree(&artwork.gfx_current);
   else if (setup_mode == SETUP_MODE_CHOOSE_SOUNDS)
@@ -3864,6 +4012,8 @@ void HandleSetupScreen(int mx, int my, int dx, int dy, int button)
 {
   if (setup_mode == SETUP_MODE_INPUT)
     HandleSetupScreen_Input(mx, my, dx, dy, button);
+  else if (setup_mode == SETUP_MODE_CHOOSE_SCREEN_MODE)
+    HandleChooseTree(mx, my, dx, dy, button, &screen_mode_current);
   else if (setup_mode == SETUP_MODE_CHOOSE_GRAPHICS)
     HandleChooseTree(mx, my, dx, dy, button, &artwork.gfx_current);
   else if (setup_mode == SETUP_MODE_CHOOSE_SOUNDS)
@@ -4179,6 +4329,10 @@ static void CreateScreenScrollbars()
                      GDI_SCROLLBAR_ITEMS_MAX, items_max,
                      GDI_SCROLLBAR_ITEMS_VISIBLE, items_visible,
                      GDI_SCROLLBAR_ITEM_POSITION, item_position,
+                     GDI_WHEEL_AREA_X, 0,
+                     GDI_WHEEL_AREA_Y, 0,
+                     GDI_WHEEL_AREA_WIDTH, WIN_XSIZE,
+                     GDI_WHEEL_AREA_HEIGHT, WIN_YSIZE,
                      GDI_STATE, GD_BUTTON_UNPRESSED,
                      GDI_DESIGN_UNPRESSED, gd_bitmap_unpressed, gd_x1, gd_y1,
                      GDI_DESIGN_PRESSED, gd_bitmap_pressed, gd_x2, gd_y2,