static void ModifyEditorElementList();
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();
DrawLevelEd();
}
+static boolean useEditorDoorAnimation()
+{
+ struct RectWithBorder *vp_door_1 = &viewport.door_1[GAME_MODE_MAIN];
+ boolean door_1_viewport_unchanged =
+ (vp_door_1->x == DX &&
+ vp_door_1->y == DY &&
+ vp_door_1->width == DXSIZE &&
+ vp_door_1->height == DYSIZE);
+ boolean door_1_contains_toolbox =
+ (EX >= DX &&
+ EY >= DY &&
+ EX + EXSIZE <= DX + DXSIZE &&
+ EY + EYSIZE <= DY + DYSIZE);
+
+ return (door_1_viewport_unchanged && door_1_contains_toolbox);
+}
+
+void DrawEditorDoorContent()
+{
+ /* needed for gadgets drawn on background (like palette scrollbar) */
+ SetDoorBackgroundImage(IMG_UNDEFINED);
+
+ /* copy default editor door content to main double buffer */
+ BlitBitmap(graphic_info[IMG_BACKGROUND_PALETTE].bitmap, drawto,
+ graphic_info[IMG_BACKGROUND_PALETTE].src_x,
+ graphic_info[IMG_BACKGROUND_PALETTE].src_y,
+ MIN(DXSIZE, graphic_info[IMG_BACKGROUND_PALETTE].width),
+ MIN(DYSIZE, graphic_info[IMG_BACKGROUND_PALETTE].height),
+ DX, DY);
+
+ /* draw bigger door */
+ DrawSpecialEditorDoor();
+
+ /* draw new control window */
+ BlitBitmap(graphic_info[IMG_BACKGROUND_TOOLBOX].bitmap, drawto,
+ graphic_info[IMG_BACKGROUND_TOOLBOX].src_x,
+ graphic_info[IMG_BACKGROUND_TOOLBOX].src_y,
+ MIN(EXSIZE, graphic_info[IMG_BACKGROUND_TOOLBOX].width),
+ MIN(EYSIZE, graphic_info[IMG_BACKGROUND_TOOLBOX].height),
+ EX, EY);
+
+ /* draw all toolbox gadgets to editor doors */
+ MapControlButtons();
+
+ /* draw all palette gadgets to editor doors */
+ ModifyEditorElementList();
+ RedrawDrawingElements();
+
+ /* copy actual editor door content to door double buffer for OpenDoor() */
+ BlitBitmap(drawto, bitmap_db_door_1, DX, DY, DXSIZE, DYSIZE, 0, 0);
+}
+
void DrawLevelEd()
{
int fade_mask = REDRAW_FIELD;
InitZoomLevelSettings(-1);
InitLevelSetInfo();
- SetDoorState(DOOR_OPEN_1 | DOOR_OPEN_2);
-
#if DEBUG
CheckElementDescriptions();
#endif
level_ypos = -1;
}
- /* needed for gadgets drawn on background (like palette scrollbar) */
- SetDoorBackgroundImage(IMG_UNDEFINED);
-
- /* copy default editor door content to main double buffer */
- BlitBitmap(graphic_info[IMG_BACKGROUND_PALETTE].bitmap, drawto,
- graphic_info[IMG_BACKGROUND_PALETTE].src_x,
- graphic_info[IMG_BACKGROUND_PALETTE].src_y,
- MIN(DXSIZE, graphic_info[IMG_BACKGROUND_PALETTE].width),
- MIN(DYSIZE, graphic_info[IMG_BACKGROUND_PALETTE].height),
- DX, DY);
-
- /* draw bigger door */
- DrawSpecialEditorDoor();
-
- /* draw new control window */
- BlitBitmap(graphic_info[IMG_BACKGROUND_TOOLBOX].bitmap, drawto,
- graphic_info[IMG_BACKGROUND_TOOLBOX].src_x,
- graphic_info[IMG_BACKGROUND_TOOLBOX].src_y,
- MIN(EXSIZE, graphic_info[IMG_BACKGROUND_TOOLBOX].width),
- MIN(EYSIZE, graphic_info[IMG_BACKGROUND_TOOLBOX].height),
- EX, EY);
-
// redraw_mask |= REDRAW_ALL;
FreeLevelEditorGadgets();
InitElementPropertiesGfxElement();
UnmapAllGadgets();
- MapControlButtons();
- DrawEditModeWindow();
+ DrawDrawingWindow_PlayfieldOnly();
DrawMaskedBorder(fade_mask);
- FadeIn(fade_mask);
+ // use door animation if door 1 viewport is unchanged and contains toolbox
+ if (useEditorDoorAnimation())
+ {
+ FadeIn(fade_mask);
- /* copy actual editor door content to door double buffer for OpenDoor() */
- BlitBitmap(drawto, bitmap_db_door_1, DX, DY, DXSIZE, DYSIZE, 0, 0);
+ DrawEditorDoorContent();
+
+ OpenDoor(DOOR_OPEN_1 | DOOR_FORCE_ANIM);
+ }
+ else
+ {
+ DrawEditorDoorContent();
+
+ FadeIn(fade_mask);
+ }
+
+ SetDoorState(DOOR_OPEN_1 | DOOR_OPEN_2);
}
static void AdjustDrawingAreaGadgets()
PickDrawingElement(3, new_element3);
}
-static void DrawDrawingWindow()
+static void DrawDrawingWindowExt(boolean remap_toolbox_gadgets)
{
stick_element_properties_window = FALSE;
ClearField();
UnmapLevelEditorFieldGadgets();
- UnmapLevelEditorToolboxCustomGadgets();
AdjustDrawingAreaGadgets();
AdjustLevelScrollPosition();
DrawEditorLevel(ed_fieldx, ed_fieldy, level_xpos, level_ypos);
MapMainDrawingArea();
- MapLevelEditorToolboxDrawingGadgets();
+
+ if (remap_toolbox_gadgets)
+ {
+ UnmapLevelEditorToolboxCustomGadgets();
+ MapLevelEditorToolboxDrawingGadgets();
+ }
+}
+
+static void DrawDrawingWindow()
+{
+ DrawDrawingWindowExt(TRUE);
+}
+
+static void DrawDrawingWindow_PlayfieldOnly()
+{
+ DrawDrawingWindowExt(FALSE);
}
static int getTabulatorBarWidth()
/* draw normal door */
UndrawSpecialEditorDoor();
+ // use door animation if door 1 viewport is unchanged and contains toolbox
+ if (useEditorDoorAnimation())
+ CloseDoor(DOOR_CLOSE_1 | DOOR_FORCE_ANIM);
+
// close editor doors if viewport definition is the same as in main menu
if (vp_door_1->x == DX &&
vp_door_1->y == DY &&