re-added file "RocksBusy.ilbm" (that was accidentally deleted)
[rocksndiamonds.git] / src / editor.c
index 64192d85442df06acc93673ac38813d2452ab0de..7ba41621be34cda75b0e381688d46c4ec284def9 100644 (file)
@@ -3749,7 +3749,6 @@ static void AdjustElementListScrollbar();
 static void RedrawDrawingElements();
 static void DrawDrawingWindowExt(boolean);
 static void DrawDrawingWindow();
-static void DrawDrawingWindow_PlayfieldOnly();
 static void DrawLevelInfoWindow();
 static void DrawPropertiesWindow();
 static void DrawPaletteWindow();
@@ -3807,7 +3806,7 @@ static int editor_el_players[] =
   EL_PLAYER_4
 };
 static int *editor_el_players_ptr = editor_el_players;
-static int num_editor_el_players = SIZEOF_ARRAY_INT(editor_el_players);
+static int num_editor_el_players = ARRAY_SIZE(editor_el_players);
 
 static int editor_hl_boulderdash[] =
 {
@@ -3846,8 +3845,8 @@ static int editor_el_boulderdash[] =
 };
 static int *editor_hl_boulderdash_ptr = editor_hl_boulderdash;
 static int *editor_el_boulderdash_ptr = editor_el_boulderdash;
-static int num_editor_hl_boulderdash = SIZEOF_ARRAY_INT(editor_hl_boulderdash);
-static int num_editor_el_boulderdash = SIZEOF_ARRAY_INT(editor_el_boulderdash);
+static int num_editor_hl_boulderdash = ARRAY_SIZE(editor_hl_boulderdash);
+static int num_editor_el_boulderdash = ARRAY_SIZE(editor_el_boulderdash);
 
 static int editor_hl_emerald_mine[] =
 {
@@ -3921,8 +3920,8 @@ static int editor_el_emerald_mine[] =
 };
 static int *editor_hl_emerald_mine_ptr = editor_hl_emerald_mine;
 static int *editor_el_emerald_mine_ptr = editor_el_emerald_mine;
-static int num_editor_hl_emerald_mine=SIZEOF_ARRAY_INT(editor_hl_emerald_mine);
-static int num_editor_el_emerald_mine=SIZEOF_ARRAY_INT(editor_el_emerald_mine);
+static int num_editor_hl_emerald_mine = ARRAY_SIZE(editor_hl_emerald_mine);
+static int num_editor_el_emerald_mine = ARRAY_SIZE(editor_el_emerald_mine);
 
 static int editor_hl_emerald_mine_club[] =
 {
@@ -4011,8 +4010,8 @@ static int editor_el_emerald_mine_club[] =
 };
 static int *editor_hl_emerald_mine_club_ptr = editor_hl_emerald_mine_club;
 static int *editor_el_emerald_mine_club_ptr = editor_el_emerald_mine_club;
-static int num_editor_hl_emerald_mine_club=SIZEOF_ARRAY_INT(editor_hl_emerald_mine_club);
-static int num_editor_el_emerald_mine_club=SIZEOF_ARRAY_INT(editor_el_emerald_mine_club);
+static int num_editor_hl_emerald_mine_club = ARRAY_SIZE(editor_hl_emerald_mine_club);
+static int num_editor_el_emerald_mine_club = ARRAY_SIZE(editor_el_emerald_mine_club);
 
 static int editor_hl_rnd[] =
 {
@@ -4111,8 +4110,8 @@ static int editor_el_rnd[] =
 };
 static int *editor_hl_rnd_ptr = editor_hl_rnd;
 static int *editor_el_rnd_ptr = editor_el_rnd;
-static int num_editor_hl_rnd = SIZEOF_ARRAY_INT(editor_hl_rnd);
-static int num_editor_el_rnd = SIZEOF_ARRAY_INT(editor_el_rnd);
+static int num_editor_hl_rnd = ARRAY_SIZE(editor_hl_rnd);
+static int num_editor_el_rnd = ARRAY_SIZE(editor_el_rnd);
 
 static int editor_hl_sokoban[] =
 {
@@ -4131,8 +4130,8 @@ static int editor_el_sokoban[] =
 };
 static int *editor_hl_sokoban_ptr = editor_hl_sokoban;
 static int *editor_el_sokoban_ptr = editor_el_sokoban;
