fixed default graphics for growing or exploding BD engine elements
[rocksndiamonds.git] / src / screens.c
index b9f531582208520d1563cbe8d133c814dac0fc0b..2f53800c361200168aa221401a9564bd047d17e8 100644 (file)
 #define SETUP_MODE_SHORTCUTS_3                 12
 #define SETUP_MODE_SHORTCUTS_4                 13
 #define SETUP_MODE_SHORTCUTS_5                 14
+#define SETUP_MODE_SHORTCUTS_6                 15
 
 // sub-screens on the setup screen (generic)
-#define SETUP_MODE_CHOOSE_ARTWORK              15
-#define SETUP_MODE_CHOOSE_OTHER                        16
+#define SETUP_MODE_CHOOSE_ARTWORK              16
+#define SETUP_MODE_CHOOSE_OTHER                        17
 
 // sub-screens on the setup screen (specific)
-#define SETUP_MODE_CHOOSE_SCORES_TYPE          17
-#define SETUP_MODE_CHOOSE_GAME_SPEED           18
-#define SETUP_MODE_CHOOSE_SCROLL_DELAY         19
-#define SETUP_MODE_CHOOSE_SNAPSHOT_MODE                20
-#define SETUP_MODE_CHOOSE_GAME_ENGINE_TYPE     21
-#define SETUP_MODE_CHOOSE_BD_PALETTE_C64       22
-#define SETUP_MODE_CHOOSE_BD_PALETTE_C64DTV    23
-#define SETUP_MODE_CHOOSE_BD_PALETTE_ATARI     24
-#define SETUP_MODE_CHOOSE_BD_COLOR_TYPE                25
-#define SETUP_MODE_CHOOSE_WINDOW_SIZE          26
-#define SETUP_MODE_CHOOSE_SCALING_TYPE         27
-#define SETUP_MODE_CHOOSE_RENDERING            28
-#define SETUP_MODE_CHOOSE_VSYNC                        29
-#define SETUP_MODE_CHOOSE_GRAPHICS             30
-#define SETUP_MODE_CHOOSE_SOUNDS               31
-#define SETUP_MODE_CHOOSE_MUSIC                        32
-#define SETUP_MODE_CHOOSE_VOLUME_SIMPLE                33
-#define SETUP_MODE_CHOOSE_VOLUME_LOOPS         34
-#define SETUP_MODE_CHOOSE_VOLUME_MUSIC         35
-#define SETUP_MODE_CHOOSE_TOUCH_CONTROL                36
-#define SETUP_MODE_CHOOSE_MOVE_DISTANCE                37
-#define SETUP_MODE_CHOOSE_DROP_DISTANCE                38
-#define SETUP_MODE_CHOOSE_TRANSPARENCY         39
-#define SETUP_MODE_CHOOSE_GRID_XSIZE_0         40
-#define SETUP_MODE_CHOOSE_GRID_YSIZE_0         41
-#define SETUP_MODE_CHOOSE_GRID_XSIZE_1         42
-#define SETUP_MODE_CHOOSE_GRID_YSIZE_1         43
-#define SETUP_MODE_CONFIG_VIRT_BUTTONS         44
-
-#define MAX_SETUP_MODES                                45
+#define SETUP_MODE_CHOOSE_SCORES_TYPE          18
+#define SETUP_MODE_CHOOSE_GAME_SPEED           19
+#define SETUP_MODE_CHOOSE_SCROLL_DELAY         20
+#define SETUP_MODE_CHOOSE_SNAPSHOT_MODE                21
+#define SETUP_MODE_CHOOSE_GAME_ENGINE_TYPE     22
+#define SETUP_MODE_CHOOSE_BD_PALETTE_C64       23
+#define SETUP_MODE_CHOOSE_BD_PALETTE_C64DTV    24
+#define SETUP_MODE_CHOOSE_BD_PALETTE_ATARI     25
+#define SETUP_MODE_CHOOSE_BD_COLOR_TYPE                26
+#define SETUP_MODE_CHOOSE_WINDOW_SIZE          27
+#define SETUP_MODE_CHOOSE_SCALING_TYPE         28
+#define SETUP_MODE_CHOOSE_RENDERING            29
+#define SETUP_MODE_CHOOSE_VSYNC                        30
+#define SETUP_MODE_CHOOSE_GRAPHICS             31
+#define SETUP_MODE_CHOOSE_SOUNDS               32
+#define SETUP_MODE_CHOOSE_MUSIC                        33
+#define SETUP_MODE_CHOOSE_VOLUME_SIMPLE                34
+#define SETUP_MODE_CHOOSE_VOLUME_LOOPS         35
+#define SETUP_MODE_CHOOSE_VOLUME_MUSIC         36
+#define SETUP_MODE_CHOOSE_TOUCH_CONTROL                37
+#define SETUP_MODE_CHOOSE_MOVE_DISTANCE                38
+#define SETUP_MODE_CHOOSE_DROP_DISTANCE                39
+#define SETUP_MODE_CHOOSE_TRANSPARENCY         40
+#define SETUP_MODE_CHOOSE_GRID_XSIZE_0         41
+#define SETUP_MODE_CHOOSE_GRID_YSIZE_0         42
+#define SETUP_MODE_CHOOSE_GRID_XSIZE_1         43
+#define SETUP_MODE_CHOOSE_GRID_YSIZE_1         44
+#define SETUP_MODE_CONFIG_VIRT_BUTTONS         45
+
+#define MAX_SETUP_MODES                                46
 
 #define MAX_MENU_MODES                         MAX(MAX_INFO_MODES, MAX_SETUP_MODES)
 
