fixed bug with alpha blending when configuring game controllers
[rocksndiamonds.git] / src / screens.c
index 026dfe0da833d47a2be776f27ecfdc56a8a1db94..552879f8a1f2d4c66659b412bb40175b90914e84 100644 (file)
@@ -4974,7 +4974,6 @@ static void execSetupGraphics()
 #endif
 }
 
-#if defined(TARGET_SDL2) && !defined(PLATFORM_ANDROID)
 static void execSetupChooseWindowSize()
 {
   setup_mode = SETUP_MODE_CHOOSE_WINDOW_SIZE;
@@ -4995,7 +4994,6 @@ static void execSetupChooseRenderingMode()
 
   DrawSetupScreen();
 }
-#endif
 
 static void execSetupChooseVolumeSimple()
 {
@@ -5512,6 +5510,69 @@ static void execSaveAndExitSetup()
   execExitSetup();
 }
 
+static struct
+{
+  void *value;
+  void *related_value;
+} hide_related_entry_list[] =
+{
+  { &setup.game_frame_delay,           execSetupChooseGameSpeed        },
+  { &setup.game_frame_delay,           &game_speed_text                },
+
+  { &setup.scroll_delay_value,         execSetupChooseScrollDelay      },
+  { &setup.scroll_delay_value,         &scroll_delay_text              },
+
+  { &setup.engine_snapshot_mode,       execSetupChooseSnapshotMode     },
+  { &setup.engine_snapshot_mode,       &snapshot_mode_text             },
+
+  { &setup.window_scaling_percent,     execSetupChooseWindowSize       },
+  { &setup.window_scaling_percent,     &window_size_text               },
+
+  { &setup.window_scaling_quality,     execSetupChooseScalingType      },
+  { &setup.window_scaling_quality,     &scaling_type_text              },
+
+  { &setup.screen_rendering_mode,      execSetupChooseRenderingMode    },
+  { &setup.screen_rendering_mode,      &rendering_mode_text            },
+
+  { &setup.graphics_set,               execSetupChooseGraphics         },
+  { &setup.graphics_set,               &graphics_set_name              },
+
+  { &setup.sounds_set,                 execSetupChooseSounds           },
+  { &setup.sounds_set,                 &sounds_set_name                },
+
+  { &setup.music_set,                  execSetupChooseMusic            },
+  { &setup.music_set,                  &music_set_name                 },
+
+  { &setup.volume_simple,              execSetupChooseVolumeSimple     },
+  { &setup.volume_simple,              &volume_simple_text             },
+
+  { &setup.volume_loops,               execSetupChooseVolumeLoops      },
+  { &setup.volume_loops,               &volume_loops_text              },
+
+  { &setup.volume_music,               execSetupChooseVolumeMusic      },
+  { &setup.volume_music,               &volume_music_text              },
+
+  { &setup.touch.control_type,         execSetupChooseTouchControls    },
+  { &setup.touch.control_type,         &touch_controls_text            },
+
+  { &setup.touch.move_distance,                execSetupChooseMoveDistance     },
+  { &setup.touch.move_distance,                &move_distance_text             },
+
+  { &setup.touch.drop_distance,                execSetupChooseDropDistance     },
+  { &setup.touch.drop_distance,                &drop_distance_text             },
+
+  { NULL,                              NULL                            }
+};
+
+void setHideRelatedSetupEntries()
+{
+  int i;
+
+  for (i = 0; hide_related_entry_list[i].value != NULL; i++)
+    if (hideSetupEntry(hide_related_entry_list[i].value))
+      setHideSetupEntry(hide_related_entry_list[i].related_value);
+}
+
 static struct TokenInfo setup_info_main[] =
 {
   { TYPE_ENTER_MENU,   execSetupGame,          STR_SETUP_GAME          },
@@ -6020,7 +6081,7 @@ static void changeSetupValue(int screen_pos, int setup_info_pos_raw, int dx)
 
 static struct TokenInfo *getSetupInfoFinal(struct TokenInfo *setup_info_orig)
 {
-  static struct TokenInfo *setup_info_hide = NULL;
+  static struct TokenInfo *setup_info_final = NULL;
   int list_size = 0;
   int list_pos = 0;
   int i;
@@ -6029,8 +6090,8 @@ static struct TokenInfo *getSetupInfoFinal(struct TokenInfo *setup_info_orig)
   while (setup_info_orig[list_size++].type != 0);
 
   /* free, allocate and clear memory for target list */
-  checked_free(setup_info_hide);
-  setup_info_hide = checked_calloc(list_size * sizeof(struct TokenInfo));
+  checked_free(setup_info_final);
+  setup_info_final = checked_calloc(list_size * sizeof(struct TokenInfo));
 
   /* copy setup info list without setup entries marked as hidden */
   for (i = 0; setup_info_orig[i].type != 0; i++)
@@ -6044,10 +6105,10 @@ static struct TokenInfo *getSetupInfoFinal(struct TokenInfo *setup_info_orig)
        setup_info_orig[i].type == TYPE_SKIPPABLE)
       continue;
 
-    setup_info_hide[list_pos++] = setup_info_orig[i];
+    setup_info_final[list_pos++] = setup_info_orig[i];
   }
 
-  return setup_info_hide;
+  return setup_info_final;
 }
 
 static void DrawSetupScreen_Generic()
@@ -6509,7 +6570,7 @@ static boolean CustomizeKeyboardMain(int player_nr)
   };
   int font_nr_old = FONT_VALUE_OLD;
   int font_nr_new = FONT_VALUE_1;
-  int success = FALSE;
+  boolean success = FALSE;
 
   if (SCR_FIELDX < SCR_FIELDX_DEFAULT)
   {
@@ -6837,6 +6898,7 @@ static boolean ConfigureJoystickMapButtonsAndAxes(SDL_Joystick *joystick)
                       controller->width, controller->height,
                       controller_x, controller_y);
 
+      SDL_SetSurfaceBlendMode(marker->surface_masked, SDL_BLENDMODE_BLEND);
       SDL_SetSurfaceAlphaMod(marker->surface_masked, alpha);
 
       BlitBitmapMasked(marker, drawto, 0, 0,
@@ -6941,6 +7003,8 @@ static boolean ConfigureJoystickMapButtonsAndAxes(SDL_Joystick *joystick)
                /* leave screen */
                success = FALSE;
                done = TRUE;
+
+               break;
              }
 
              /* undo this step */