-static int num_editor_hl_sokoban = SIZEOF_ARRAY_INT(editor_hl_sokoban);
-static int num_editor_el_sokoban = SIZEOF_ARRAY_INT(editor_el_sokoban);
+static int num_editor_hl_sokoban = ARRAY_SIZE(editor_hl_sokoban);
+static int num_editor_el_sokoban = ARRAY_SIZE(editor_el_sokoban);
 
 static int editor_hl_supaplex[] =
 {
@@ -4206,8 +4205,8 @@ static int editor_el_supaplex[] =
 };
 static int *editor_hl_supaplex_ptr = editor_hl_supaplex;
 static int *editor_el_supaplex_ptr = editor_el_supaplex;
-static int num_editor_hl_supaplex = SIZEOF_ARRAY_INT(editor_hl_supaplex);
-static int num_editor_el_supaplex = SIZEOF_ARRAY_INT(editor_el_supaplex);
+static int num_editor_hl_supaplex = ARRAY_SIZE(editor_hl_supaplex);
+static int num_editor_el_supaplex = ARRAY_SIZE(editor_el_supaplex);
 
 static int editor_hl_diamond_caves[] =
 {
@@ -4368,8 +4367,8 @@ static int editor_el_diamond_caves[] =
 };
 static int *editor_hl_diamond_caves_ptr = editor_hl_diamond_caves;
 static int *editor_el_diamond_caves_ptr = editor_el_diamond_caves;
-static int num_editor_hl_diamond_caves = SIZEOF_ARRAY_INT(editor_hl_diamond_caves);
-static int num_editor_el_diamond_caves = SIZEOF_ARRAY_INT(editor_el_diamond_caves);
+static int num_editor_hl_diamond_caves = ARRAY_SIZE(editor_hl_diamond_caves);
+static int num_editor_el_diamond_caves = ARRAY_SIZE(editor_el_diamond_caves);
 
 static int editor_hl_dx_boulderdash[] =
 {
@@ -4403,8 +4402,8 @@ static int editor_el_dx_boulderdash[] =
 };
 static int *editor_hl_dx_boulderdash_ptr = editor_hl_dx_boulderdash;
 static int *editor_el_dx_boulderdash_ptr = editor_el_dx_boulderdash;
-static int num_editor_hl_dx_boulderdash = SIZEOF_ARRAY_INT(editor_hl_dx_boulderdash);
-static int num_editor_el_dx_boulderdash = SIZEOF_ARRAY_INT(editor_el_dx_boulderdash);
+static int num_editor_hl_dx_boulderdash = ARRAY_SIZE(editor_hl_dx_boulderdash);
+static int num_editor_el_dx_boulderdash = ARRAY_SIZE(editor_el_dx_boulderdash);
 
 static int editor_hl_mirror_magic[] =
 {
@@ -4423,13 +4422,13 @@ static int editor_el_mirror_magic[] =
 
   EL_MM_MIRROR_START,
   EL_MM_MIRROR_FIXED_START,
-  EL_MM_POLARISATOR_START,
-  EL_MM_POLARISATOR_CROSS_START,
+  EL_MM_POLARIZER_START,
+  EL_MM_POLARIZER_CROSS_START,
 
-  EL_MM_BEAMER_RED_START,
-  EL_MM_BEAMER_YELLOW_START,
-  EL_MM_BEAMER_GREEN_START,
-  EL_MM_BEAMER_BLUE_START,
+  EL_MM_TELEPORTER_RED_START,
+  EL_MM_TELEPORTER_YELLOW_START,
+  EL_MM_TELEPORTER_GREEN_START,
+  EL_MM_TELEPORTER_BLUE_START,
 
   EL_MM_PRISM,
   EL_MM_FUSE_ACTIVE,
@@ -4468,8 +4467,8 @@ static int editor_el_mirror_magic[] =
 };
 static int *editor_hl_mirror_magic_ptr = editor_hl_mirror_magic;
 static int *editor_el_mirror_magic_ptr = editor_el_mirror_magic;
