updated contact info in source file headers
[rocksndiamonds.git] / src / screens.c
index c2fd03149e4875fde322426f4f3ab5c3c8e95485..d28e4d228bb209dee643647144afc39e43f59b47 100644 (file)
@@ -1,15 +1,13 @@
-/***********************************************************
-* Rocks'n'Diamonds -- McDuffin Strikes Back!               *
-*----------------------------------------------------------*
-* (c) 1995-2006 Artsoft Entertainment                      *
-*               Holger Schemel                             *
-*               Detmolder Strasse 189                      *
-*               33604 Bielefeld                            *
-*               Germany                                    *
-*               e-mail: info@artsoft.org                   *
-*----------------------------------------------------------*
-* screens.c                                                *
-***********************************************************/
+// ============================================================================
+// Rocks'n'Diamonds - McDuffin Strikes Back!
+// ----------------------------------------------------------------------------
+// (c) 1995-2014 by Artsoft Entertainment
+//                         Holger Schemel
+//                 info@artsoft.org
+//                 http://www.artsoft.org/
+// ----------------------------------------------------------------------------
+// screens.c
+// ============================================================================
 
 #include "libgame/libgame.h"
 
 #define SETUP_MODE_SOUND               4
 #define SETUP_MODE_ARTWORK             5
 #define SETUP_MODE_INPUT               6
-#define SETUP_MODE_SHORTCUTS           7
-#define SETUP_MODE_SHORTCUTS_1         8
-#define SETUP_MODE_SHORTCUTS_2         9
-#define SETUP_MODE_SHORTCUTS_3         10
-#define SETUP_MODE_SHORTCUTS_4         11
-#define SETUP_MODE_SHORTCUTS_5         12
+#define SETUP_MODE_TOUCH               7
+#define SETUP_MODE_SHORTCUTS           8
+#define SETUP_MODE_SHORTCUTS_1         9
+#define SETUP_MODE_SHORTCUTS_2         10
+#define SETUP_MODE_SHORTCUTS_3         11
+#define SETUP_MODE_SHORTCUTS_4         12
+#define SETUP_MODE_SHORTCUTS_5         13
 
 /* sub-screens on the setup screen (generic) */
-#define SETUP_MODE_CHOOSE_ARTWORK      13
-#define SETUP_MODE_CHOOSE_OTHER                14
+#define SETUP_MODE_CHOOSE_ARTWORK      14
+#define SETUP_MODE_CHOOSE_OTHER                15
 
 /* sub-screens on the setup screen (specific) */
-#define SETUP_MODE_CHOOSE_GAME_SPEED   15
-#define SETUP_MODE_CHOOSE_SCROLL_DELAY 16
-#define SETUP_MODE_CHOOSE_SCREEN_MODE  17
-#define SETUP_MODE_CHOOSE_WINDOW_SIZE  18
-#define SETUP_MODE_CHOOSE_SCALING_TYPE 19
-#define SETUP_MODE_CHOOSE_GRAPHICS     20
-#define SETUP_MODE_CHOOSE_SOUNDS       21
-#define SETUP_MODE_CHOOSE_MUSIC                22
-#define SETUP_MODE_CHOOSE_VOLUME_SIMPLE        23
-#define SETUP_MODE_CHOOSE_VOLUME_LOOPS 24
-#define SETUP_MODE_CHOOSE_VOLUME_MUSIC 25
-
-#define MAX_SETUP_MODES                        26
+#define SETUP_MODE_CHOOSE_GAME_SPEED   16
+#define SETUP_MODE_CHOOSE_SCROLL_DELAY 17
+#define SETUP_MODE_CHOOSE_SCREEN_MODE  18
+#define SETUP_MODE_CHOOSE_WINDOW_SIZE  19
+#define SETUP_MODE_CHOOSE_SCALING_TYPE 20
+#define SETUP_MODE_CHOOSE_GRAPHICS     21
+#define SETUP_MODE_CHOOSE_SOUNDS       22
+#define SETUP_MODE_CHOOSE_MUSIC                23
+#define SETUP_MODE_CHOOSE_VOLUME_SIMPLE        24
+#define SETUP_MODE_CHOOSE_VOLUME_LOOPS 25
+#define SETUP_MODE_CHOOSE_VOLUME_MUSIC 26
+#define SETUP_MODE_CHOOSE_TOUCH_CONTROL        27
+#define SETUP_MODE_CHOOSE_MOVE_DISTANCE        28
+#define SETUP_MODE_CHOOSE_DROP_DISTANCE        29
+
+#define MAX_SETUP_MODES                        30
 
 /* for input setup functions */
 #define SETUPINPUT_SCREEN_POS_START    0
 #define NUM_INFO_ELEMENTS_ON_SCREEN    10
 #endif
 #define MAX_MENU_ENTRIES_ON_SCREEN     (SCR_FIELDY - MENU_SCREEN_START_YPOS)
