rnd-20021227-2-src
[rocksndiamonds.git] / src / editor.c
index db1a37e8705064866c79be94d87ea00baf298a9b..7850a4f590f4bf3dcdad8624b70f693b72d95f06 100644 (file)
@@ -1182,10 +1182,70 @@ int editor_element[] =
   EL_CHAR('R'),
   */
 
-  EL_EMPTY,
-  EL_EMPTY,
-  EL_EMPTY,
-  EL_EMPTY,
+  EL_CHAR('C'),
+  EL_CHAR('U'),
+  EL_CHAR('S'),
+  EL_CHAR('-'),
+
+  EL_CHAR('T'),
+  EL_CHAR('O'),
+  EL_CHAR('M'),
+  EL_CHAR(' '),
+
+  EL_CHAR('E'),
+  EL_CHAR('L'),
+  EL_CHAR('E'),
+  EL_CHAR('M'),
+
+  EL_CHAR('E'),
+  EL_CHAR('N'),
+  EL_CHAR('T'),
+  EL_CHAR('S'),
+
+  EL_GENERIC_START + 0,
+  EL_GENERIC_START + 1,
+  EL_GENERIC_START + 2,
+  EL_GENERIC_START + 3,
+
+  EL_GENERIC_START + 4,
+  EL_GENERIC_START + 5,
+  EL_GENERIC_START + 6,
+  EL_GENERIC_START + 7,
+
+  EL_GENERIC_START + 8,
+  EL_GENERIC_START + 9,
+  EL_GENERIC_START + 10,
+  EL_GENERIC_START + 11,
+
+  EL_GENERIC_START + 12,
+  EL_GENERIC_START + 13,
+  EL_GENERIC_START + 14,
+  EL_GENERIC_START + 15,
+
+  EL_GENERIC_START + 16,
+  EL_GENERIC_START + 17,
+  EL_GENERIC_START + 18,
+  EL_GENERIC_START + 19,
+
+  EL_GENERIC_START + 20,
+  EL_GENERIC_START + 21,
+  EL_GENERIC_START + 22,
+  EL_GENERIC_START + 23,
+
+  EL_GENERIC_START + 24,
+  EL_GENERIC_START + 25,
+  EL_GENERIC_START + 26,
+  EL_GENERIC_START + 27,
+
+  EL_GENERIC_START + 28,
+  EL_GENERIC_START + 29,
+  EL_GENERIC_START + 30,
+  EL_GENERIC_START + 31,
+
+  EL_CHAR('T'),
+  EL_CHAR('E'),
+  EL_CHAR('X'),
+  EL_CHAR('T'),
 
   EL_CHAR(' '),
   EL_CHAR('!'),
@@ -1265,7 +1325,12 @@ int editor_element[] =
   EL_CHAR('Ö'),
   EL_CHAR('Ü'),
   EL_CHAR('^'),
-  EL_CHAR(' ')
+  EL_CHAR('_'),
+
+  EL_CHAR(' '),
+  EL_CHAR('°'),
+  EL_CHAR('´'),
+  EL_CHAR('|')
 };
 int elements_in_list = sizeof(editor_element)/sizeof(int);
 