@@ -723,7 +724,7 @@ static int align_yoffset = 0;
                                 INFO_MODE_MAIN)
 
 #define DRAW_MODE_SETUP(i)     ((i) >= SETUP_MODE_MAIN &&                      \
-                                (i) <= SETUP_MODE_SHORTCUTS_5 ? (i) :          \
+                                (i) <= SETUP_MODE_SHORTCUTS_6 ? (i) :          \
                                 (i) >= SETUP_MODE_CHOOSE_GRAPHICS &&           \
                                 (i) <= SETUP_MODE_CHOOSE_MUSIC ?               \
                                 SETUP_MODE_CHOOSE_ARTWORK :                    \
@@ -1928,7 +1929,7 @@ void DrawMainMenu(void)
   SetAnimationFirstLevel(leveldir_current->first_level);
 
   // level_nr may have been set to value over handicap with level editor
-  if (setup.handicap && level_nr > leveldir_current->handicap_level)
+  if (setup.allow_skipping_levels != STATE_TRUE && level_nr > leveldir_current->handicap_level)
     level_nr = leveldir_current->handicap_level;
 
   LoadLevel(level_nr);
@@ -2285,13 +2286,14 @@ static void HandleMainMenu_SelectLevel(int step, int direction,
   if (new_level_nr > leveldir_current->last_level)
     new_level_nr = leveldir_current->last_level;
 
-  if (setup.handicap && new_level_nr > leveldir_current->handicap_level)
+  if (setup.allow_skipping_levels != STATE_TRUE && new_level_nr > leveldir_current->handicap_level)
   {
     // skipping levels is only allowed when trying to skip single level
     // (also, skipping BD style intermission levels is always possible)
     if (new_level_nr == old_level_nr + 1 &&
        (level.bd_intermission ||
-        (setup.skip_levels && Request("Level still unsolved! Skip it anyway?", REQ_ASK))))
+        (setup.allow_skipping_levels == STATE_ASK &&
+         Request("Level still unsolved! Skip it anyway?", REQ_ASK))))
     {
       leveldir_current->handicap_level++;
       SaveLevelSetup_SeriesInfo();
@@ -2632,6 +2634,7 @@ static int getMenuTextFont(int type)
   if (type & (TYPE_SWITCH      |
              TYPE_YES_NO       |
              TYPE_YES_NO_AUTO  |
+             TYPE_YES_NO_ASK   |
              TYPE_STRING       |
              TYPE_PLAYER       |
              TYPE_ECS_AGA      |
@@ -3078,6 +3081,7 @@ static void HandleMenuScreen(int mx, int my, int dx, int dy, int button,
       if (menu_info[choice].type & menu_navigation_type ||
          menu_info[choice].type & TYPE_BOOLEAN_STYLE ||
          menu_info[choice].type & TYPE_YES_NO_AUTO ||
+         menu_info[choice].type & TYPE_YES_NO_ASK ||
          menu_info[choice].type & TYPE_PLAYER)
        button = MB_MENU_CHOICE;
     }
@@ -5716,7 +5720,7 @@ static void HandleHallOfFame_SelectLevel(int step, int direction)
   if (new_level_nr > leveldir_current->last_level)
     new_level_nr = leveldir_current->last_level;
 
-  if (setup.handicap && new_level_nr > leveldir_current->handicap_level)
+  if (setup.allow_skipping_levels != STATE_TRUE && new_level_nr > leveldir_current->handicap_level)
     new_level_nr = leveldir_current->handicap_level;
 
   if (new_level_nr != old_level_nr)
@@ -7625,6 +7629,13 @@ static void execSetupShortcuts5(void)
   DrawSetupScreen();
 }
 
+static void execSetupShortcuts6(void)
+{
+  setup_mode = SETUP_MODE_SHORTCUTS_6;
+
+  DrawSetupScreen();
+}
+
 static void execExitSetup(void)
 {
   SetGameStatus(GAME_MODE_MAIN);
@@ -7880,6 +7891,7 @@ static struct
   { &setup.internal.menu_shortcuts_tape,       execSetupShortcuts3             },
   { &setup.internal.menu_shortcuts_sound,      execSetupShortcuts4             },
   { &setup.internal.menu_shortcuts_snap,       execSetupShortcuts5             },
+  { &setup.internal.menu_shortcuts_speed,      execSetupShortcuts6             },
 
   { &setup.internal.info_title,                        execInfoTitleScreen             },
   { &setup.internal.info_elements,             execInfoElements                },
@@ -7934,8 +7946,12 @@ static struct TokenInfo setup_info_game[] =
   { TYPE_SWITCH,       &setup.multiple_users,          "Multiple Users/Teams:"         },
   { TYPE_YES_NO,       &setup.input_on_focus,          "Only Move Focussed Player:"    },
   { TYPE_SWITCH,       &setup.time_limit,              "Time Limit:"                   },
+#if 1
+  { TYPE_YES_NO_ASK,   &setup.allow_skipping_levels,   "Allow Skipping Levels:"        },
+#else
   { TYPE_SWITCH,       &setup.handicap,                "Force Solving Levels:"         },
   { TYPE_SWITCH,       &setup.skip_levels,             "Allow Skipping Levels:"        },
+#endif
   { TYPE_SWITCH,       &setup.increment_levels,        "Increment Solved Levels:"      },
   { TYPE_SWITCH,       &setup.auto_play_next_level,    "Auto-play Next Level:"         },
   { TYPE_SWITCH,       &setup.count_score_after_game,  "Count Score After Game:"       },
@@ -7974,6 +7990,9 @@ static struct TokenInfo setup_info_engines[] =
   { TYPE_SWITCH,       &setup.bd_scroll_delay,         "Scroll Delay:"                 },
   { TYPE_YES_NO_AUTO,  &setup.bd_smooth_movements,     "Smooth Element Movement:"      },
   { TYPE_YES_NO_AUTO,  &setup.bd_pushing_graphics,     "Use Player Pushing Graphics:"  },
+  { TYPE_YES_NO_AUTO,  &setup.bd_up_down_graphics,     "Use Player Up/Down Graphics:"  },
+  { TYPE_YES_NO_AUTO,  &setup.bd_skip_falling_sounds,  "Mute Double Falling Sounds:"   },
+  { TYPE_SWITCH,       &setup.bd_show_invisible_outbox,"Show invisible outbox:"        },
   { TYPE_ENTER_LIST,   &execSetupChoosePaletteC64,     "Color Palette (C64):"          },
   { TYPE_STRING,       &bd_palette_c64_text,           ""                              },
   { TYPE_ENTER_LIST,   &execSetupChoosePaletteC64DTV,  "Color Palette (C64DTV):"       },
@@ -8080,6 +8099,8 @@ static struct TokenInfo setup_info_sound[] =
   { TYPE_ENTER_LIST,   execSetupChooseVolumeMusic,     "Music Volume:"                 },
   { TYPE_STRING,       &volume_music_text,             ""                              },
   { TYPE_EMPTY,                NULL,                           ""                              },
+  { TYPE_SWITCH,       &setup.audio_sample_rate_44100, "44100 Hz audio mixing:"        },
+  { TYPE_EMPTY,                NULL,                           ""                              },
   { TYPE_LEAVE_MENU,   execSetupMain,                  "Back"                          },
 
   { 0,                 NULL,                           NULL                            }
@@ -8203,6 +8224,7 @@ static struct TokenInfo setup_info_shortcuts[] =
   { TYPE_ENTER_MENU,   execSetupShortcuts3,            "Tape Buttons"                  },
   { TYPE_ENTER_MENU,   execSetupShortcuts4,            "Sound & Music"                 },
   { TYPE_ENTER_MENU,   execSetupShortcuts5,            "TAS Snap Keys"                 },
+  { TYPE_ENTER_MENU,   execSetupShortcuts6,            "Speed Keys"                    },
   { TYPE_EMPTY,                NULL,                           ""                              },
   { TYPE_LEAVE_MENU,   execSetupMain,                  "Back"                          },
 
@@ -8298,6 +8320,18 @@ static struct TokenInfo setup_info_shortcuts_5[] =
   { 0,                 NULL,                           NULL                            }
 };
 
+static struct TokenInfo setup_info_shortcuts_6[] =
+{
+  { TYPE_KEYTEXT,      NULL,                           "Fast Playing Speed:"           },
+  { TYPE_KEY,          &setup.shortcut.speed_fast,     ""                              },
+  { TYPE_KEYTEXT,      NULL,                           "Slow Playing Speed:"           },
+  { TYPE_KEY,          &setup.shortcut.speed_slow,     ""                              },
+  { TYPE_EMPTY,                NULL,                           ""                              },
+  { TYPE_LEAVE_MENU,   execSetupShortcuts,             "Back"                          },
+
+  { 0,                 NULL,                           NULL                            }
+};
+
 static Key getSetupKey(void)
 {
   Key key = KSYM_UNDEFINED;
@@ -8352,8 +8386,11 @@ static int getSetupValueFont(int type, void *value)
   else if (type & TYPE_BOOLEAN_STYLE)
     return (*(boolean *)value ? FONT_OPTION_ON : FONT_OPTION_OFF);
   else if (type & TYPE_YES_NO_AUTO)
-    return (*(int *)value == AUTO  ? FONT_OPTION_ON :
-           *(int *)value == FALSE ? FONT_OPTION_OFF : FONT_OPTION_ON);
+    return (*(int *)value == STATE_AUTO  ? FONT_OPTION_ON :
+           *(int *)value == STATE_FALSE ? FONT_OPTION_OFF : FONT_OPTION_ON);
+  else if (type & TYPE_YES_NO_ASK)
+    return (*(int *)value == STATE_ASK   ? FONT_OPTION_ON :
+           *(int *)value == STATE_FALSE ? FONT_OPTION_OFF : FONT_OPTION_ON);
   else if (type & TYPE_PLAYER)
     return FONT_VALUE_1;
   else
@@ -8497,10 +8534,19 @@ static void changeSetupValue(int screen_pos, int setup_info_pos_raw, int dx)
   {
     *(int *)si->value =
       (dx == -1 ?
-       (*(int *)si->value == AUTO ? TRUE :
-       *(int *)si->value == TRUE ? FALSE : AUTO) :
-       (*(int *)si->value == TRUE ? AUTO :
-       *(int *)si->value == AUTO ? FALSE : TRUE));
+       (*(int *)si->value == STATE_AUTO ? STATE_TRUE :
+       *(int *)si->value == STATE_TRUE ? STATE_FALSE : STATE_AUTO) :
+       (*(int *)si->value == STATE_TRUE ? STATE_AUTO :
+       *(int *)si->value == STATE_AUTO ? STATE_FALSE : STATE_TRUE));
+  }
+  else if (si->type & TYPE_YES_NO_ASK)
+  {
+    *(int *)si->value =
+      (dx == -1 ?
+       (*(int *)si->value == STATE_ASK  ? STATE_TRUE :
+       *(int *)si->value == STATE_TRUE ? STATE_FALSE : STATE_ASK) :
+       (*(int *)si->value == STATE_TRUE ? STATE_ASK :
+       *(int *)si->value == STATE_ASK  ? STATE_FALSE : STATE_TRUE));
   }
   else if (si->type & TYPE_KEY)
   {
@@ -8532,6 +8578,10 @@ static void changeSetupValue(int screen_pos, int setup_info_pos_raw, int dx)
   if (si->value == &setup.fullscreen)
     ToggleFullscreenIfNeeded();
 
+  // audio sample rate may have changed at this point
+  if (si->value == &setup.audio_sample_rate_44100)
+    ToggleAudioSampleRateIfNeeded();
+
   // network mode may have changed at this point
   if (si->value == &setup.network_mode)
     ToggleNetworkModeIfNeeded();
@@ -8682,6 +8732,11 @@ static void DrawSetupScreen_Generic(void)
     setup_info = setup_info_shortcuts_5;
     title_string = STR_SETUP_SHORTCUTS;
   }
+  else if (setup_mode == SETUP_MODE_SHORTCUTS_6)
+  {
+    setup_info = setup_info_shortcuts_6;
+    title_string = STR_SETUP_SHORTCUTS;
+  }
 
   // use modified setup info without setup entries marked as hidden
   setup_info = getSetupInfoFinal(setup_info);