-#if 0
+#if 1
+#define MAX_MENU_TEXT_LENGTH_BIG       13
+#define MAX_MENU_TEXT_LENGTH_MEDIUM    (MAX_MENU_TEXT_LENGTH_BIG * 2)
+#else
 #define MAX_MENU_TEXT_LENGTH_BIG       (MENU_SCREEN_VALUE_XPOS -       \
                                         MENU_SCREEN_START_XPOS)
 #define MAX_MENU_TEXT_LENGTH_MEDIUM    (MAX_MENU_TEXT_LENGTH_BIG * 2)
@@ -168,6 +173,7 @@ static void CalibrateJoystick(int);
 static void execSetupGame(void);
 static void execSetupGraphics(void);
 static void execSetupSound(void);
+static void execSetupTouch(void);
 static void execSetupArtwork(void);
 static void HandleChooseTree(int, int, int, int, int, TreeInfo **);
 
@@ -222,6 +228,15 @@ static TreeInfo *volume_loops_current = NULL;
 static TreeInfo *volumes_music = NULL;
 static TreeInfo *volume_music_current = NULL;
 
+static TreeInfo *touch_controls = NULL;
+static TreeInfo *touch_control_current = NULL;
+
+static TreeInfo *move_distances = NULL;
+static TreeInfo *move_distance_current = NULL;
+
+static TreeInfo *drop_distances = NULL;
+static TreeInfo *drop_distance_current = NULL;
+
 static TreeInfo *level_number = NULL;
 static TreeInfo *level_number_current = NULL;
 
@@ -331,6 +346,37 @@ static struct
   {    -1,     NULL                            },
 };
 
+static struct
+{
+  char *value;
+  char *text;
+} touch_controls_list[] =
+{
+  {    TOUCH_CONTROL_VIRTUAL_BUTTONS,  "Virtual Buttons"       },
+  {    TOUCH_CONTROL_WIPE_GESTURES,    "Wipe Gestures"         },
+
+  {    NULL,                           NULL                    },
+};
+
+static struct
+{
+  int value;
+  char *text;
+} distances_list[] =
+{
+  {    1,      "1 %"                           },
+  {    2,      "2 %"                           },
+  {    3,      "3 %"                           },
+  {    4,      "4 %"                           },
+  {    5,      "5 %"                           },
+  {    10,     "10 %"                          },
+  {    15,     "15 %"                          },
+  {    20,     "20 %"                          },
+  {    25,     "25 %"                          },
+
+  {    -1,     NULL                            },
+};
+
 #define DRAW_MODE(s)           ((s) >= GAME_MODE_MAIN &&               \
                                 (s) <= GAME_MODE_SETUP ? (s) :         \
                                 (s) == GAME_MODE_PSEUDO_TYPENAME ?     \
@@ -380,11 +426,6 @@ static struct
                                    menu.list_size[game_status] :       \
                                    MAX_MENU_ENTRIES_ON_SCREEN)
 
-#if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
-#define NUM_SCROLLBAR_BITMAPS          2
-static Bitmap *scrollbar_bitmap[NUM_SCROLLBAR_BITMAPS];
-#endif
-
 
 /* title display and control definitions */
 
@@ -1495,7 +1536,8 @@ void DrawMainMenuExt(int fade_mask, boolean do_fading)
 #endif
 
 #if 1
