added support for amoeba settings in BD engine to level editor
[rocksndiamonds.git] / src / main.c
index 3ef3df989bd6e5380d6ce39a64db2bf9b4b23fab..a727eaa53439274ce584613a0c1d062cc879bc55 100644 (file)
 #include "events.h"
 #include "config.h"
 
-Bitmap                *bitmap_db_field;
-Bitmap                *bitmap_db_panel;
-Bitmap                *bitmap_db_door_1;
-Bitmap                *bitmap_db_door_2;
-Bitmap                *bitmap_db_store_1;
-Bitmap                *bitmap_db_store_2;
-DrawBuffer            *fieldbuffer;
-DrawBuffer            *drawto_field;
+Bitmap                        *bitmap_db_field;
+Bitmap                        *bitmap_db_door_1;
+Bitmap                        *bitmap_db_door_2;
+Bitmap                        *bitmap_db_store_1;
+Bitmap                        *bitmap_db_store_2;
+DrawBuffer                    *fieldbuffer;
+DrawBuffer                    *drawto_field;
 
-int                    game_status = -1;
-int                    game_status_last_screen = -1;
-boolean                        level_editor_test_game = FALSE;
-boolean                        score_info_tape_play = FALSE;
-boolean                        network_playing = FALSE;
+int                            game_status = -1;
+int                            game_status_last_screen = -1;
+boolean                                level_editor_test_game = FALSE;
+boolean                                score_info_tape_play = FALSE;
+boolean                                network_playing = FALSE;
 
-int                    key_joystick_mapping = 0;
+int                            key_joystick_mapping = 0;
 