-static int num_editor_hl_mirror_magic = SIZEOF_ARRAY_INT(editor_hl_mirror_magic);
-static int num_editor_el_mirror_magic = SIZEOF_ARRAY_INT(editor_el_mirror_magic);
+static int num_editor_hl_mirror_magic = ARRAY_SIZE(editor_hl_mirror_magic);
+static int num_editor_el_mirror_magic = ARRAY_SIZE(editor_el_mirror_magic);
 
 static int editor_hl_deflektor[] =
 {
@@ -4513,8 +4512,8 @@ static int editor_el_deflektor[] =
 };
 static int *editor_hl_deflektor_ptr = editor_hl_deflektor;
 static int *editor_el_deflektor_ptr = editor_el_deflektor;
-static int num_editor_hl_deflektor = SIZEOF_ARRAY_INT(editor_hl_deflektor);
-static int num_editor_el_deflektor = SIZEOF_ARRAY_INT(editor_el_deflektor);
+static int num_editor_hl_deflektor = ARRAY_SIZE(editor_hl_deflektor);
+static int num_editor_el_deflektor = ARRAY_SIZE(editor_el_deflektor);
 
 static int editor_hl_chars[] =
 {
@@ -4623,8 +4622,8 @@ static int editor_el_chars[] =
 };
 static int *editor_hl_chars_ptr = editor_hl_chars;
 static int *editor_el_chars_ptr = editor_el_chars;
-static int num_editor_hl_chars = SIZEOF_ARRAY_INT(editor_hl_chars);
-static int num_editor_el_chars = SIZEOF_ARRAY_INT(editor_el_chars);
+static int num_editor_hl_chars = ARRAY_SIZE(editor_hl_chars);
+static int num_editor_el_chars = ARRAY_SIZE(editor_el_chars);
 
 static int editor_hl_steel_chars[] =
 {
@@ -4733,8 +4732,8 @@ static int editor_el_steel_chars[] =
 };
 static int *editor_hl_steel_chars_ptr = editor_hl_steel_chars;
 static int *editor_el_steel_chars_ptr = editor_el_steel_chars;
-static int num_editor_hl_steel_chars = SIZEOF_ARRAY_INT(editor_hl_steel_chars);
-static int num_editor_el_steel_chars = SIZEOF_ARRAY_INT(editor_el_steel_chars);
+static int num_editor_hl_steel_chars = ARRAY_SIZE(editor_hl_steel_chars);
+static int num_editor_el_steel_chars = ARRAY_SIZE(editor_el_steel_chars);
 
 static int editor_hl_custom[] =
 {
@@ -5068,8 +5067,8 @@ static int editor_el_custom[] =
 };
 static int *editor_hl_custom_ptr = editor_hl_custom;
 static int *editor_el_custom_ptr = editor_el_custom;
-static int num_editor_hl_custom = SIZEOF_ARRAY_INT(editor_hl_custom);
-static int num_editor_el_custom = SIZEOF_ARRAY_INT(editor_el_custom);
+static int num_editor_hl_custom = ARRAY_SIZE(editor_hl_custom);
+static int num_editor_el_custom = ARRAY_SIZE(editor_el_custom);
 
 static int editor_hl_group[] =
 {
@@ -5123,8 +5122,8 @@ static int editor_el_group[] =
 };
 static int *editor_hl_group_ptr = editor_hl_group;
 static int *editor_el_group_ptr = editor_el_group;
-static int num_editor_hl_group = SIZEOF_ARRAY_INT(editor_hl_group);
-static int num_editor_el_group = SIZEOF_ARRAY_INT(editor_el_group);
+static int num_editor_hl_group = ARRAY_SIZE(editor_hl_group);
+static int num_editor_el_group = ARRAY_SIZE(editor_el_group);
 
 static int editor_hl_reference[] =
 {
@@ -5168,8 +5167,8 @@ static int editor_el_reference[] =
 };
 static int *editor_hl_reference_ptr = editor_hl_reference;
 static int *editor_el_reference_ptr = editor_el_reference;