-  if (fade_mask == REDRAW_ALL)
+  // if (fade_mask == REDRAW_ALL)
+  // (always redraw current door state)
   {
     int door_state = GetDoorState();
 
@@ -1505,6 +1547,12 @@ void DrawMainMenuExt(int fade_mask, boolean do_fading)
   }
 #endif
 
+#if 0
+  redraw_mask |= REDRAW_ALL;
+  BackToFront();
+  Delay(3000);
+#endif
+
   DrawMaskedBorder(REDRAW_ALL);
 
   FadeIn(fade_mask);
@@ -3724,6 +3772,10 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button,
               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();
     }
@@ -3965,6 +4017,10 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button,
                   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();
        }
@@ -4252,6 +4308,9 @@ static char *music_set_name;
 static char *volume_simple_text;
 static char *volume_loops_text;
 static char *volume_music_text;
+static char *touch_controls_text;
+static char *move_distance_text;
+static char *drop_distance_text;
 
 static void execSetupMain()
 {
@@ -4815,6 +4874,173 @@ static void execSetupSound()
   DrawSetupScreen();
 }
 
+static void execSetupChooseTouchControls()
+{
+  setup_mode = SETUP_MODE_CHOOSE_TOUCH_CONTROL;
+
+  DrawSetupScreen();
+}
+
+static void execSetupChooseMoveDistance()
+{
+  setup_mode = SETUP_MODE_CHOOSE_MOVE_DISTANCE;
+
+  DrawSetupScreen();
+}
+
+static void execSetupChooseDropDistance()
+{
+  setup_mode = SETUP_MODE_CHOOSE_DROP_DISTANCE;
+
+  DrawSetupScreen();
+}
+
+static void execSetupTouch()
+{
+#if 1
+  if (touch_controls == NULL)
+  {
+    int i;
+
+    for (i = 0; touch_controls_list[i].value != NULL; i++)
+    {
+      TreeInfo *ti = newTreeInfo_setDefaults(TREE_TYPE_UNDEFINED);
+      char identifier[32], name[32];
+      char *value = touch_controls_list[i].value;
+      char *text = touch_controls_list[i].text;
+
+      ti->node_top = &touch_controls;
+      ti->sort_priority = i;
+
+      sprintf(identifier, "%s", value);
+      sprintf(name, "%s", text);
+
+      setString(&ti->identifier, identifier);
+      setString(&ti->name, name);
+      setString(&ti->name_sorting, name);
+      setString(&ti->infotext, "Control Type");
+
+      pushTreeInfo(&touch_controls, ti);
+    }
+
+    /* sort touch control values to start with lowest touch control value */
+    sortTreeInfo(&touch_controls);
+
+    /* set current touch control value to configured touch control value */
+    touch_control_current =
+      getTreeInfoFromIdentifier(touch_controls, setup.touch.control_type);
+
+    /* if that fails, set current touch control to reliable default value */
+    if (touch_control_current == NULL)
+      touch_control_current =
+       getTreeInfoFromIdentifier(touch_controls, TOUCH_CONTROL_DEFAULT);
+
+    /* if that also fails, set current touch control to first available value */
+    if (touch_control_current == NULL)
+      touch_control_current = touch_controls;
+  }
+
+  if (move_distances == NULL)
+  {
+    int i;
+
+    for (i = 0; distances_list[i].value != -1; i++)
+    {
+      TreeInfo *ti = newTreeInfo_setDefaults(TREE_TYPE_UNDEFINED);
+      char identifier[32], name[32];
+      int value = distances_list[i].value;
+      char *text = distances_list[i].text;
+
+      ti->node_top = &move_distances;
+      ti->sort_priority = value;
+
+      sprintf(identifier, "%d", value);
+      sprintf(name, "%s", text);
+
+      setString(&ti->identifier, identifier);
+      setString(&ti->name, name);
+      setString(&ti->name_sorting, name);
+      setString(&ti->infotext, "Move Distance");
+
+      pushTreeInfo(&move_distances, ti);
+    }
+
+    /* sort distance values to start with lowest distance value */
+    sortTreeInfo(&move_distances);
+
+    /* set current distance value to configured distance value */
+    move_distance_current =
+      getTreeInfoFromIdentifier(move_distances,
+                               i_to_a(setup.touch.move_distance));
+
+    /* if that fails, set current distance to reliable default value */
+    if (move_distance_current == NULL)
+      move_distance_current =
+       getTreeInfoFromIdentifier(move_distances, i_to_a(1));
+
+    /* if that also fails, set current distance to first available value */
+    if (move_distance_current == NULL)
+      move_distance_current = move_distances;
+  }
+
+  if (drop_distances == NULL)
+  {
+    int i;
+
+    for (i = 0; distances_list[i].value != -1; i++)
+    {
+      TreeInfo *ti = newTreeInfo_setDefaults(TREE_TYPE_UNDEFINED);
+      char identifier[32], name[32];
+      int value = distances_list[i].value;
+      char *text = distances_list[i].text;
+
+      ti->node_top = &drop_distances;
+      ti->sort_priority = value;
+
+      sprintf(identifier, "%d", value);
+      sprintf(name, "%s", text);
+
+      setString(&ti->identifier, identifier);
+      setString(&ti->name, name);
+      setString(&ti->name_sorting, name);
+      setString(&ti->infotext, "Drop Distance");
+
+      pushTreeInfo(&drop_distances, ti);
+    }
+
+    /* sort distance values to start with lowest distance value */
+    sortTreeInfo(&drop_distances);
+
+    /* set current distance value to configured distance value */
+    drop_distance_current =
+      getTreeInfoFromIdentifier(drop_distances,
+                               i_to_a(setup.touch.drop_distance));
+
+    /* if that fails, set current distance to reliable default value */
+    if (drop_distance_current == NULL)
+      drop_distance_current =
+       getTreeInfoFromIdentifier(drop_distances, i_to_a(1));
+
+    /* if that also fails, set current distance to first available value */
+    if (drop_distance_current == NULL)
+      drop_distance_current = drop_distances;
+  }
+
+  setup.touch.control_type = touch_control_current->identifier;
+  setup.touch.move_distance = atoi(move_distance_current->identifier);
+  setup.touch.drop_distance = atoi(drop_distance_current->identifier);
+
+  /* needed for displaying volume text instead of identifier */
+  touch_controls_text = touch_control_current->name;
+  move_distance_text = move_distance_current->name;
+  drop_distance_text = drop_distance_current->name;
+#endif
+
+  setup_mode = SETUP_MODE_TOUCH;
+
+  DrawSetupScreen();
+}
+
 static void execSetupArtwork()
 {
 #if 0
@@ -4931,7 +5157,12 @@ static struct TokenInfo setup_info_main[] =
   { TYPE_ENTER_MENU,   execSetupGraphics,      "Graphics"              },
   { TYPE_ENTER_MENU,   execSetupSound,         "Sound & Music"         },
   { TYPE_ENTER_MENU,   execSetupArtwork,       "Custom Artwork"        },
+#if !defined(PLATFORM_ANDROID)
   { TYPE_ENTER_MENU,   execSetupInput,         "Input Devices"         },
+  { TYPE_ENTER_MENU,   execSetupTouch,         "Touch Controls"        },
+#else
+  { TYPE_ENTER_MENU,   execSetupTouch,         "Touch Controls"        },
+#endif
   { TYPE_ENTER_MENU,   execSetupShortcuts,     "Key Shortcuts"         },
   { TYPE_EMPTY,                NULL,                   ""                      },
   { TYPE_LEAVE_MENU,   execExitSetup,          "Exit"                  },
@@ -5013,7 +5244,7 @@ static struct TokenInfo setup_info_graphics[] =
   { TYPE_SWITCH,       &setup.scroll_delay,    "Scroll Delay:"         },
 #endif
 #if 0
-  { TYPE_ENTER_LIST,   execSetupChooseScrollDelay, "Scroll Delay Value:" },
+  { TYPE_ENTER_LIST,   execSetupChooseScrollDelay, "Scroll Delay:"     },
   { TYPE_STRING,       &scroll_delay_text,     ""                      },
 #endif
 #if 0
@@ -5103,6 +5334,21 @@ static struct TokenInfo setup_info_input[] =
   { 0,                 NULL,                   NULL                    }
 };
 
