added support for sound configuration parameters (not used yet)
[rocksndiamonds.git] / src / editor.c
index abc0bc481497e165f9114ac7565e0a5a0c70861e..c95d38db21226bdafbd60dff6d0d957d4d57081d 100644 (file)
@@ -2465,6 +2465,7 @@ static struct ValueTextInfo options_group_choice_mode[] =
   { ANIM_LINEAR,               "linear"                        },
   { ANIM_PINGPONG,             "pingpong"                      },
   { ANIM_PINGPONG2,            "pingpong 2"                    },
+  { ANIM_LEVEL_NR,             "level number"                  },
 
   { -1,                                NULL                            }
 };
@@ -5858,6 +5859,22 @@ static void ReinitializeElementList_EnableSections(void)
     setup_editor_el_mirror_magic       = FALSE;
     setup_editor_el_deflektor          = FALSE;
   }
+  else if (level.game_engine_type == GAME_ENGINE_TYPE_BD)
+  {
+    setup_editor_el_emerald_mine       = FALSE;
+    setup_editor_el_emerald_mine_club  = FALSE;
+    setup_editor_el_more               = FALSE;
+    setup_editor_el_sokoban            = FALSE;
+    setup_editor_el_supaplex           = FALSE;
+    setup_editor_el_diamond_caves      = FALSE;
+    setup_editor_el_dx_boulderdash     = FALSE;
+    setup_editor_el_mirror_magic       = FALSE;
+    setup_editor_el_deflektor          = FALSE;
+    setup_editor_el_chars              = FALSE;
+    setup_editor_el_steel_chars                = FALSE;
+
+    setup_editor_el_custom             = FALSE;
+  }
   else if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
   {
     setup_editor_el_boulderdash                = FALSE;
@@ -7624,7 +7641,7 @@ static void MapGraphicbuttonGadget(int id)
 {
   int font_nr = FONT_TEXT_1;
   int font_height = getFontHeight(font_nr);
-  struct GadgetInfo *gi= level_editor_gadget[graphicbutton_info[id].gadget_id];
+  struct GadgetInfo *gi = level_editor_gadget[graphicbutton_info[id].gadget_id];
   int xoffset_left = getTextWidthForGadget(graphicbutton_info[id].text_left);
   int xoffset_right = ED_GADGET_TEXT_DISTANCE;
   int yoffset = (gi->height - font_height) / 2;
@@ -8917,8 +8934,8 @@ static void AdjustDrawingAreaGadgets(void)
 
   if (suppressBorderElement())
   {
-    ed_xsize = max_ed_fieldx;
-    ed_ysize = max_ed_fieldy;
+    ed_xsize = lev_fieldx;
+    ed_ysize = lev_fieldy;
   }
 
   // check if we need any scrollbars
@@ -10197,7 +10214,7 @@ static void DrawPropertiesConfig(void)
                num_element_counters);
 
       counterbutton_info[counter_id].value = elements_with_counter[i].value;
-      counterbutton_info[counter_id].text_right= elements_with_counter[i].text;
+      counterbutton_info[counter_id].text_right = elements_with_counter[i].text;
 
       if (properties_element == EL_GAME_OF_LIFE ||
          properties_element == EL_BIOMAZE)
@@ -12765,6 +12782,7 @@ static void CopyBrushExt(int from_x, int from_y, int to_x, int to_y,
       lev_fieldx = level.fieldx = brush_width;
       lev_fieldy = level.fieldy = brush_height;
 
+      boolean use_bd_engine = TRUE;
       boolean use_em_engine = TRUE;
       boolean use_sp_engine = TRUE;
       boolean use_mm_engine = TRUE;
@@ -12775,6 +12793,9 @@ static void CopyBrushExt(int from_x, int from_y, int to_x, int to_y,
        {
          int element = Tile[x][y];
 
+         if (!IS_BD_ELEMENT(element) && !IS_PLAYER_ELEMENT(element))
+           use_bd_engine = FALSE;
+
          if (!IS_EM_ELEMENT(element) && !IS_PLAYER_ELEMENT(element))
            use_em_engine = FALSE;
 
@@ -12786,7 +12807,8 @@ static void CopyBrushExt(int from_x, int from_y, int to_x, int to_y,
        }
       }
 
-      level.game_engine_type = (use_em_engine ? GAME_ENGINE_TYPE_EM :
+      level.game_engine_type = (use_bd_engine ? GAME_ENGINE_TYPE_BD :
+                               use_em_engine ? GAME_ENGINE_TYPE_EM :
                                use_sp_engine ? GAME_ENGINE_TYPE_SP :
                                use_mm_engine ? GAME_ENGINE_TYPE_MM :
                                GAME_ENGINE_TYPE_RND);
@@ -13320,29 +13342,69 @@ static void DrawAreaElementHighlight(boolean highlighted,
   {
     for (y = 0; y < ed_fieldy; y++)
     {
+      boolean highlight = FALSE;
       int lx = x + level_xpos;
       int ly = y + level_ypos;
 
       if (!IN_LEV_FIELD(lx, ly))
        continue;
 
-      if (Tile[lx][ly] != new_element1 &&
-         (!highlighted_similar ||
-          !strEqual(element_info[Tile[lx][ly]].class_name,
-                    element_info[new_element1].class_name)))
+      // check if element is the same
+      if (Tile[lx][ly] == new_element1)
+       highlight = TRUE;
+
+      // check if element is similar
+      if (highlighted_similar &&
+         strEqual(element_info[Tile[lx][ly]].class_name,
+                  element_info[new_element1].class_name))
+       highlight = TRUE;
+
+      // check if element is matching MM style wall
+      if (IS_MM_WALL(Tile[lx][ly]) &&
+         map_mm_wall_element(Tile[lx][ly]) == new_element1)
+       highlight = TRUE;
+
+      if (!highlight)
        continue;
 
-      int sx = SX + x * ed_tilesize;
-      int sy = SY + y * ed_tilesize;
-      int from_sx = sx;
-      int from_sy = sy;
-      int to_sx = sx + ed_tilesize - 1;
-      int to_sy = sy + ed_tilesize - 1;
-
-      DrawSimpleWhiteLine(drawto, from_sx, from_sy, to_sx,   from_sy);
-      DrawSimpleWhiteLine(drawto, to_sx,   from_sy, to_sx,   to_sy);
-      DrawSimpleWhiteLine(drawto, to_sx,   to_sy,   from_sx, to_sy);
-      DrawSimpleWhiteLine(drawto, from_sx, to_sy,   from_sx, from_sy);
+      if (IS_MM_WALL(Tile[lx][ly]) && !highlighted_similar)
+      {
+       int i;
+
+       for (i = 0; i < 4; i++)
+       {
+         if (!(MM_WALL_BITS(Tile[lx][ly]) & (1 << i)))
+           continue;
+
+         int xx = x * 2 + (i % 2);
+         int yy = y * 2 + (i / 2);
+         int sx = SX + xx * ed_tilesize / 2;
+         int sy = SY + yy * ed_tilesize / 2;
+         int from_sx = sx;
+         int from_sy = sy;
+         int to_sx = sx + ed_tilesize / 2 - 1;
+         int to_sy = sy + ed_tilesize / 2 - 1;
+
+         DrawSimpleWhiteLine(drawto, from_sx, from_sy, to_sx,   from_sy);
+         DrawSimpleWhiteLine(drawto, to_sx,   from_sy, to_sx,   to_sy);
+         DrawSimpleWhiteLine(drawto, to_sx,   to_sy,   from_sx, to_sy);
+         DrawSimpleWhiteLine(drawto, from_sx, to_sy,   from_sx, from_sy);
+       }
+      }
+      else
+      {
+       int sx = SX + x * ed_tilesize;
+       int sy = SY + y * ed_tilesize;
+       int from_sx = sx;
+       int from_sy = sy;
+       int to_sx = sx + ed_tilesize - 1;
+       int to_sy = sy + ed_tilesize - 1;
+
+       DrawSimpleWhiteLine(drawto, from_sx, from_sy, to_sx,   from_sy);
+       DrawSimpleWhiteLine(drawto, to_sx,   from_sy, to_sx,   to_sy);
+       DrawSimpleWhiteLine(drawto, to_sx,   to_sy,   from_sx, to_sy);
+       DrawSimpleWhiteLine(drawto, from_sx, to_sy,   from_sx, from_sy);
+      }
     }
   }
 }
@@ -14697,8 +14759,8 @@ static void HandleControlButtons(struct GadgetInfo *gi)
 
          for (i = 0; editor_elements_info[i].setup_value != NULL; i++)
          {
-           int *cascade_element= &(*editor_elements_info[i].headline_list)[0];
-           boolean *cascade_value=editor_elements_info[i].setup_cascade_value;
+           int *cascade_element = &(*editor_elements_info[i].headline_list)[0];
+           boolean *cascade_value = editor_elements_info[i].setup_cascade_value;
 
            if (*cascade_element == new_element)
            {
@@ -15242,7 +15304,7 @@ void RequestExitLevelEditor(boolean ask_if_level_has_changed,
        vp_door_2->height == VYSIZE)
       CloseDoor(DOOR_CLOSE_ALL | DOOR_NO_DELAY);
     else
-      SetDoorState(DOOR_CLOSE_2);
+      SetDoorState(DOOR_CLOSE_ALL);
 
     BackToFront();