@@ -1273,7 +1338,8 @@ static char *getElementInfoText(int element)
 {
   char *info_text = "unknown";
 
-  if (element < NUM_FILE_ELEMENTS)
+  if (element < NUM_FILE_ELEMENTS &&
+      element_info[element].editor_description != NULL)
     info_text = element_info[element].editor_description;
   else
     Error(ERR_WARN, "no element description for element %d", element);
@@ -1298,13 +1364,13 @@ static void ScrollMiniLevel(int from_x, int from_y, int scroll)
   {
     x = (dx == 1 ? 0 : ed_fieldx - 1);
     for(y=0; y<ed_fieldy; y++)
-      DrawNewMiniElementOrWall(x, y, from_x, from_y);
+      DrawMiniElementOrWall(x, y, from_x, from_y);
   }
   else if (dy)
   {
     y = (dy == 1 ? 0 : ed_fieldy - 1);
     for(x=0; x<ed_fieldx; x++)
-      DrawNewMiniElementOrWall(x, y, from_x, from_y);
+      DrawMiniElementOrWall(x, y, from_x, from_y);
   }
 
   redraw_mask |= REDRAW_FIELD;
@@ -1313,7 +1379,7 @@ static void ScrollMiniLevel(int from_x, int from_y, int scroll)
 
 static void CreateControlButtons()
 {
-  Bitmap *gd_bitmap = pix[PIX_DOOR];
+  Bitmap *gd_bitmap = new_graphic_info[IMG_MENU_DOOR].bitmap;
   struct GadgetInfo *gi;
   unsigned long event_mask;
   int i;
@@ -1490,8 +1556,8 @@ static void CreateControlButtons()
     gd_x2 = DOOR_GFX_PAGEX6 + ED_ELEMENTLIST_XPOS;
     gd_y  = DOOR_GFX_PAGEY1 + ED_ELEMENTLIST_YPOS;
 
-    getNewMiniGraphicSource(el2img(editor_element[i]),
-                           &deco_bitmap, &deco_x, &deco_y);
+    getMiniGraphicSource(el2img(editor_element[i]),
+                        &deco_bitmap, &deco_x, &deco_y);
     deco_xpos = (ED_ELEMENTLIST_XSIZE - MINI_TILEX) / 2;
     deco_ypos = (ED_ELEMENTLIST_YSIZE - MINI_TILEY) / 2;
 
@@ -1534,7 +1600,7 @@ static void CreateCounterButtons()
 
     for (j=0; j<2; j++)
     {
-      Bitmap *gd_bitmap = pix[PIX_DOOR];
+      Bitmap *gd_bitmap = new_graphic_info[IMG_MENU_DOOR].bitmap;
       struct GadgetInfo *gi;
       int id = (j == 0 ?
                counterbutton_info[i].gadget_id_down :
@@ -1756,7 +1822,7 @@ static void CreateTextInputGadgets()
 
   for (i=0; i<ED_NUM_TEXTINPUT; i++)
   {
-    Bitmap *gd_bitmap = pix[PIX_DOOR];
+    Bitmap *gd_bitmap = new_graphic_info[IMG_MENU_DOOR].bitmap;
     int gd_x, gd_y;
     struct GadgetInfo *gi;
     unsigned long event_mask;
@@ -1803,7 +1869,7 @@ static void CreateScrollbarGadgets()
   for (i=0; i<ED_NUM_SCROLLBARS; i++)
   {
     int id = scrollbar_info[i].gadget_id;
-    Bitmap *gd_bitmap = pix[PIX_DOOR];
+    Bitmap *gd_bitmap = new_graphic_info[IMG_MENU_DOOR].bitmap;
     int gd_x1, gd_x2, gd_y1, gd_y2;
     struct GadgetInfo *gi;
     int items_max, items_visible, item_position;
@@ -1868,7 +1934,7 @@ static void CreateScrollbarGadgets()
 
 static void CreateCheckbuttonGadgets()
 {
-  Bitmap *gd_bitmap = pix[PIX_DOOR];
+  Bitmap *gd_bitmap = new_graphic_info[IMG_MENU_DOOR].bitmap;
   struct GadgetInfo *gi;
   unsigned long event_mask;
   int gd_x1, gd_x2, gd_x3, gd_x4, gd_y;
@@ -1959,6 +2025,14 @@ void CreateLevelEditorGadgets()
   CreateCheckbuttonGadgets();
 }
 
+void FreeLevelEditorGadgets()
+{
+  int i;
+
+  for (i=0; i<NUM_EDITOR_GADGETS; i++)
+    FreeGadget(level_editor_gadget[i]);
+}
+
 static void MapCounterButtons(int id)
 {
   MapGadget(level_editor_gadget[counterbutton_info[id].gadget_id_down]);
@@ -2137,17 +2211,17 @@ void DrawLevelEd()
   }
 
   /* copy default editor door content to main double buffer */
-  BlitBitmap(pix[PIX_DOOR], drawto,
+  BlitBitmap(new_graphic_info[IMG_MENU_DOOR].bitmap, drawto,
             DOOR_GFX_PAGEX6, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, DX, DY);
 
   /* draw mouse button brush elements */
-  DrawNewMiniGraphicExt(drawto,
+  DrawMiniGraphicExt(drawto,
                     DX + ED_WIN_MB_LEFT_XPOS, DY + ED_WIN_MB_LEFT_YPOS,
                     el2img(new_element1));
-  DrawNewMiniGraphicExt(drawto,
+  DrawMiniGraphicExt(drawto,
                     DX + ED_WIN_MB_MIDDLE_XPOS, DY + ED_WIN_MB_MIDDLE_YPOS,
                     el2img(new_element2));
-  DrawNewMiniGraphicExt(drawto,
+  DrawMiniGraphicExt(drawto,
                     DX + ED_WIN_MB_RIGHT_XPOS, DY + ED_WIN_MB_RIGHT_YPOS,
                     el2img(new_element3));
 
@@ -2155,7 +2229,7 @@ void DrawLevelEd()
   DrawSpecialEditorDoor();
 
   /* draw new control window */
-  BlitBitmap(pix[PIX_DOOR], drawto,
+  BlitBitmap(new_graphic_info[IMG_MENU_DOOR].bitmap, drawto,
             DOOR_GFX_PAGEX8, 236, EXSIZE, EYSIZE, EX, EY);
 
   redraw_mask |= REDRAW_ALL;
@@ -2163,7 +2237,7 @@ void DrawLevelEd()
   MapControlButtons();
 
   /* copy actual editor door content to door double buffer for OpenDoor() */
-  BlitBitmap(drawto, pix[PIX_DB_DOOR],
+  BlitBitmap(drawto, bitmap_db_door,
             DX, DY, DXSIZE, DYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
 
   DrawEditModeWindow();
@@ -2320,21 +2394,21 @@ static void PickDrawingElement(int button, int element)
   if (button == 1)
   {
     new_element1 = element;
-    DrawNewMiniGraphicExt(drawto,
+    DrawMiniGraphicExt(drawto,
                       DX + ED_WIN_MB_LEFT_XPOS, DY + ED_WIN_MB_LEFT_YPOS,
                       el2img(new_element1));
   }
   else if (button == 2)
   {
     new_element2 = element;
-    DrawNewMiniGraphicExt(drawto,
+    DrawMiniGraphicExt(drawto,
                       DX + ED_WIN_MB_MIDDLE_XPOS, DY + ED_WIN_MB_MIDDLE_YPOS,
                       el2img(new_element2));
   }
   else
   {
     new_element3 = element;
-    DrawNewMiniGraphicExt(drawto,
+    DrawMiniGraphicExt(drawto,
                       DX + ED_WIN_MB_RIGHT_XPOS, DY + ED_WIN_MB_RIGHT_YPOS,
                       el2img(new_element3));
   }
@@ -2350,7 +2424,7 @@ static void DrawDrawingWindow()
   AdjustLevelScrollPosition();
   AdjustEditorScrollbar(GADGET_ID_SCROLL_HORIZONTAL);
   AdjustEditorScrollbar(GADGET_ID_SCROLL_VERTICAL);
-  DrawNewMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
+  DrawMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
   MapMainDrawingArea();
 }
 
@@ -2367,7 +2441,7 @@ static void DrawRandomPlacementBackgroundArea()
   /* draw decorative border for the object */
   for (y=0; y<2; y++)
     for (x=0; x<2; x++)
-      DrawNewMiniElement(area_x + x, area_y + y, EL_SAND);
+      DrawMiniElement(area_x + x, area_y + y, EL_SAND);
 
   ClearRectangle(drawto,
                 area_sx + MINI_TILEX/2 - 1, area_sy + MINI_TILEY/2 - 1,
@@ -2378,7 +2452,7 @@ static void DrawRandomPlacementBackgroundArea()
             area_sx, area_sy, 3 * MINI_TILEX, 3 * MINI_TILEY,
             area_sx - MINI_TILEX/2, area_sy - MINI_TILEY/2);
 
-  DrawNewMiniElement(area_x, area_y, ElementContent[0][0][0]);
+  DrawMiniElement(area_x, area_y, ElementContent[0][0][0]);
 
   MapDrawingArea(GADGET_ID_RANDOM_BACKGROUND);
 }
@@ -2489,7 +2563,7 @@ static void DrawAmoebaContentArea()
   /* draw decorative border for the object */
   for (y=0; y<2; y++)
     for (x=0; x<2; x++)
-      DrawNewMiniElement(area_x + x, area_y + y, EL_SAND);
+      DrawMiniElement(area_x + x, area_y + y, EL_SAND);
 
   ClearRectangle(drawto,
                 area_sx + MINI_TILEX/2 - 1, area_sy + MINI_TILEY/2 - 1,
@@ -2503,7 +2577,7 @@ static void DrawAmoebaContentArea()
   DrawText(area_sx + TILEX, area_sy + 1, "Content of amoeba",
           FS_SMALL, font_color);
 
-  DrawNewMiniElement(area_x, area_y, ElementContent[0][0][0]);
+  DrawMiniElement(area_x, area_y, ElementContent[0][0][0]);
 
   MapDrawingArea(GADGET_ID_AMOEBA_CONTENT);
 }
@@ -2546,7 +2620,7 @@ static void DrawElementContentAreas()
   {
     for (y=0; y<4; y++)
       for (x=0; x<4; x++)
-       DrawNewMiniElement(area_x + 5 * (i % 4) + x, area_y + 6 * (i / 4) + y,
+       DrawMiniElement(area_x + 5 * (i % 4) + x, area_y + 6 * (i / 4) + y,
                        EL_SAND);
 
     ClearRectangle(drawto,
@@ -2571,7 +2645,7 @@ static void DrawElementContentAreas()
   {
     for (y=0; y<3; y++)
       for (x=0; x<3; x++)
-       DrawNewMiniElement(area_x + 5 * (i % 4) + x, area_y + 6 * (i / 4) + y,
+       DrawMiniElement(area_x + 5 * (i % 4) + x, area_y + 6 * (i / 4) + y,
                        ElementContent[i][x][y]);
 
     DrawTextF(area_sx - SX + 5 * (i % 4) * MINI_TILEX + MINI_TILEX + 1,
@@ -2583,6 +2657,43 @@ static void DrawElementContentAreas()
     MapDrawingArea(GADGET_ID_ELEM_CONTENT_0 + i);
 }
 
+#if 0
+static void DrawPropertiesElement(int xstart, int ystart, int element)
+{
+  int x, y;
+
+  /* draw some decorative border for the object */
+  for (y=0; y<3; y++)
+    for (x=0; x<3; x++)
+      DrawMiniElement(xstart + x , ystart + y, EL_SAND);
+
+  ClearRectangle(drawto,
+                SX + xstart * MINI_TILEX + MINI_TILEX/2 - 1,
+                SY + ystart * MINI_TILEY + MINI_TILEY/2 - 1,
+                TILEX + 2, TILEY + 2);
+
+  /* copy border to the right location */
+  BlitBitmap(drawto, drawto,
+            SX + xstart * MINI_TILEX,
+            SY + ystart * MINI_TILEY,
+            2 * TILEX, 2 * TILEY,
+            SX + xstart * MINI_TILEX - MINI_TILEX/2,
+            SY + ystart * MINI_TILEY - MINI_TILEY/2);
+
+  DrawGraphicAnimation(xstart / 2, ystart / 2, el2img(element));
+
+  /* copy the whole stuff to the definitive location */
+  BlitBitmap(drawto, drawto,
+            SX + xstart * MINI_TILEX - MINI_TILEX/2,
+            SY + ystart * MINI_TILEY - MINI_TILEY,
+            2 * TILEX, 2 * TILEY,
+            SX + xstart * MINI_TILEX - MINI_TILEX/2,
+            SY + ystart * MINI_TILEY - MINI_TILEY/2);
+
+  FrameCounter++;      /* increase animation frame counter */
+}
+#endif
+
 #define TEXT_COLLECTING                "Score for collecting"
 #define TEXT_SMASHING          "Score for smashing"
 #define TEXT_CRACKING          "Score for cracking"
@@ -2663,10 +2774,11 @@ static void DrawPropertiesWindow()
   DrawText(SX + ED_SETTINGS2_XPOS, SY + ED_SETTINGS_YPOS,
           "Element Settings", FS_BIG, FC_YELLOW);
 
+#if 1
   /* draw some decorative border for the object */
   for (y=0; y<3; y++)
     for (x=0; x<3; x++)
-      DrawNewMiniElement(xstart + x , ystart + y, EL_SAND);
+      DrawMiniElement(xstart + x , ystart + y, EL_SAND);
 
   ClearRectangle(drawto,
                 SX + xstart * MINI_TILEX + MINI_TILEX/2 - 1,
@@ -2681,7 +2793,11 @@ static void DrawPropertiesWindow()
             SX + xstart * MINI_TILEX - MINI_TILEX/2,
             SY + ystart * MINI_TILEY - MINI_TILEY/2);
 
-  DrawNewGraphic(xstart / 2, ystart / 2, el2img(properties_element), 0);
+#if 0
+  DrawGraphic(xstart / 2, ystart / 2, el2img(properties_element), 0);
+#else
+  DrawGraphicAnimation(xstart / 2, ystart / 2, el2img(properties_element));
+#endif
 
   /* copy the whole stuff to the definitive location */
   BlitBitmap(drawto, drawto,
@@ -2691,6 +2807,15 @@ static void DrawPropertiesWindow()
             SX + xstart * MINI_TILEX - MINI_TILEX/2,
             SY + ystart * MINI_TILEY - MINI_TILEY/2);
 
+  FrameCounter = 0;    /* restart animation frame counter */
+
+#else
+
+  FrameCounter = 0;    /* restart animation frame counter */
+  DrawPropertiesElement(xstart, ystart, properties_element);
+
+#endif
+
   DrawTextF((xstart + 3) * MINI_TILEX, (ystart + 1) * MINI_TILEY,
            font_color, getElementInfoText(properties_element));
 
@@ -2759,7 +2884,7 @@ static void DrawLineElement(int sx, int sy, int element, boolean change_level)
   int lx = sx + level_xpos;
   int ly = sy + level_ypos;
 
-  DrawNewMiniElement(sx, sy, (element < 0 ? Feld[lx][ly] : element));
+  DrawMiniElement(sx, sy, (element < 0 ? Feld[lx][ly] : element));
 
   if (change_level)
     Feld[lx][ly] = element;
@@ -3174,7 +3299,7 @@ static int DrawLevelText(int sx, int sy, char letter, int mode)
       break;
 
     case TEXT_SETCURSOR:
-      DrawNewMiniElement(last_sx, last_sy, Feld[lx][ly]);
+      DrawMiniElement(last_sx, last_sy, Feld[lx][ly]);
       DrawAreaBorder(sx, sy, sx, sy);
       last_sx = sx;
       last_sy = sy;
@@ -3199,7 +3324,7 @@ static int DrawLevelText(int sx, int sy, char letter, int mode)
       if (sx > start_sx)
       {
        Feld[lx - 1][ly] = delete_buffer[sx - start_sx - 1];
-       DrawNewMiniElement(sx - 1, sy, Feld[lx - 1][ly]);
+       DrawMiniElement(sx - 1, sy, Feld[lx - 1][ly]);
        DrawLevelText(sx - 1, sy, 0, TEXT_SETCURSOR);
       }
       break;
@@ -3213,7 +3338,7 @@ static int DrawLevelText(int sx, int sy, char letter, int mode)
 
     case TEXT_END:
       CopyLevelToUndoBuffer(UNDO_IMMEDIATE);
-      DrawNewMiniElement(sx, sy, Feld[lx][ly]);
+      DrawMiniElement(sx, sy, Feld[lx][ly]);
       typing = FALSE;
       break;
 
@@ -3234,7 +3359,7 @@ static void SetTextCursor(int unused_sx, int unused_sy, int sx, int sy,
   int ly = sy + level_ypos;
 
   if (element == -1)
-    DrawNewMiniElement(sx, sy, Feld[lx][ly]);
+    DrawMiniElement(sx, sy, Feld[lx][ly]);
   else
     DrawAreaBorder(sx, sy, sx, sy);
 }
@@ -3279,7 +3404,7 @@ static void CopyLevelToUndoBuffer(int mode)
   last_border_element = BorderElement;
   SetBorderElement();
   if (BorderElement != last_border_element)
-    DrawNewMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
+    DrawMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
 
 #if 0
 #ifdef DEBUG
@@ -3320,7 +3445,7 @@ static void RandomPlacement(int new_element)
       for (y=0; y<lev_fieldy; y++)
        Feld[x][y] = new_element;
 
-    DrawNewMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
+    DrawMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
     CopyLevelToUndoBuffer(UNDO_IMMEDIATE);
     return;
   }
@@ -3339,7 +3464,7 @@ static void RandomPlacement(int new_element)
     }
   }
 
-  DrawNewMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
+  DrawMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
   CopyLevelToUndoBuffer(UNDO_IMMEDIATE);
 }
 
@@ -3358,7 +3483,7 @@ void WrapLevel(int dx, int dy)
       Feld[x][y] =
        FieldBackup[(x + wrap_dx) % lev_fieldx][(y + wrap_dy) % lev_fieldy];
 
-  DrawNewMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
+  DrawMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
   CopyLevelToUndoBuffer(UNDO_ACCUMULATE);
 }
 
@@ -3458,7 +3583,7 @@ static void HandleDrawingAreas(struct GadgetInfo *gi)
                  Feld[x][y] = EL_EMPTY;
                  if (x - level_xpos >= 0 && x - level_xpos < ed_fieldx &&
                      y - level_ypos >= 0 && y - level_ypos < ed_fieldy)
-                   DrawNewMiniElement(x - level_xpos, y - level_ypos,
+                   DrawMiniElement(x - level_xpos, y - level_ypos,
                                    EL_EMPTY);
                }
              }
@@ -3466,16 +3591,16 @@ static void HandleDrawingAreas(struct GadgetInfo *gi)
          }
 
          Feld[lx][ly] = new_element;
-         DrawNewMiniElement(sx, sy, new_element);
+         DrawMiniElement(sx, sy, new_element);
        }
       }
       else
       {
-       DrawNewMiniGraphicExt(drawto,
+       DrawMiniGraphicExt(drawto,
                           gi->x + sx * MINI_TILEX,
                           gi->y + sy * MINI_TILEY,
                           el2img(new_element));
-       DrawNewMiniGraphicExt(window,
+       DrawMiniGraphicExt(window,
                           gi->x + sx * MINI_TILEX,
                           gi->y + sy * MINI_TILEY,
                           el2img(new_element));
@@ -3575,7 +3700,7 @@ static void HandleDrawingAreas(struct GadgetInfo *gi)
       if (button_press_event && Feld[lx][ly] != new_element)
       {
        FloodFill(lx, ly, new_element);
-       DrawNewMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
+       DrawMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
        CopyLevelToUndoBuffer(UNDO_IMMEDIATE);
       }
       break;
@@ -3698,7 +3823,7 @@ static void HandleControlButtons(struct GadgetInfo *gi)
        if (button == 1)
          ScrollMiniLevel(level_xpos, level_ypos, ED_SCROLL_RIGHT);
        else
-         DrawNewMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
+         DrawMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
 
        ModifyGadget(level_editor_gadget[GADGET_ID_SCROLL_HORIZONTAL],
                     GDI_SCROLLBAR_ITEM_POSITION, level_xpos + 1, GDI_END);
@@ -3717,7 +3842,7 @@ static void HandleControlButtons(struct GadgetInfo *gi)
        if (button == 1)
          ScrollMiniLevel(level_xpos, level_ypos, ED_SCROLL_LEFT);
        else
-         DrawNewMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
+         DrawMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
 
        ModifyGadget(level_editor_gadget[GADGET_ID_SCROLL_HORIZONTAL],
                     GDI_SCROLLBAR_ITEM_POSITION, level_xpos + 1, GDI_END);
@@ -3736,7 +3861,7 @@ static void HandleControlButtons(struct GadgetInfo *gi)
        if (button == 1)
          ScrollMiniLevel(level_xpos, level_ypos, ED_SCROLL_DOWN);
        else
-         DrawNewMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
+         DrawMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
 
        ModifyGadget(level_editor_gadget[GADGET_ID_SCROLL_VERTICAL],
                     GDI_SCROLLBAR_ITEM_POSITION, level_ypos + 1, GDI_END);
@@ -3755,7 +3880,7 @@ static void HandleControlButtons(struct GadgetInfo *gi)
        if (button == 1)
          ScrollMiniLevel(level_xpos, level_ypos, ED_SCROLL_UP);
        else
-         DrawNewMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
+         DrawMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
 
        ModifyGadget(level_editor_gadget[GADGET_ID_SCROLL_VERTICAL],
                     GDI_SCROLLBAR_ITEM_POSITION, level_ypos + 1, GDI_END);
@@ -3764,12 +3889,12 @@ static void HandleControlButtons(struct GadgetInfo *gi)
 
     case GADGET_ID_SCROLL_HORIZONTAL:
       level_xpos = gi->event.item_position - 1;
-      DrawNewMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
+      DrawMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
       break;
 
     case GADGET_ID_SCROLL_VERTICAL:
       level_ypos = gi->event.item_position - 1;
-      DrawNewMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
+      DrawMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
       break;
 
     case GADGET_ID_SCROLL_LIST_UP:
@@ -3800,7 +3925,7 @@ static void HandleControlButtons(struct GadgetInfo *gi)
        int element = editor_element[element_shift + i];
 
        UnmapGadget(gi);
-       getNewMiniGraphicSource(el2img(element), &gd->bitmap, &gd->x, &gd->y);
+       getMiniGraphicSource(el2img(element), &gd->bitmap, &gd->x, &gd->y);
        ModifyGadget(gi, GDI_INFO_TEXT, getElementInfoText(element), GDI_END);
        MapGadget(gi);
       }
@@ -3869,7 +3994,7 @@ static void HandleControlButtons(struct GadgetInfo *gi)
       for(x=0; x<lev_fieldx; x++)
        for(y=0; y<lev_fieldy; y++)
          Feld[x][y] = UndoBuffer[undo_buffer_position][x][y];
-      DrawNewMiniLevel(ed_fieldx, ed_fieldy, level_xpos,level_ypos);
+      DrawMiniLevel(ed_fieldx, ed_fieldy, level_xpos,level_ypos);
       break;
 
     case GADGET_ID_INFO:
@@ -3891,7 +4016,7 @@ static void HandleControlButtons(struct GadgetInfo *gi)
          Feld[x][y] = (button == 1 ? EL_EMPTY : new_element);
       CopyLevelToUndoBuffer(GADGET_ID_CLEAR);
 
-      DrawNewMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
+      DrawMiniLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
       break;
 
     case GADGET_ID_SAVE:
@@ -4061,6 +4186,32 @@ void HandleLevelEditorKeyInput(Key key)
   }
 }
 
+void HandleLevelEditorIdle()
+{
+  static unsigned long action_delay = 0;
+  unsigned long action_delay_value = GameFrameDelay;
+  int xpos = 1, ypos = 2;
+
+  if (edit_mode != ED_MODE_PROPERTIES)
+    return;
+
+  if (!DelayReached(&action_delay, action_delay_value))
+    return;
+
+  FY += MINI_TILEY / 2;
+#if 1
+  DrawGraphicAnimation(xpos, ypos, el2img(properties_element));
+#else
+  DrawGraphicAnimation(xpos, ypos, el_dir_act2img(properties_element,
+                                                 MV_NO_MOVING,
+                                                 ...));
+#endif
+  FY -= MINI_TILEY / 2;
+  MarkTileDirty(xpos, ypos + 1);
+
+  FrameCounter++;      /* increase animation frame counter */
+}
+
 void ClearEditorGadgetInfoText()
 {
   ClearRectangle(drawto,
@@ -4258,7 +4409,7 @@ void RequestExitLevelEditor(boolean ask_if_level_has_changed)
   else
   {
     CloseDoor(DOOR_CLOSE_1);
-    BlitBitmap(pix[PIX_DB_DOOR], pix[PIX_DB_DOOR],
+    BlitBitmap(bitmap_db_door, bitmap_db_door,
               DOOR_GFX_PAGEX2, DOOR_GFX_PAGEY1, DXSIZE,DYSIZE,
               DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
     OpenDoor(DOOR_OPEN_1);