-short                  Tile[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-short                  Last[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-short                  MovPos[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-short                  MovDir[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-short                  MovDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-short                  ChangeDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-short                  ChangePage[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-short                  CustomValue[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-short                  Store[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-short                  Store2[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-short                  StorePlayer[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-short                  Back[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-boolean                        Stop[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-boolean                        Pushed[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-short                  ChangeCount[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-short                  ChangeEvent[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-short                  WasJustMoving[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-short                  WasJustFalling[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-short                  CheckCollision[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-short                  CheckImpact[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-short                  AmoebaNr[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-short                  AmoebaCnt[MAX_NUM_AMOEBA];
-short                  AmoebaCnt2[MAX_NUM_AMOEBA];
-short                  ExplodeField[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-short                  ExplodePhase[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-short                  ExplodeDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-int                    RunnerVisit[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-int                    PlayerVisit[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+short                          Tile[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+short                          Last[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+short                          MovPos[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+short                          MovDir[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+short                          MovDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+short                          ChangeDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+short                          ChangePage[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+short                          CustomValue[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+short                          Store[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+short                          Store2[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+short                          StorePlayer[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+short                          Back[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+boolean                                Stop[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+boolean                                Pushed[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+short                          ChangeCount[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+short                          ChangeEvent[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+short                          WasJustMoving[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+short                          WasJustFalling[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+short                          CheckCollision[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+short                          CheckImpact[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+short                          AmoebaNr[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+short                          AmoebaCnt[MAX_NUM_AMOEBA];
+short                          AmoebaCnt2[MAX_NUM_AMOEBA];
+short                          ExplodeField[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+short                          ExplodePhase[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+short                          ExplodeDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+int                            RunnerVisit[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+int                            PlayerVisit[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 
-int                    GfxFrame[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-int                    GfxRandom[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-int                    GfxRandomStatic[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-int                    GfxElement[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-int                    GfxElementEmpty[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-int                    GfxAction[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-int                    GfxDir[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
-int                    GfxRedraw[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+int                            GfxFrame[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+int                            GfxRandom[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+int                            GfxRandomStatic[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+int                            GfxElement[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+int                            GfxElementEmpty[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+int                            GfxAction[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+int                            GfxDir[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+int                            GfxRedraw[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 
-int                    ActiveElement[MAX_NUM_ELEMENTS];
-int                    ActiveButton[NUM_IMAGE_FILES];
-int                    ActiveFont[NUM_FONTS];
+int                            ActiveElement[MAX_NUM_ELEMENTS];
+int                            ActiveButton[NUM_IMAGE_FILES];
+int                            ActiveFont[NUM_FONTS];
 
-int                    lev_fieldx, lev_fieldy;
-int                    scroll_x, scroll_y;
+int                            lev_fieldx, lev_fieldy;
+int                            scroll_x, scroll_y;
 
-int                    WIN_XSIZE = WIN_XSIZE_DEFAULT;
-int                    WIN_YSIZE = WIN_YSIZE_DEFAULT;
+int                            WIN_XSIZE = WIN_XSIZE_DEFAULT;
+int                            WIN_YSIZE = WIN_YSIZE_DEFAULT;
 
-int                    SCR_FIELDX = SCR_FIELDX_DEFAULT;
-int                    SCR_FIELDY = SCR_FIELDY_DEFAULT;
+int                            SCR_FIELDX = SCR_FIELDX_DEFAULT;
+int                            SCR_FIELDY = SCR_FIELDY_DEFAULT;
 
-int                    REAL_SX = 6, REAL_SY = 6;
-int                    SX = 8, SY = 8;
-int                    DX = 566, DY = 60;
-int                    VX = 566, VY = 400;
-int                    EX = 566, EY = 356;
-int                    dDX, dDY;
+int                            REAL_SX = 6, REAL_SY = 6;
+int                            SX = 8, SY = 8;
+int                            DX = 566, DY = 60;
+int                            VX = 566, VY = 400;
+int                            EX = 566, EY = 356;
+int                            dDX, dDY;
 
-int                    FULL_SXSIZE = 2 + SXSIZE_DEFAULT + 2;
-int                    FULL_SYSIZE = 2 + SYSIZE_DEFAULT + 2;
-int                    SXSIZE = SXSIZE_DEFAULT;
-int                    SYSIZE = SYSIZE_DEFAULT;
+int                            FULL_SXSIZE = 2 + SXSIZE_DEFAULT + 2;
+int                            FULL_SYSIZE = 2 + SYSIZE_DEFAULT + 2;
+int                            SXSIZE = SXSIZE_DEFAULT;
+int                            SYSIZE = SYSIZE_DEFAULT;
 
-int                    FADE_SX = 6, FADE_SY = 6;
-int                    FADE_SXSIZE = 2 + SXSIZE_DEFAULT + 2;
-int                    FADE_SYSIZE = 2 + SXSIZE_DEFAULT + 2;
+int                            FADE_SX = 6, FADE_SY = 6;
+int                            FADE_SXSIZE = 2 + SXSIZE_DEFAULT + 2;
+int                            FADE_SYSIZE = 2 + SXSIZE_DEFAULT + 2;
 
-int                    DXSIZE = 100;
-int                    DYSIZE = 280;
-int                    VXSIZE = 100;
-int                    VYSIZE = 100;
-int                    EXSIZE = 100;
-int                    EYSIZE = 144;
-int                    TILESIZE_VAR = TILESIZE;
+int                            DXSIZE = 100;
+int                            DYSIZE = 280;
+int                            VXSIZE = 100;
+int                            VYSIZE = 100;
+int                            EXSIZE = 100;
+int                            EYSIZE = 144;
+int                            TILESIZE_VAR = TILESIZE;
 
-int                    FX, FY;
-int                    ScrollStepSize;
-int                    ScreenMovDir = MV_NONE, ScreenMovPos = 0;
-int                    ScreenGfxPos = 0;
-int                    BorderElement = EL_STEELWALL;
-int                    MenuFrameDelay = MENU_FRAME_DELAY;
-int                    GameFrameDelay = GAME_FRAME_DELAY;
-int                    FfwdFrameDelay = FFWD_FRAME_DELAY;
-int                    BX1, BY1;
-int                    BX2, BY2;
-int                    SBX_Left, SBX_Right;
-int                    SBY_Upper, SBY_Lower;
+int                            FX, FY;
+int                            ScrollStepSize;
+int                            ScreenMovDir = MV_NONE, ScreenMovPos = 0;
+int                            ScreenGfxPos = 0;
+int                            BorderElement = EL_STEELWALL;
+int                            MenuFrameDelay = MENU_FRAME_DELAY;
+int                            GameFrameDelay = GAME_FRAME_DELAY;
+int                            FfwdFrameDelay = FFWD_FRAME_DELAY;
+int                            BX1, BY1;
+int                            BX2, BY2;
+int                            SBX_Left, SBX_Right;
+int                            SBY_Upper, SBY_Lower;
 
-int                    TimeFrames, TimePlayed, TimeLeft, TapeTime;
+int                            TimeFrames, TimePlayed, TimeLeft;
+int                            TapeTimeFrames, TapeTime;
 
-boolean                        network_player_action_received = FALSE;
+boolean                                network_player_action_received = FALSE;
 
-struct LevelInfo       level, level_template;
-struct PlayerInfo      stored_player[MAX_PLAYERS], *local_player = NULL;
-struct ScoreInfo       scores, server_scores;
-struct TapeInfo                tape;
-struct GameInfo                game;
-struct GlobalInfo      global;
-struct BorderInfo      border;
-struct ViewportInfo    viewport;
-struct TitleFadingInfo fading;
-struct TitleFadingInfo title_initial_first_default;
-struct TitleFadingInfo title_initial_default;
-struct TitleFadingInfo title_first_default;
-struct TitleFadingInfo title_default;
-struct TitleMessageInfo        titlescreen_initial_first_default;
-struct TitleMessageInfo        titlescreen_initial_first[MAX_NUM_TITLE_IMAGES];
-struct TitleMessageInfo        titlescreen_initial_default;
-struct TitleMessageInfo        titlescreen_initial[MAX_NUM_TITLE_IMAGES];
-struct TitleMessageInfo        titlescreen_first_default;
-struct TitleMessageInfo        titlescreen_first[MAX_NUM_TITLE_IMAGES];
-struct TitleMessageInfo        titlescreen_default;
-struct TitleMessageInfo        titlescreen[MAX_NUM_TITLE_IMAGES];
-struct TitleMessageInfo        titlemessage_initial_first_default;
-struct TitleMessageInfo        titlemessage_initial_first[MAX_NUM_TITLE_MESSAGES];
-struct TitleMessageInfo        titlemessage_initial_default;
-struct TitleMessageInfo        titlemessage_initial[MAX_NUM_TITLE_MESSAGES];
-struct TitleMessageInfo        titlemessage_first_default;
-struct TitleMessageInfo        titlemessage_first[MAX_NUM_TITLE_MESSAGES];
-struct TitleMessageInfo        titlemessage_default;
-struct TitleMessageInfo        titlemessage[MAX_NUM_TITLE_MESSAGES];
-struct TitleMessageInfo        readme;
-struct InitInfo                init, init_last;
-struct MenuInfo                menu;
-struct DoorInfo                door_1, door_2;
-struct RequestInfo     request;
-struct PreviewInfo     preview;
-struct EditorInfo      editor;
+struct LevelInfo               level, level_template;
+struct PlayerInfo              stored_player[MAX_PLAYERS], *local_player = NULL;
+struct ScoreInfo               scores, server_scores;
+struct TapeInfo                        tape;
+struct GameInfo                        game;
+struct GlobalInfo              global;
+struct BorderInfo              border;
+struct ViewportInfo            viewport;
+struct TitleFadingInfo         fading;
+struct TitleFadingInfo         title_initial_first_default;
+struct TitleFadingInfo         title_initial_default;
+struct TitleFadingInfo         title_first_default;
+struct TitleFadingInfo         title_default;
+struct TitleMessageInfo                titlescreen_initial_first_default;
+struct TitleMessageInfo                titlescreen_initial_first[MAX_NUM_TITLE_IMAGES];
+struct TitleMessageInfo                titlescreen_initial_default;
+struct TitleMessageInfo                titlescreen_initial[MAX_NUM_TITLE_IMAGES];
+struct TitleMessageInfo                titlescreen_first_default;
+struct TitleMessageInfo                titlescreen_first[MAX_NUM_TITLE_IMAGES];
+struct TitleMessageInfo                titlescreen_default;
+struct TitleMessageInfo                titlescreen[MAX_NUM_TITLE_IMAGES];
+struct TitleMessageInfo                titlemessage_initial_first_default;
+struct TitleMessageInfo                titlemessage_initial_first[MAX_NUM_TITLE_MESSAGES];
+struct TitleMessageInfo                titlemessage_initial_default;
+struct TitleMessageInfo                titlemessage_initial[MAX_NUM_TITLE_MESSAGES];
+struct TitleMessageInfo                titlemessage_first_default;
+struct TitleMessageInfo                titlemessage_first[MAX_NUM_TITLE_MESSAGES];
+struct TitleMessageInfo                titlemessage_default;
+struct TitleMessageInfo                titlemessage[MAX_NUM_TITLE_MESSAGES];
+struct TitleMessageInfo                readme;
+struct InitInfo                        init, init_last;
+struct MenuInfo                        menu;
+struct DoorInfo                        door_1, door_2;
+struct RequestInfo             request;
+struct PreviewInfo             preview;
+struct EditorInfo              editor;
 
-struct GraphicInfo     *graphic_info = NULL;
-struct SoundInfo       *sound_info = NULL;
-struct MusicInfo       *music_info = NULL;
-struct MusicFileInfo   *music_file_info = NULL;
-struct HelpAnimInfo    *helpanim_info = NULL;
+struct GraphicInfo            *graphic_info = NULL;
+struct SoundInfo              *sound_info = NULL;
+struct MusicInfo              *music_info = NULL;
+struct MusicFileInfo          *music_file_info = NULL;
+struct HelpAnimInfo           *helpanim_info = NULL;
 
-SetupFileHash          *helptext_info = NULL;
-SetupFileHash         *image_config_hash = NULL;
-SetupFileHash         *element_token_hash = NULL;
-SetupFileHash         *graphic_token_hash = NULL;
-SetupFileHash         *font_token_hash = NULL;
-SetupFileHash         *hide_setup_hash = NULL;
-SetupFileHash         *anim_url_hash = NULL;
+SetupFileHash                 *helptext_info = NULL;
+SetupFileHash                 *image_config_hash = NULL;
+SetupFileHash                 *sound_config_hash = NULL;
+SetupFileHash                 *element_token_hash = NULL;
+SetupFileHash                 *graphic_token_hash = NULL;
+SetupFileHash                 *font_token_hash = NULL;
+SetupFileHash                 *hide_setup_hash = NULL;
+SetupFileHash                 *anim_url_hash = NULL;
 
 
 // ----------------------------------------------------------------------------
@@ -3763,7 +3764,7 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] =
   },
   {
     "bd_expandable_wall",
-    "wall",
+    "bd_expandable_wall",
     "growing wall (horizontal, BD style)"
   },
   {
@@ -4664,7 +4665,7 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] =
   {
     "mm_kettle",
     "mm_kettle",
-    "magic kettle"
+    "magic cauldron"
   },
   {
     "mm_bomb",
@@ -5219,17 +5220,17 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] =
   {
     "mm_mirror_fixed_2",
     "mm_mirror_fixed",
-    "fixed mirror (0\xb0)"
+    "fixed mirror (45\xb0)"
   },
   {
     "mm_mirror_fixed_3",
     "mm_mirror_fixed",
-    "fixed mirror (0\xb0)"
+    "fixed mirror (90\xb0)"
   },
   {
     "mm_mirror_fixed_4",
     "mm_mirror_fixed",
-    "fixed mirror (0\xb0)"
+    "fixed mirror (135\xb0)"
   },
   {
     "mm_steel_lock",
@@ -5297,24 +5298,24 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] =
     "extra energy ball (empty)"
   },
   {
-    "mm_unused_156",
-    "unused",
-    "(not used)"
+    "mm_envelope_1",
+    "mm_envelope",
+    "mail envelope 1 (MM style)"
   },
   {
-    "mm_unused_157",
-    "unused",
-    "(not used)"
+    "mm_envelope_2",
+    "mm_envelope",
+    "mail envelope 2 (MM style)"
   },
   {
-    "mm_unused_158",
-    "unused",
-    "(not used)"
+    "mm_envelope_3",
+    "mm_envelope",
+    "mail envelope 3 (MM style)"
   },
   {
-    "mm_unused_159",
-    "unused",
-    "(not used)"
+    "mm_envelope_4",
+    "mm_envelope",
+    "mail envelope 4 (MM style)"
   },
   {
     "df_mirror_1",
@@ -5399,82 +5400,82 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] =
   {
     "df_wooden_grid_fixed_1",
     "df_wooden_grid_fixed",
-    "fixed wooden polarizer (0\xb0)"
+    "fixed wooden polarizer (DF) (0\xb0)"
   },
   {
     "df_wooden_grid_fixed_2",
     "df_wooden_grid_fixed",
-    "fixed wooden polarizer (22.5\xb0)"
+    "fixed wooden polarizer (DF) (22.5\xb0)"
   },
   {
     "df_wooden_grid_fixed_3",
     "df_wooden_grid_fixed",
-    "fixed wooden polarizer (45\xb0)"
+    "fixed wooden polarizer (DF) (45\xb0)"
   },
   {
     "df_wooden_grid_fixed_4",
     "df_wooden_grid_fixed",
-    "fixed wooden polarizer (67.5\xb0)"
+    "fixed wooden polarizer (DF) (67.5\xb0)"
   },
   {
     "df_wooden_grid_fixed_5",
     "df_wooden_grid_fixed",
-    "fixed wooden polarizer (90\xb0)"
+    "fixed wooden polarizer (DF) (90\xb0)"
   },
   {
     "df_wooden_grid_fixed_6",
     "df_wooden_grid_fixed",
-    "fixed wooden polarizer (112.5\xb0)"
+    "fixed wooden polarizer (DF) (112.5\xb0)"
   },
   {
     "df_wooden_grid_fixed_7",
     "df_wooden_grid_fixed",
-    "fixed wooden polarizer (135\xb0)"
+    "fixed wooden polarizer (DF) (135\xb0)"
   },
   {
     "df_wooden_grid_fixed_8",
     "df_wooden_grid_fixed",
-    "fixed wooden polarizer (157.5\xb0)"
+    "fixed wooden polarizer (DF) (157.5\xb0)"
   },
   {
     "df_steel_grid_fixed_1",
     "df_steel_grid_fixed",
-    "fixed steel polarizer (0\xb0)"
+    "fixed steel polarizer (DF) (0\xb0)"
   },
   {
     "df_steel_grid_fixed_2",
     "df_steel_grid_fixed",
-    "fixed steel polarizer (22.5\xb0)"
+    "fixed steel polarizer (DF) (22.5\xb0)"
   },
   {
     "df_steel_grid_fixed_3",
     "df_steel_grid_fixed",
-    "fixed steel polarizer (45\xb0)"
+    "fixed steel polarizer (DF) (45\xb0)"
   },
   {
     "df_steel_grid_fixed_4",
     "df_steel_grid_fixed",
-    "fixed steel polarizer (67.5\xb0)"
+    "fixed steel polarizer (DF) (67.5\xb0)"
   },
   {
     "df_steel_grid_fixed_5",
     "df_steel_grid_fixed",
-    "fixed steel polarizer (90\xb0)"
+    "fixed steel polarizer (DF) (90\xb0)"
   },
   {
     "df_steel_grid_fixed_6",
     "df_steel_grid_fixed",
-    "fixed steel polarizer (112.5\xb0)"
+    "fixed steel polarizer (DF) (112.5\xb0)"
   },
   {
     "df_steel_grid_fixed_7",
     "df_steel_grid_fixed",
-    "fixed steel polarizer (135\xb0)"
+    "fixed steel polarizer (DF) (135\xb0)"
   },
   {
     "df_steel_grid_fixed_8",
     "df_steel_grid_fixed",
-    "fixed steel polarizer (157.5\xb0)"
+    "fixed steel polarizer (DF) (157.5\xb0)"
   },
   {
     "df_wooden_wall_1",
@@ -6361,6 +6362,771 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] =
     "empty_space",
     "empty space 16"
   },
+  {
+    "df_mirror_fixed_1",
+    "df_mirror_fixed",
+    "fixed mirror (DF style) (0\xb0)"
+  },
+  {
+    "df_mirror_fixed_2",
+    "df_mirror_fixed",
+    "fixed mirror (DF style) (11.25\xb0)"
+  },
+  {
+    "df_mirror_fixed_3",
+    "df_mirror_fixed",
+    "fixed mirror (DF style) (22.5\xb0)"
+  },
+  {
+    "df_mirror_fixed_4",
+    "df_mirror_fixed",
+    "fixed mirror (DF style) (33.75\xb0)"
+  },
+  {
+    "df_mirror_fixed_5",
+    "df_mirror_fixed",
+    "fixed mirror (DF style) (45\xb0)"
+  },
+  {
+    "df_mirror_fixed_6",
+    "df_mirror_fixed",
+    "fixed mirror (DF style) (56.25\xb0)"
+  },
+  {
+    "df_mirror_fixed_7",
+    "df_mirror_fixed",
+    "fixed mirror (DF style) (67.5\xb0)"
+  },
+  {
+    "df_mirror_fixed_8",
+    "df_mirror_fixed",
+    "fixed mirror (DF style) (78.75\xb0)"
+  },
+  {
+    "df_mirror_fixed_9",
+    "df_mirror_fixed",
+    "fixed mirror (DF style) (90\xb0)"
+  },
+  {
+    "df_mirror_fixed_10",
+    "df_mirror_fixed",
+    "fixed mirror (DF style) (101.25\xb0)"
+  },
+  {
+    "df_mirror_fixed_11",
+    "df_mirror_fixed",
+    "fixed mirror (DF style) (112.5\xb0)"
+  },
+  {
+    "df_mirror_fixed_12",
+    "df_mirror_fixed",
+    "fixed mirror (DF style) (123.75\xb0)"
+  },
+  {
+    "df_mirror_fixed_13",
+    "df_mirror_fixed",
+    "fixed mirror (DF style) (135\xb0)"
+  },
+  {
+    "df_mirror_fixed_14",
+    "df_mirror_fixed",
+    "fixed mirror (DF style) (146.25\xb0)"
+  },
+  {
+    "df_mirror_fixed_15",
+    "df_mirror_fixed",
+    "fixed mirror (DF style) (157.5\xb0)"
+  },
+  {
+    "df_mirror_fixed_16",
+    "df_mirror_fixed",
+    "fixed mirror (DF style) (168.75\xb0)"
+  },
+  {
+    "df_slope_1",
+    "df_slope",
+    "slope (DF style) (45\xb0)"
+  },
+  {
+    "df_slope_2",
+    "df_slope",
+    "slope (DF style) (135\xb0)"
+  },
+  {
+    "df_slope_3",
+    "df_slope",
+    "slope (DF style) (225\xb0)"
+  },
+  {
+    "df_slope_4",
+    "df_slope",
+    "slope (DF style) (315\xb0)"
+  },
+  {
+    "bd_empty_space",
+    "empty_space",
+    "empty space"
+  },
+  {
+    "bd_sand",
+    "bd_sand",
+    "sand"
+  },
+  {
+    "bd_sand_2",
+    "bd_sand",
+    "sand 2"
+  },
+  {
+    "bd_sand_ball",
+    "bd_sand_ball",
+    "sand ball"
+  },
+  {
+    "bd_sand_loose",
+    "bd_sand_loose",
+    "sand (loose)"
+  },
+  {
+    "bd_sand_sloped_up_right",
+    "bd_sand_sloped",
+    "sand (sloped up right)"
+  },
+  {
+    "bd_sand_sloped_up_left",
+    "bd_sand_sloped",
+    "sand (sloped up left)"
+  },
+  {
+    "bd_sand_sloped_down_left",
+    "bd_sand_sloped",
+    "sand (sloped down left)"
+  },
+  {
+    "bd_sand_sloped_down_right",
+    "bd_sand_sloped",
+    "sand (sloped down right)"
+  },
+  {
+    "bd_sand_glued",
+    "bd_sand_glued",
+    "glued sand"
+  },
+  {
+    "bd_wall_sloped_up_right",
+    "bd_wall_sloped",
+    "wall (sloped up right)"
+  },
+  {
+    "bd_wall_sloped_up_left",
+    "bd_wall_sloped",
+    "wall (sloped up left)"
+  },
+  {
+    "bd_wall_sloped_down_left",
+    "bd_wall_sloped",
+    "wall (sloped down left)"
+  },
+  {
+    "bd_wall_sloped_down_right",
+    "bd_wall_sloped",
+    "wall (sloped down right)"
+  },
+  {
+    "bd_wall_non_sloped",
+    "bd_wall",
+    "wall (non sloped)"
+  },
+  {
+    "bd_wall_diggable",
+    "bd_wall",
+    "diggable wall"
+  },
+  {
+    "bd_wall_diamond",
+    "bd_wall",
+    "wall with diamond"
+  },
+  {
+    "bd_wall_key_1",
+    "bd_wall",
+    "wall with key 1"
+  },
+  {
+    "bd_wall_key_2",
+    "bd_wall",
+    "wall with key 2"
+  },
+  {
+    "bd_wall_key_3",
+    "bd_wall",
+    "wall with key 3"
+  },
+  {
+    "bd_falling_wall",
+    "bd_wall",
+    "falling wall"
+  },
+  {
+    "bd_steelwall",
+    "bd_steelwall",
+    "steel wall"
+  },
+  {
+    "bd_steelwall_sloped_up_right",
+    "bd_steelwall_sloped",
+    "steel wall (sloped up right)"
+  },
+  {
+    "bd_steelwall_sloped_up_left",
+    "bd_steelwall_sloped",
+    "steel wall (sloped up left)"
+  },
+  {
+    "bd_steelwall_sloped_down_left",
+    "bd_steelwall_sloped",
+    "steel wall (sloped down left)"
+  },
+  {
+    "bd_steelwall_sloped_down_right",
+    "bd_steelwall_sloped",
+    "steel wall (sloped down right)"
+  },
+  {
+    "bd_steelwall_explodable",
+    "bd_steelwall",
+    "explodable steel wall"
+  },
+  {
+    "bd_steelwall_diggable",
+    "bd_steelwall",
+    "diggable steel wall"
+  },
+  {
+    "bd_expandable_wall_horizontal",
+    "bd_expandable_wall",
+    "expandable wall (horizontal)"
+  },
+  {
+    "bd_expandable_wall_vertical",
+    "bd_expandable_wall",
+    "expandable wall (vertical)"
+  },
+  {
+    "bd_expandable_wall_any",
+    "bd_expandable_wall",
+    "expandable wall (any direction)"
+  },
+  {
+    "bd_expandable_steelwall_horizontal",
+    "bd_expandable_steelwall",
+    "expandable steelwall (horizontal)"
+  },
+  {
+    "bd_expandable_steelwall_vertical",
+    "bd_expandable_steelwall",
+    "expandable steelwall (vertical)"
+  },
+  {
+    "bd_expandable_steelwall_any",
+    "bd_expandable_steelwall",
+    "expandable steelwall (any direction)"
+  },
+  {
+    "bd_expandable_wall_switch_horizontal",
+    "bd_expandable_wall_switch",
+    "switch for expandable wall (horizontal)"
+  },
+  {
+    "bd_expandable_wall_switch_vertical",
+    "bd_expandable_wall_switch",
+    "switch for expandable wall (vertical)"
+  },
+  {
+    "bd_inbox",
+    "bd_inbox",
+    "inbox with player"
+  },
+  {
+    "bd_exit_closed",
+    "bd_exit",
+    "closed exit"
+  },
+  {
+    "bd_exit_open",
+    "bd_exit",
+    "open exit"
+  },
+  {
+    "bd_invisible_exit_closed",
+    "bd_invisible_exit",
+    "invisible exit (closed)"
+  },
+  {
+    "bd_invisible_exit_open",
+    "bd_invisible_exit",
+    "invisible exit (open)"
+  },
+  {
+    "bd_flying_rock",
+    "bd_flying_rock",
+    "flying rock"
+  },
+  {
+    "bd_mega_rock",
+    "bd_mega_rock",
+    "mega rock"
+  },
+  {
+    "bd_rock_glued",
+    "bd_rock_glued",
+    "glued rock"
+  },
+  {
+    "bd_flying_diamond",
+    "bd_flying_diamond",
+    "flying diamond"
+  },
+  {
+    "bd_diamond_glued",
+    "bd_diamond_glued",
+    "glued diamond"
+  },
+  {
+    "bd_diamond_key",
+    "bd_diamond_key",
+    "diamond key"
+  },
+  {
+    "bd_trapped_diamond",
+    "bd_trapped_diamond",
+    "trapped diamond"
+  },
+  {
+    "bd_nut",
+    "bd_nut",
+    "nut with diamond"
+  },
+  {
+    "bd_amoeba_2",
+    "bd_amoeba",
+    "amoeba 2 (BD style)"
+  },
+  {
+    "bd_bladder",
+    "bd_bladder",
+    "bladder"
+  },
+  {
+    "bd_bladder_spender",
+    "bd_bladder_spender",
+    "bladder spender"
+  },
+  {
+    "bd_creature_switch",
+    "bd_creature_switch",
+    "switch for creature (off)"
+  },
+  {
+    "bd_creature_switch.active",
+    "bd_creature_switch",
+    "switch for creature (on)"
+  },
+  {
+    "bd_biter_switch_1",
+    "bd_biter_switch",
+    "switch for biter"
+  },
+  {
+    "bd_biter_switch_2",
+    "bd_biter_switch",
+    "switch for biter"
+  },
+  {
+    "bd_biter_switch_3",
+    "bd_biter_switch",
+    "switch for biter"
+  },
+  {
+    "bd_biter_switch_4",
+    "bd_biter_switch",
+    "switch for biter"
+  },
+  {
+    "bd_replicator",
+    "bd_replicator",
+    "replicator"
+  },
+  {
+    "bd_replicator.active",
+    "bd_replicator",
+    "replicator (active)"
+  },
+  {
+    "bd_replicator_switch",
+    "bd_replicator_switch",
+    "switch for replicator (off)"
+  },
+  {
+    "bd_replicator_switch.active",
+    "bd_replicator_switch",
+    "switch for replicator (on)"
+  },
+  {
+    "bd_conveyor_left",
+    "bd_conveyor",
+    "conveyor belt (left)"
+  },
+  {
+    "bd_conveyor_left.active",
+    "bd_conveyor",
+    "conveyor belt (left) (active)"
+  },
+  {
+    "bd_conveyor_right",
+    "bd_conveyor",
+    "conveyor belt (right)"
+  },
+  {
+    "bd_conveyor_right.active",
+    "bd_conveyor",
+    "conveyor belt (right) (active)"
+  },
+  {
+    "bd_conveyor_switch",
+    "bd_conveyor_switch",
+    "switch for conveyor belt (off)"
+  },
+  {
+    "bd_conveyor_switch.active",
+    "bd_conveyor_switch",
+    "switch for conveyor belt (on)"
+  },
+  {
+    "bd_conveyor_dir_switch_left",
+    "bd_conveyor_dir_switch",
+    "switch for conveyor belt direction (left)"
+  },
+  {
+    "bd_conveyor_dir_switch_right",
+    "bd_conveyor_dir_switch",
+    "switch for conveyor belt direction (right)"
+  },
+  {
+    "bd_gravity_switch",
+    "bd_gravity_switch",
+    "gravity switch"
+  },
+  {
+    "bd_gravity_switch.active",
+    "bd_gravity_switch",
+    "gravity switch (active)"
+  },
+  {
+    "bd_acid",
+    "bd_acid",
+    "acid"
+  },
+  {
+    "bd_box",
+    "bd_box",
+    "box"
+  },
+  {
+    "bd_time_penalty",
+    "bd_time_penalty",
+    "time penalty"
+  },
+  {
+    "bd_gravestone",
+    "bd_gravestone",
+    "gravestone"
+  },
+  {
+    "bd_clock",
+    "bd_clock",
+    "clock"
+  },
+  {
+    "bd_pot",
+    "bd_pot",
+    "pot"
+  },
+  {
+    "bd_pneumatic_hammer",
+    "bd_pneumatic_hammer",
+    "pneumatic hammer"
+  },
+  {
+    "bd_teleporter",
+    "bd_teleporter",
+    "teleporter"
+  },
+  {
+    "bd_skeleton",
+    "bd_skeleton",
+    "skeleton"
+  },
+  {
+    "bd_water",
+    "bd_water",
+    "water"
+  },
+  {
+    "bd_key_1",
+    "bd_key",
+    "key 1"
+    },
+  {
+    "bd_key_2",
+    "bd_key",
+    "key 2"
+    },
+  {
+    "bd_key_3",
+    "bd_key",
+    "key 3"
+  },
+  {
+    "bd_gate_1",
+    "bd_gate",
+    "door 1"
+  },
+  {
+    "bd_gate_2",
+    "bd_gate",
+    "door 2"
+  },
+  {
+    "bd_gate_3",
+    "bd_gate",
+    "door 3"
+  },
+  {
+    "bd_lava",
+    "bd_lava",
+    "lava"
+  },
+  {
+    "bd_sweet",
+    "bd_sweet",
+    "sweet"
+  },
+  {
+    "bd_voodoo_doll",
+    "bd_voodoo_doll",
+    "voodoo doll"
+  },
+  {
+    "bd_slime",
+    "bd_slime",
+    "slime"
+  },
+  {
+    "bd_waiting_rock",
+    "bd_waiting_rock",
+    "waiting rock"
+  },
+  {
+    "bd_chasing_rock",
+    "bd_chasing_rock",
+    "chasing rock"
+  },
+  {
+    "bd_ghost",
+    "bd_ghost",
+    "ghost"
+  },
+  {
+    "bd_cow",
+    "bd_cow",
+    "cow (random start direction)"
+  },
+  {
+    "bd_cow.left",
+    "bd_cow",
+    "cow (starts moving left)"
+  },
+  {
+    "bd_cow.up",
+    "bd_cow",
+    "cow (starts moving up)"
+  },
+  {
+    "bd_cow.right",
+    "bd_cow",
+    "cow (starts moving right)"
+  },
+  {
+    "bd_cow.down",
+    "bd_cow",
+    "cow (starts moving down)"
+  },
+  {
+    "bd_butterfly_2",
+    "bd_butterfly",
+    "butterfly 2 (random start direction)"
+  },
+  {
+    "bd_butterfly_2.right",
+    "bd_butterfly",
+    "butterfly 2 (starts moving right)"
+  },
+  {
+    "bd_butterfly_2.up",
+    "bd_butterfly",
+    "butterfly 2 (starts moving up)"
+  },
+  {
+    "bd_butterfly_2.left",
+    "bd_butterfly",
+    "butterfly 2 (starts moving left)"
+  },
+  {
+    "bd_butterfly_2.down",
+    "bd_butterfly",
+    "butterfly 2 (starts moving down)"
+  },
+  {
+    "bd_firefly_2",
+    "bd_firefly",
+    "firefly 2 (random start direction)"
+  },
+  {
+    "bd_firefly_2.right",
+    "bd_firefly",
+    "firefly 2 (starts moving right)"
+  },
+  {
+    "bd_firefly_2.up",
+    "bd_firefly",
+    "firefly 2 (starts moving up)"
+  },
+  {
+    "bd_firefly_2.left",
+    "bd_firefly",
+    "firefly 2 (starts moving left)"
+  },
+  {
+    "bd_firefly_2.down",
+    "bd_firefly",
+    "firefly 2 (starts moving down)"
+  },
+  {
+    "bd_stonefly",
+    "bd_stonefly",
+    "stonefly (random start direction)"
+  },
+  {
+    "bd_stonefly.right",
+    "bd_stonefly",
+    "stonefly (starts moving right)"
+  },
+  {
+    "bd_stonefly.up",
+    "bd_stonefly",
+    "stonefly (starts moving up)"
+  },
+  {
+    "bd_stonefly.left",
+    "bd_stonefly",
+    "stonefly (starts moving left)"
+  },
+  {
+    "bd_stonefly.down",
+    "bd_stonefly",
+    "stonefly (starts moving down)"
+  },
+  {
+    "bd_biter",
+    "bd_biter",
+    "biter (random start direction)"
+  },
+  {
+    "bd_biter.right",
+    "bd_biter",
+    "biter (starts moving right)"
+  },
+  {
+    "bd_biter.up",
+    "bd_biter",
+    "biter (starts moving up)"
+  },
+  {
+    "bd_biter.left",
+    "bd_biter",
+    "biter (starts moving left)"
+  },
+  {
+    "bd_biter.down",
+    "bd_biter",
+    "biter (starts moving down)"
+  },
+  {
+    "bd_dragonfly",
+    "bd_dragonfly",
+    "dragonfly (random start direction)"
+  },
+  {
+    "bd_dragonfly.right",
+    "bd_dragonfly",
+    "dragonfly (starts moving right)"
+  },
+  {
+    "bd_dragonfly.up",
+    "bd_dragonfly",
+    "dragonfly (starts moving up)"
+  },
+  {
+    "bd_dragonfly.left",
+    "bd_dragonfly",
+    "dragonfly (starts moving left)"
+  },
+  {
+    "bd_dragonfly.down",
+    "bd_dragonfly",
+    "dragonfly (starts moving down)"
+  },
+  {
+    "bd_bomb",
+    "bd_bomb",
+    "bomb"
+  },
+  {
+    "bd_nitro_pack",
+    "bd_nitro_pack",
+    "nitro pack"
+  },
+  {
+    "bd_player",
+    "bd_player",
+    "player"
+  },
+  {
+    "bd_player_with_bomb",
+    "bd_player",
+    "player with bomb",
+  },
+  {
+    "bd_player_glued",
+    "bd_player",
+    "glued player",
+  },
+  {
+    "bd_player_stirring",
+    "bd_player",
+    "stirring player"
+  },
+  {
+    "bd_fake_bonus",
+    "bd_fake_bonus",
+    "fake bonus"
+  },
+  {
+    "bd_covered",
+    "bd_covered",
+    "covered"
+  },
 
   // --------------------------------------------------------------------------
   // "real" (and therefore drawable) runtime elements
@@ -6737,6 +7503,11 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] =
     "mm_exit",
     "-"
   },
+  {
+    "mm_gray_ball.active",
+    "mm_gray_ball",
+    "-",
+  },
   {
     "mm_gray_ball.opening",
     "mm_gray_ball",
@@ -6772,6 +7543,16 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] =
     "mm_pacman",
     "pac man (eating down)"
   },
+  {
+    "mm_bomb.active",
+    "mm_bomb",
+    "active bomb (MM style)"
+  },
+  {
+    "df_mine.active",
+    "df_mine",
+    "active mine"
+  },
 
   // --------------------------------------------------------------------------
   // "unreal" (and therefore not drawable) runtime elements
@@ -7022,56 +7803,6 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] =
     "-",
     "-"
   },
-  {
-    "mm_mask_mcduffin.right",
-    "-",
-    "-"
-  },
-  {
-    "mm_mask_mcduffin.up",
-    "-",
-    "-"
-  },
-  {
-    "mm_mask_mcduffin.left",
-    "-",
-    "-"
-  },
-  {
-    "mm_mask_mcduffin.down",
-    "-",
-    "-"
-  },
-  {
-    "mm_mask_grid_1",
-    "-",
-    "-"
-  },
-  {
-    "mm_mask_grid_2",
-    "-",
-    "-"
-  },
-  {
-    "mm_mask_grid_3",
-    "-",
-    "-"
-  },
-  {
-    "mm_mask_grid_4",
-    "-",
-    "-"
-  },
-  {
-    "mm_mask_rectangle",
-    "-",
-    "-"
-  },
-  {
-    "mm_mask_circle",
-    "-",
-    "-"
-  },
   {
     "[default]",
     "default",
@@ -7137,6 +7868,11 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] =
     "graphic",
     "-"
   },
+  {
+    "bd_game_graphics_color_template",
+    "-",
+    "-"
+  },
   {
     "internal_clipboard_custom",
     "internal",
@@ -7167,6 +7903,16 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] =
     "internal",
     "hide Boulder Dash elements"
   },
+  {
+    "internal_cascade_bd_native",
+    "internal",
+    "show native Boulder Dash elements"
+  },
+  {
+    "internal_cascade_bd_native.active",
+    "internal",
+    "hide native Boulder Dash elements"
+  },
   {
     "internal_cascade_em",
     "internal",
@@ -7580,6 +8326,7 @@ struct FontInfo font_info[NUM_FONTS + 1] =
   { "font.envelope_2"          },
   { "font.envelope_3"          },
   { "font.envelope_4"          },
+  { "font.request_narrow"      },
   { "font.request"             },
   { "font.input_1.active"      },
   { "font.input_2.active"      },
@@ -7710,10 +8457,11 @@ static void print_usage(void)
        "\n"
        "Options:\n"
        "  -b, --basepath DIRECTORY         alternative base DIRECTORY\n"
-       "  -l, --level DIRECTORY            alternative level DIRECTORY\n"
+       "  -l, --levels DIRECTORY           alternative levels DIRECTORY\n"
        "  -g, --graphics DIRECTORY         alternative graphics DIRECTORY\n"
        "  -s, --sounds DIRECTORY           alternative sounds DIRECTORY\n"
        "  -m, --music DIRECTORY            alternative music DIRECTORY\n"
+       "      --display NR                 open program window on display NR\n"
        "      --mytapes                    use private tapes for tape tests\n"
        "  -n, --network                    network multiplayer game\n"
        "      --serveronly                 only start network server\n"
@@ -7796,33 +8544,13 @@ static void InitProgramConfig(char *command_filename)
   char *program_title = PROGRAM_TITLE_STRING;
   char *program_icon_file = PROGRAM_ICON_FILENAME;
   char *program_version = getProgramRealVersionString();
+  char *program_basename = getBaseNameNoSuffix(command_filename);
   char *config_filename = getProgramConfigFilename(command_filename);
-  char *userdata_basename = getBaseNameNoSuffix(command_filename);
   char *userdata_subdir;
-#if defined(PLATFORM_UNIX)
-  char *userdata_subdir_unix;
-#endif
 
   // read default program config, if existing
   if (fileExists(config_filename))
-  {
-    // if program config file exists, derive Unix user data directory from it
-    // (but only if the program config file is not generic "setup.conf" file)
-    if (!strEqual(getBaseNamePtr(config_filename), SETUP_FILENAME))
-    {
-      userdata_basename = getBaseName(config_filename);
-
-      if (strSuffix(userdata_basename, ".conf"))
-       userdata_basename[strlen(userdata_basename) - 5] = '\0';
-    }
-
     LoadSetupFromFilename(config_filename);
-  }
-
-#if defined(PLATFORM_UNIX)
-  // set user data directory for Linux/Unix (but not Mac OS X)
-  userdata_subdir_unix = getStringCat2(".", userdata_basename);
-#endif
 
   // set program title from potentially redefined program title
   if (setup.internal.program_title != NULL &&
@@ -7839,10 +8567,10 @@ static void InitProgramConfig(char *command_filename)
       strlen(setup.internal.program_icon_file) > 0)
     program_icon_file = getStringCopy(setup.internal.program_icon_file);
 
-#if defined(PLATFORM_WIN32) || defined(PLATFORM_MACOSX) || defined(PLATFORM_EMSCRIPTEN)
+#if defined(PLATFORM_WINDOWS) || defined(PLATFORM_MAC) || defined(PLATFORM_EMSCRIPTEN)
   userdata_subdir = program_title;
 #elif defined(PLATFORM_UNIX)
-  userdata_subdir = userdata_subdir_unix;
+  userdata_subdir = getStringCat2(".", program_basename);
 #else
   userdata_subdir = USERDATA_DIRECTORY_OTHER;
 #endif
@@ -7858,7 +8586,7 @@ static void InitProgramConfig(char *command_filename)
   InitProgramInfo(command_filename,
                  config_filename,
                  userdata_subdir,
-                 program_title,
+                 program_basename,
                  program_title,
                  program_icon_file,
                  COOKIE_PREFIX,