-static int num_editor_hl_reference = SIZEOF_ARRAY_INT(editor_hl_reference);
-static int num_editor_el_reference = SIZEOF_ARRAY_INT(editor_el_reference);
+static int num_editor_hl_reference = ARRAY_SIZE(editor_hl_reference);
+static int num_editor_el_reference = ARRAY_SIZE(editor_el_reference);
 
 static int editor_hl_user_defined[] =
 {
@@ -5181,7 +5180,7 @@ static int editor_hl_user_defined[] =
 
 static int *editor_hl_user_defined_ptr = editor_hl_user_defined;
 static int *editor_el_user_defined_ptr = NULL;
-static int num_editor_hl_user_defined=SIZEOF_ARRAY_INT(editor_hl_user_defined);
+static int num_editor_hl_user_defined = ARRAY_SIZE(editor_hl_user_defined);
 static int num_editor_el_user_defined = 0;
 
 static int editor_hl_dynamic[] =
@@ -5194,7 +5193,7 @@ static int editor_hl_dynamic[] =
 
 static int *editor_hl_dynamic_ptr = editor_hl_dynamic;
 static int *editor_el_dynamic_ptr = NULL;
-static int num_editor_hl_dynamic = SIZEOF_ARRAY_INT(editor_hl_dynamic);
+static int num_editor_hl_dynamic = ARRAY_SIZE(editor_hl_dynamic);
 static int num_editor_el_dynamic = 0;
 
 static int editor_hl_empty[] = { EL_EMPTY };
@@ -6125,6 +6124,7 @@ static void CreateControlButtons()
 
     gi = CreateGadget(GDI_CUSTOM_ID, id,
                      GDI_CUSTOM_TYPE_ID, i,
+                     GDI_IMAGE_ID, graphic,
                      GDI_INFO_TEXT, controlbutton_info[i].infotext,
                      GDI_X, x,
                      GDI_Y, y,
@@ -6199,6 +6199,7 @@ static void CreateControlButtons()
 
     gi = CreateGadget(GDI_CUSTOM_ID, id,
                      GDI_CUSTOM_TYPE_ID, i,
+                     GDI_IMAGE_ID, graphic,
                      GDI_INFO_TEXT, scrollbutton_info[i].infotext,
                      GDI_X, x,
                      GDI_Y, y,
@@ -6247,6 +6248,7 @@ static void CreateControlButtons()
 
     gi = CreateGadget(GDI_CUSTOM_ID, id,
                      GDI_CUSTOM_TYPE_ID, i,
+                     GDI_IMAGE_ID, graphic,
                      GDI_INFO_TEXT, getElementInfoText(element),
                      GDI_X, x,
                      GDI_Y, y,
@@ -6344,6 +6346,7 @@ static void CreateCounterButtons()
 
       gi = CreateGadget(GDI_CUSTOM_ID, id,
                        GDI_CUSTOM_TYPE_ID, i,
+                       GDI_IMAGE_ID, graphic,
                        GDI_INFO_TEXT, infotext,
                        GDI_X, x,
                        GDI_Y, y,
@@ -6400,6 +6403,7 @@ static void CreateCounterButtons()
 
        gi = CreateGadget(GDI_CUSTOM_ID, id,
                          GDI_CUSTOM_TYPE_ID, i,
+                         GDI_IMAGE_ID, graphic,
                          GDI_INFO_TEXT, "enter counter value",
                          GDI_X, x,
                          GDI_Y, y,
@@ -6742,6 +6746,7 @@ static void CreateTextbuttonGadgets()
 
     gi = CreateGadget(GDI_CUSTOM_ID, id,
                      GDI_CUSTOM_TYPE_ID, i,
+                     GDI_IMAGE_ID, graphic,
                      GDI_INFO_TEXT, infotext,
                      GDI_X, x,
                      GDI_Y, y,
@@ -6782,7 +6787,8 @@ static void CreateGraphicbuttonGadgets()
     int id = graphicbutton_info[i].gadget_id;
     int x = SX + ED_SETTINGS_X(graphicbutton_info[i].x);
     int y = SY + ED_SETTINGS_Y(graphicbutton_info[i].y);
-    struct GraphicInfo *gd = &graphic_info[graphicbutton_info[i].graphic];
+    int graphic = graphicbutton_info[i].graphic;
+    struct GraphicInfo *gd = &graphic_info[graphic];
     int gd_x1 = gd->src_x;
     int gd_y1 = gd->src_y;
     int gd_x2 = gd->src_x + gd->pressed_xoffset;
@@ -6801,6 +6807,7 @@ static void CreateGraphicbuttonGadgets()
 
     gi = CreateGadget(GDI_CUSTOM_ID, id,
                      GDI_CUSTOM_TYPE_ID, i,
+                     GDI_IMAGE_ID, graphic,
                      GDI_INFO_TEXT, graphicbutton_info[i].infotext,
                      GDI_X, x,
                      GDI_Y, y,
@@ -6907,6 +6914,7 @@ static void CreateScrollbarGadgets()
 
     gi = CreateGadget(GDI_CUSTOM_ID, id,
                      GDI_CUSTOM_TYPE_ID, i,
+                     GDI_IMAGE_ID, graphic,
                      GDI_INFO_TEXT, scrollbar_info[i].infotext,
                      GDI_X, scrollbar_pos[i].x,
                      GDI_Y, scrollbar_pos[i].y,
@@ -6972,6 +6980,7 @@ static void CreateCheckbuttonGadgets()
 
     gi = CreateGadget(GDI_CUSTOM_ID, id,
                      GDI_CUSTOM_TYPE_ID, i,
+                     GDI_IMAGE_ID, graphic,
                      GDI_INFO_TEXT, checkbutton_info[i].infotext,
                      GDI_X, x,
                      GDI_Y, y,
@@ -6999,7 +7008,8 @@ static void CreateCheckbuttonGadgets()
 
 static void CreateRadiobuttonGadgets()
 {
-  struct GraphicInfo *gd = &graphic_info[IMG_EDITOR_RADIOBUTTON];
+  int graphic = IMG_EDITOR_RADIOBUTTON;
+  struct GraphicInfo *gd = &graphic_info[graphic];
   int gd_x1 = gd->src_x;
   int gd_y1 = gd->src_y;
   int gd_x2 = gd->src_x + gd->pressed_xoffset;
@@ -7034,6 +7044,7 @@ static void CreateRadiobuttonGadgets()
 
     gi = CreateGadget(GDI_CUSTOM_ID, id,
                      GDI_CUSTOM_TYPE_ID, i,
+                     GDI_IMAGE_ID, graphic,
                      GDI_INFO_TEXT, radiobutton_info[i].infotext,
                      GDI_X, x,
                      GDI_Y, y,
@@ -7564,10 +7575,13 @@ static void ResetUndoBuffer()
   level.changed = FALSE;
 }
 
-static void DrawEditModeWindow()
+static void DrawEditModeWindowExt(boolean remap_toolbox_gadgets)
 {
-  ModifyEditorElementList();
-  RedrawDrawingElements();
+  if (remap_toolbox_gadgets)
+  {
+    ModifyEditorElementList();
+    RedrawDrawingElements();
+  }
 
   if (edit_mode == ED_MODE_INFO)
     DrawLevelInfoWindow();
@@ -7576,7 +7590,17 @@ static void DrawEditModeWindow()
   else if (edit_mode == ED_MODE_PALETTE)
     DrawPaletteWindow();
   else /* edit_mode == ED_MODE_DRAWING */
-    DrawDrawingWindow();
+    DrawDrawingWindowExt(remap_toolbox_gadgets);
+}
+
+static void DrawEditModeWindow()
+{
+  DrawEditModeWindowExt(TRUE);
+}
+
+static void DrawEditModeWindow_PlayfieldOnly()
+{
+  DrawEditModeWindowExt(FALSE);
 }
 
 static void ChangeEditModeWindow(int new_edit_mode)
@@ -8307,7 +8331,9 @@ static int getMaxEdFieldY(boolean has_scrollbar)
 
 void InitZoomLevelSettings(int zoom_tilesize)
 {
-  if (zoom_tilesize == -1)
+  static int last_game_engine_type = GAME_ENGINE_TYPE_UNKNOWN;
+
+  if (zoom_tilesize == -1 && level.game_engine_type != last_game_engine_type)
   {
     ed_tilesize = setup.auto_setup.editor_zoom_tilesize;
     ed_tilesize_default = DEFAULT_EDITOR_TILESIZE;
@@ -8319,6 +8345,8 @@ void InitZoomLevelSettings(int zoom_tilesize)
     }
   }
 
+  last_game_engine_type = level.game_engine_type;
+
   // limit zoom tilesize by upper and lower bound
   ed_tilesize = MIN(MAX(MICRO_TILESIZE, ed_tilesize), TILESIZE);
 
@@ -8501,7 +8529,7 @@ void DrawLevelEd()
 
   UnmapAllGadgets();
 
-  DrawDrawingWindow_PlayfieldOnly();
+  DrawEditModeWindow_PlayfieldOnly();
 
   DrawMaskedBorder(fade_mask);
 
@@ -8848,11 +8876,6 @@ static void DrawDrawingWindow()
   DrawDrawingWindowExt(TRUE);
 }
 
-static void DrawDrawingWindow_PlayfieldOnly()
-{
-  DrawDrawingWindowExt(FALSE);
-}
-
 static int getTabulatorBarWidth()
 {
   struct GadgetInfo *gd_gi1 = level_editor_gadget[GADGET_ID_PROPERTIES_INFO];
@@ -11190,10 +11213,10 @@ static void SetElementIntelliDraw(int x, int y, int new_element,
        EL_MM_WOODEN_GRID_FIXED_3
       },
       {
-       EL_MM_POLARISATOR_CROSS_1,
-       EL_MM_POLARISATOR_CROSS_4,
-       EL_MM_POLARISATOR_CROSS_3,
-       EL_MM_POLARISATOR_CROSS_2
+       EL_MM_POLARIZER_CROSS_1,
+       EL_MM_POLARIZER_CROSS_4,
+       EL_MM_POLARIZER_CROSS_3,
+       EL_MM_POLARIZER_CROSS_2
       },
       {
        EL_MM_PACMAN_UP,
@@ -11286,112 +11309,112 @@ static void SetElementIntelliDraw(int x, int y, int new_element,
        EL_MM_MIRROR_2
       },
       {
-       EL_MM_BEAMER_5,
-       EL_MM_BEAMER_4,
-       EL_MM_BEAMER_3,
-       EL_MM_BEAMER_2,
-       EL_MM_BEAMER_1,
-       EL_MM_BEAMER_16,
-       EL_MM_BEAMER_15,
-       EL_MM_BEAMER_14,
-       EL_MM_BEAMER_13,
-       EL_MM_BEAMER_12,
-       EL_MM_BEAMER_11,
-       EL_MM_BEAMER_10,
-       EL_MM_BEAMER_9,
-       EL_MM_BEAMER_8,
-       EL_MM_BEAMER_7,
-       EL_MM_BEAMER_6
+       EL_MM_TELEPORTER_5,
+       EL_MM_TELEPORTER_4,
+       EL_MM_TELEPORTER_3,
+       EL_MM_TELEPORTER_2,
+       EL_MM_TELEPORTER_1,
+       EL_MM_TELEPORTER_16,
+       EL_MM_TELEPORTER_15,
+       EL_MM_TELEPORTER_14,
+       EL_MM_TELEPORTER_13,
+       EL_MM_TELEPORTER_12,
+       EL_MM_TELEPORTER_11,
+       EL_MM_TELEPORTER_10,
+       EL_MM_TELEPORTER_9,
+       EL_MM_TELEPORTER_8,
+       EL_MM_TELEPORTER_7,
+       EL_MM_TELEPORTER_6
       },
       {
-       EL_MM_BEAMER_RED_5,
-       EL_MM_BEAMER_RED_4,
-       EL_MM_BEAMER_RED_3,
-       EL_MM_BEAMER_RED_2,
-       EL_MM_BEAMER_RED_1,
-       EL_MM_BEAMER_RED_16,
-       EL_MM_BEAMER_RED_15,
-       EL_MM_BEAMER_RED_14,
-       EL_MM_BEAMER_RED_13,
-       EL_MM_BEAMER_RED_12,
-       EL_MM_BEAMER_RED_11,
-       EL_MM_BEAMER_RED_10,
-       EL_MM_BEAMER_RED_9,
-       EL_MM_BEAMER_RED_8,
-       EL_MM_BEAMER_RED_7,
-       EL_MM_BEAMER_RED_6
+       EL_MM_TELEPORTER_RED_5,
+       EL_MM_TELEPORTER_RED_4,
+       EL_MM_TELEPORTER_RED_3,
+       EL_MM_TELEPORTER_RED_2,
+       EL_MM_TELEPORTER_RED_1,
+       EL_MM_TELEPORTER_RED_16,
+       EL_MM_TELEPORTER_RED_15,
+       EL_MM_TELEPORTER_RED_14,
+       EL_MM_TELEPORTER_RED_13,
+       EL_MM_TELEPORTER_RED_12,
+       EL_MM_TELEPORTER_RED_11,
+       EL_MM_TELEPORTER_RED_10,
+       EL_MM_TELEPORTER_RED_9,
+       EL_MM_TELEPORTER_RED_8,
+       EL_MM_TELEPORTER_RED_7,
+       EL_MM_TELEPORTER_RED_6
       },
       {
-       EL_MM_BEAMER_YELLOW_5,
-       EL_MM_BEAMER_YELLOW_4,
-       EL_MM_BEAMER_YELLOW_3,
-       EL_MM_BEAMER_YELLOW_2,
-       EL_MM_BEAMER_YELLOW_1,
-       EL_MM_BEAMER_YELLOW_16,
-       EL_MM_BEAMER_YELLOW_15,
-       EL_MM_BEAMER_YELLOW_14,
-       EL_MM_BEAMER_YELLOW_13,
-       EL_MM_BEAMER_YELLOW_12,
-       EL_MM_BEAMER_YELLOW_11,
-       EL_MM_BEAMER_YELLOW_10,
-       EL_MM_BEAMER_YELLOW_9,
-       EL_MM_BEAMER_YELLOW_8,
-       EL_MM_BEAMER_YELLOW_7,
-       EL_MM_BEAMER_YELLOW_6
+       EL_MM_TELEPORTER_YELLOW_5,
+       EL_MM_TELEPORTER_YELLOW_4,
+       EL_MM_TELEPORTER_YELLOW_3,
+       EL_MM_TELEPORTER_YELLOW_2,
+       EL_MM_TELEPORTER_YELLOW_1,
+       EL_MM_TELEPORTER_YELLOW_16,
+       EL_MM_TELEPORTER_YELLOW_15,
+       EL_MM_TELEPORTER_YELLOW_14,
+       EL_MM_TELEPORTER_YELLOW_13,
+       EL_MM_TELEPORTER_YELLOW_12,
+       EL_MM_TELEPORTER_YELLOW_11,
+       EL_MM_TELEPORTER_YELLOW_10,
+       EL_MM_TELEPORTER_YELLOW_9,
+       EL_MM_TELEPORTER_YELLOW_8,
+       EL_MM_TELEPORTER_YELLOW_7,
+       EL_MM_TELEPORTER_YELLOW_6
       },
       {
-       EL_MM_BEAMER_GREEN_5,
-       EL_MM_BEAMER_GREEN_4,
-       EL_MM_BEAMER_GREEN_3,
-       EL_MM_BEAMER_GREEN_2,
-       EL_MM_BEAMER_GREEN_1,
-       EL_MM_BEAMER_GREEN_16,
-       EL_MM_BEAMER_GREEN_15,
-       EL_MM_BEAMER_GREEN_14,
-       EL_MM_BEAMER_GREEN_13,
-       EL_MM_BEAMER_GREEN_12,
-       EL_MM_BEAMER_GREEN_11,
-       EL_MM_BEAMER_GREEN_10,
-       EL_MM_BEAMER_GREEN_9,
-       EL_MM_BEAMER_GREEN_8,
-       EL_MM_BEAMER_GREEN_7,
-       EL_MM_BEAMER_GREEN_6
+       EL_MM_TELEPORTER_GREEN_5,
+       EL_MM_TELEPORTER_GREEN_4,
+       EL_MM_TELEPORTER_GREEN_3,
+       EL_MM_TELEPORTER_GREEN_2,
+       EL_MM_TELEPORTER_GREEN_1,
+       EL_MM_TELEPORTER_GREEN_16,
+       EL_MM_TELEPORTER_GREEN_15,
+       EL_MM_TELEPORTER_GREEN_14,
+       EL_MM_TELEPORTER_GREEN_13,
+       EL_MM_TELEPORTER_GREEN_12,
+       EL_MM_TELEPORTER_GREEN_11,
+       EL_MM_TELEPORTER_GREEN_10,
+       EL_MM_TELEPORTER_GREEN_9,
+       EL_MM_TELEPORTER_GREEN_8,
+       EL_MM_TELEPORTER_GREEN_7,
+       EL_MM_TELEPORTER_GREEN_6
       },
       {
-       EL_MM_BEAMER_BLUE_5,
-       EL_MM_BEAMER_BLUE_4,
-       EL_MM_BEAMER_BLUE_3,
-       EL_MM_BEAMER_BLUE_2,
-       EL_MM_BEAMER_BLUE_1,
-       EL_MM_BEAMER_BLUE_16,
-       EL_MM_BEAMER_BLUE_15,
-       EL_MM_BEAMER_BLUE_14,
-       EL_MM_BEAMER_BLUE_13,
-       EL_MM_BEAMER_BLUE_12,
-       EL_MM_BEAMER_BLUE_11,
-       EL_MM_BEAMER_BLUE_10,
-       EL_MM_BEAMER_BLUE_9,
-       EL_MM_BEAMER_BLUE_8,
-       EL_MM_BEAMER_BLUE_7,
-       EL_MM_BEAMER_BLUE_6
+       EL_MM_TELEPORTER_BLUE_5,
+       EL_MM_TELEPORTER_BLUE_4,
+       EL_MM_TELEPORTER_BLUE_3,
+       EL_MM_TELEPORTER_BLUE_2,
+       EL_MM_TELEPORTER_BLUE_1,
+       EL_MM_TELEPORTER_BLUE_16,
+       EL_MM_TELEPORTER_BLUE_15,
+       EL_MM_TELEPORTER_BLUE_14,
+       EL_MM_TELEPORTER_BLUE_13,
+       EL_MM_TELEPORTER_BLUE_12,
+       EL_MM_TELEPORTER_BLUE_11,
+       EL_MM_TELEPORTER_BLUE_10,
+       EL_MM_TELEPORTER_BLUE_9,
+       EL_MM_TELEPORTER_BLUE_8,
+       EL_MM_TELEPORTER_BLUE_7,
+       EL_MM_TELEPORTER_BLUE_6
       },
       {
-       EL_MM_POLARISATOR_1,
-       EL_MM_POLARISATOR_16,
-       EL_MM_POLARISATOR_15,
-       EL_MM_POLARISATOR_14,
-       EL_MM_POLARISATOR_13,
-       EL_MM_POLARISATOR_12,
-       EL_MM_POLARISATOR_11,
-       EL_MM_POLARISATOR_10,
-       EL_MM_POLARISATOR_9,
-       EL_MM_POLARISATOR_8,
-       EL_MM_POLARISATOR_7,
-       EL_MM_POLARISATOR_6,
-       EL_MM_POLARISATOR_5,
-       EL_MM_POLARISATOR_4,
-       EL_MM_POLARISATOR_3,
-       EL_MM_POLARISATOR_2
+       EL_MM_POLARIZER_1,
+       EL_MM_POLARIZER_16,
+       EL_MM_POLARIZER_15,
+       EL_MM_POLARIZER_14,
+       EL_MM_POLARIZER_13,
+       EL_MM_POLARIZER_12,
+       EL_MM_POLARIZER_11,
+       EL_MM_POLARIZER_10,
+       EL_MM_POLARIZER_9,
+       EL_MM_POLARIZER_8,
+       EL_MM_POLARIZER_7,
+       EL_MM_POLARIZER_6,
+       EL_MM_POLARIZER_5,
+       EL_MM_POLARIZER_4,
+       EL_MM_POLARIZER_3,
+       EL_MM_POLARIZER_2
       },
       {
        EL_DF_MIRROR_1,
@@ -13124,7 +13147,8 @@ static void HandleCheckbuttons(struct GadgetInfo *gi)
   if ((type_id >= ED_CHECKBUTTON_ID_LEVELSET_FIRST &&
        type_id <= ED_CHECKBUTTON_ID_LEVELSET_LAST) ||
       (type_id >= ED_CHECKBUTTON_ID_EDITOR_FIRST &&
-       type_id <= ED_CHECKBUTTON_ID_EDITOR_LAST) ||
+       type_id <= ED_CHECKBUTTON_ID_EDITOR_LAST &&
+       type_id != ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE_2) ||
       type_id == ED_CHECKBUTTON_ID_STICK_ELEMENT)
     return;