+static struct TokenInfo setup_info_touch[] =
+{
+  { TYPE_ENTER_LIST,   execSetupChooseTouchControls, "Touch Control Type:" },
+  { TYPE_STRING,       &touch_controls_text,   ""                      },
+  { TYPE_EMPTY,                NULL,                   ""                      },
+  { TYPE_ENTER_LIST,   execSetupChooseMoveDistance, "Move Trigger Distance:" },
+  { TYPE_STRING,       &move_distance_text,    ""                      },
+  { TYPE_ENTER_LIST,   execSetupChooseDropDistance, "Drop Trigger Distance:" },
+  { TYPE_STRING,       &drop_distance_text,    ""                      },
+  { TYPE_EMPTY,                NULL,                   ""                      },
+  { TYPE_LEAVE_MENU,   execSetupMain,          "Back"                  },
+
+  { 0,                 NULL,                   NULL                    }
+};
+
 static struct TokenInfo setup_info_shortcuts[] =
 {
   { TYPE_ENTER_MENU,   execSetupShortcuts1,    "Various Keys"          },
@@ -5286,7 +5532,7 @@ static void drawSetupValue(int screen_pos, int setup_info_pos_raw)
   struct TokenInfo *si = &setup_info[si_pos];
   boolean font_draw_xoffset_modified = FALSE;
   int font_draw_xoffset_old = -1;
-  int xoffset = (num_setup_info < max_setup_info ? -1 * 1 : 0);
+  int xoffset = (num_setup_info < max_setup_info ? -1 : 0);
   int menu_screen_value_xpos = MENU_SCREEN_VALUE_XPOS + xoffset;
   int menu_screen_max_xpos = MENU_SCREEN_MAX_XPOS + xoffset;
   int xpos = menu_screen_value_xpos;
@@ -5336,8 +5582,13 @@ static void drawSetupValue(int screen_pos, int setup_info_pos_raw)
   font_height = getFontHeight(font_nr);
 #endif
 
+#if 0
+  if (menu_screen_value_xpos < 1 + MAX_MENU_TEXT_LENGTH_BIG)
+    font_nr = ...;
+#endif
+
   /* downward compatibility correction for Juergen Bonhagen's menu settings */
-  if (1 && setup_mode != SETUP_MODE_INPUT)
+  if (setup_mode != SETUP_MODE_INPUT)
   {
     int max_menu_text_length_big = (menu_screen_value_xpos -
                                    MENU_SCREEN_START_XPOS);
@@ -5723,6 +5974,11 @@ static void DrawSetupScreen_Generic()
     setup_info = setup_info_artwork;
     title_string = "Custom Artwork";
   }
+  else if (setup_mode == SETUP_MODE_TOUCH)
+  {
+    setup_info = setup_info_touch;
+    title_string = "Setup Touch Ctrls";
+  }
   else if (setup_mode == SETUP_MODE_SHORTCUTS)
   {
     setup_info = setup_info_shortcuts;
@@ -5878,10 +6134,20 @@ void HandleSetupScreen_Generic(int mx, int my, int dx, int dy, int button)
 
 #if 1
     if (choice < first_entry)
+    {
       choice = first_entry;
+
+      if (setup_info[choice].type & TYPE_SKIP_ENTRY)
+       choice++;
+    }
     else if (choice > first_entry + num_page_entries - 1)
+    {
       choice = first_entry + num_page_entries - 1;
 
+      if (setup_info[choice].type & TYPE_SKIP_ENTRY)
+       choice--;
+    }
+
     choice_store[setup_mode] = choice;
 
     DrawCursorAndText_Setup(choice - first_entry, choice, TRUE);
@@ -5966,13 +6232,34 @@ void HandleSetupScreen_Generic(int mx, int my, int dx, int dy, int button)
       {
        choice += first_entry - first_entry_store[setup_mode];
 
-       first_entry_store[setup_mode] = first_entry;
-
        if (choice < first_entry)
+       {
          choice = first_entry;
+
+         if (setup_info[choice].type & TYPE_SKIP_ENTRY)
+           choice++;
+       }
        else if (choice > first_entry + num_page_entries - 1)
+       {
          choice = first_entry + num_page_entries - 1;
 
+         if (setup_info[choice].type & TYPE_SKIP_ENTRY)
+           choice--;
+       }
+#if 1
+       else if (setup_info[choice].type & TYPE_SKIP_ENTRY)
+       {
+         choice += SIGN(dy);
+
+         if (choice < first_entry ||
+             choice > first_entry + num_page_entries - 1)
+         first_entry += SIGN(dy);
+       }
+#endif
+
+       // printf("::: MARK 1: %d\n", first_entry);
+
+       first_entry_store[setup_mode] = first_entry;
        choice_store[setup_mode] = choice;
 
        drawSetupInfoList(setup_info, first_entry, NUM_MENU_ENTRIES_ON_SCREEN);
@@ -6004,13 +6291,28 @@ void HandleSetupScreen_Generic(int mx, int my, int dx, int dy, int button)
 #endif
 
     /* jump to next non-empty menu entry (up or down) */
+#if 1
+    while (first_entry + y > 0 &&
+          first_entry + y < max_setup_info - 1 &&
+          setup_info[first_entry + y].type & TYPE_SKIP_ENTRY)
+      y += dy;
+#else
     while (y > 0 && y < num_setup_info - 1 &&
           setup_info[first_entry + y].type & TYPE_SKIP_ENTRY)
       y += dy;
+#endif
 
     if (!IN_VIS_FIELD(x, y))
     {
+      choice += y - y_old;
+#if 1
+      if (choice < first_entry)
+       first_entry = choice;
+      else if (choice > first_entry + num_page_entries - 1)
+       first_entry = choice - num_page_entries + 1;
+#else
       first_entry += y - y_old;
+#endif
 
       if (first_entry >= 0 &&
          first_entry + num_page_entries <= max_setup_info)
@@ -6840,6 +7142,12 @@ void DrawSetupScreen()
     DrawChooseTree(&volume_loops_current);
   else if (setup_mode == SETUP_MODE_CHOOSE_VOLUME_MUSIC)
     DrawChooseTree(&volume_music_current);
+  else if (setup_mode == SETUP_MODE_CHOOSE_TOUCH_CONTROL)
+    DrawChooseTree(&touch_control_current);
+  else if (setup_mode == SETUP_MODE_CHOOSE_MOVE_DISTANCE)
+    DrawChooseTree(&move_distance_current);
+  else if (setup_mode == SETUP_MODE_CHOOSE_DROP_DISTANCE)
+    DrawChooseTree(&drop_distance_current);
   else
     DrawSetupScreen_Generic();
 
@@ -6890,6 +7198,12 @@ void HandleSetupScreen(int mx, int my, int dx, int dy, int button)
     HandleChooseTree(mx, my, dx, dy, button, &volume_loops_current);
   else if (setup_mode == SETUP_MODE_CHOOSE_VOLUME_MUSIC)
     HandleChooseTree(mx, my, dx, dy, button, &volume_music_current);
+  else if (setup_mode == SETUP_MODE_CHOOSE_TOUCH_CONTROL)
+    HandleChooseTree(mx, my, dx, dy, button, &touch_control_current);
+  else if (setup_mode == SETUP_MODE_CHOOSE_MOVE_DISTANCE)
+    HandleChooseTree(mx, my, dx, dy, button, &move_distance_current);
+  else if (setup_mode == SETUP_MODE_CHOOSE_DROP_DISTANCE)
+    HandleChooseTree(mx, my, dx, dy, button, &drop_distance_current);
   else
     HandleSetupScreen_Generic(mx, my, dx, dy, button);
 
@@ -7024,11 +7338,7 @@ static struct
 
 static struct
 {
-#if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
-  Bitmap **gfx_unpressed, **gfx_pressed;
-#else
   int gfx_unpressed, gfx_pressed;
-#endif
   int x, y;
   int width, height;
   int type;
@@ -7037,11 +7347,7 @@ static struct
 } scrollbar_info[NUM_SCREEN_SCROLLBARS] =
 {
   {
-#if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
-    &scrollbar_bitmap[0], &scrollbar_bitmap[1],
-#else
     IMG_MENU_SCROLLBAR, IMG_MENU_SCROLLBAR_ACTIVE,
-#endif
 #if 1
     -1, -1,    /* these values are not constant, but can change at runtime */
     -1, -1,    /* these values are not constant, but can change at runtime */
@@ -7184,9 +7490,7 @@ static void CreateScreenScrollbars()
   for (i = 0; i < NUM_SCREEN_SCROLLBARS; i++)
   {
     Bitmap *gd_bitmap_unpressed, *gd_bitmap_pressed;
-#if !defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
     int gfx_unpressed, gfx_pressed;
-#endif
     int x, y, width, height;
     int gd_x1, gd_x2, gd_y1, gd_y2;
     struct GadgetInfo *gi;
@@ -7209,14 +7513,6 @@ static void CreateScreenScrollbars()
     items_visible = num_page_entries;
     item_position = 0;
 
-#if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
-    gd_bitmap_unpressed = *scrollbar_info[i].gfx_unpressed;
-    gd_bitmap_pressed   = *scrollbar_info[i].gfx_pressed;
-    gd_x1 = 0;
-    gd_y1 = 0;
-    gd_x2 = 0;
-    gd_y2 = 0;
-#else
     gfx_unpressed = scrollbar_info[i].gfx_unpressed;
     gfx_pressed   = scrollbar_info[i].gfx_pressed;
     gd_bitmap_unpressed = graphic_info[gfx_unpressed].bitmap;
@@ -7225,7 +7521,6 @@ static void CreateScreenScrollbars()
     gd_y1 = graphic_info[gfx_unpressed].src_y;
     gd_x2 = graphic_info[gfx_pressed].src_x;
     gd_y2 = graphic_info[gfx_pressed].src_y;
-#endif
 
     gi = CreateGadget(GDI_CUSTOM_ID, id,
                      GDI_CUSTOM_TYPE_ID, i,
@@ -7269,27 +7564,6 @@ void CreateScreenGadgets()
 {
   int last_game_status = game_status;  /* save current game status */
 
-#if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
-  int i;
-
-  for (i = 0; i < NUM_SCROLLBAR_BITMAPS; i++)
-  {
-    scrollbar_bitmap[i] = CreateBitmap(TILEX, TILEY, DEFAULT_DEPTH);
-
-    /* copy pointers to clip mask and GC */
-    scrollbar_bitmap[i]->clip_mask =
-      graphic_info[IMG_MENU_SCROLLBAR + i].clip_mask;
-    scrollbar_bitmap[i]->stored_clip_gc =
-      graphic_info[IMG_MENU_SCROLLBAR + i].clip_gc;
-
-    BlitBitmap(graphic_info[IMG_MENU_SCROLLBAR + i].bitmap,
-              scrollbar_bitmap[i],
-              graphic_info[IMG_MENU_SCROLLBAR + i].src_x,
-              graphic_info[IMG_MENU_SCROLLBAR + i].src_y,
-              TILEX, TILEY, 0, 0);
-  }
-#endif
-
   CreateScreenMenubuttons();
 
 #if 0
@@ -7307,17 +7581,6 @@ void FreeScreenGadgets()
 {
   int i;
 
-#if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
-  for (i = 0; i < NUM_SCROLLBAR_BITMAPS; i++)
-  {
-    /* prevent freeing clip mask and GC twice */
-    scrollbar_bitmap[i]->clip_mask = None;
-    scrollbar_bitmap[i]->stored_clip_gc = None;
-
-    FreeBitmap(scrollbar_bitmap[i]);
-  }
-#endif
-
   for (i = 0; i < NUM_SCREEN_GADGETS; i++)
     FreeGadget(screen_gadget[i]);
 }