X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Feditor.c;h=99a3161da273d822bf56cbb46737065aa140b45e;hp=1fe6e544b86c631277e8a35ac611a8225c28177a;hb=520b554dfeb3a72b6b3af91903642b158169407c;hpb=60014249f834e565fed50c66077a38b6d5125f3d diff --git a/src/editor.c b/src/editor.c index 1fe6e544..99a3161d 100644 --- a/src/editor.c +++ b/src/editor.c @@ -7743,8 +7743,15 @@ void CheckElementDescriptions() Error(ERR_WARN, "no element description for element '%s'", EL_NAME(i)); } +static boolean playfield_area_changed = FALSE; + void DrawLevelEd() { + int old_sx = SX; + int old_sy = SY; + int old_sxsize = SXSIZE; + int old_sysize = SYSIZE; + StopAnimation(); CloseDoor(DOOR_CLOSE_ALL); @@ -7754,11 +7761,32 @@ void DrawLevelEd() // FadeOut(REDRAW_ALL); #endif +#if 1 + /* needed after playing if editor playfield area has different size */ + ClearRectangle(drawto, REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE); +#endif + #if 1 /* needed if different viewport properties defined for editor */ ChangeViewportPropertiesIfNeeded(); #endif + if (old_sx != SX || + old_sy != SY || + old_sxsize != SXSIZE || + old_sysize != SYSIZE) + { + playfield_area_changed = TRUE; + +#if 0 + printf("::: %d, %d, %d, %d != %d, %d, %d, %d\n", + old_sx, old_sy, old_sxsize, old_sysize, + SX, SY, SXSIZE, SYSIZE); +#endif + } + else + playfield_area_changed = FALSE; + #if 1 OpenDoor(DOOR_OPEN_1 | DOOR_OPEN_2 | DOOR_NO_DELAY); #else @@ -7836,6 +7864,8 @@ void DrawLevelEd() DrawEditModeWindow(); #if 1 + FadeIn(playfield_area_changed ? REDRAW_ALL : REDRAW_FIELD); +#else FadeIn(REDRAW_FIELD); // FadeIn(REDRAW_ALL); #endif @@ -7848,7 +7878,7 @@ void DrawLevelEd() DX, DY, DXSIZE, DYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1); #endif -#if 1 +#if 0 /* draw new control window (with border) to window */ redraw_mask |= REDRAW_ALL; BackToFront(); @@ -11906,7 +11936,16 @@ static void HandleControlButtons(struct GadgetInfo *gi) CloseDoor(DOOR_CLOSE_ALL); +#if 0 BackToFront(); /* force redraw of undrawn special door */ +#endif + +#if 1 + /* needed before playing if editor playfield area has different size */ + ClearRectangle(drawto, REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE); + + redraw_mask = REDRAW_ALL; +#endif #if 0 DrawCompleteVideoDisplay(); @@ -12388,8 +12427,13 @@ void RequestExitLevelEditor(boolean ask_if_level_has_changed, Request("Level has changed! Exit without saving?", REQ_ASK | REQ_STAY_OPEN)) { +#if 1 + // CloseDoor(DOOR_CLOSE_1); + SetDoorState(DOOR_CLOSE_2); +#else CloseDoor(DOOR_CLOSE_1); SetDoorState(DOOR_CLOSE_2); +#endif #if 1 if (quick_quit) @@ -12400,15 +12444,24 @@ void RequestExitLevelEditor(boolean ask_if_level_has_changed, #endif game_status = GAME_MODE_MAIN; +#if 1 + DrawAndFadeInMainMenu(playfield_area_changed ? REDRAW_ALL : REDRAW_FIELD); +#else #if 1 DrawAndFadeInMainMenu(REDRAW_FIELD); #else DrawMainMenu(); +#endif #endif } else { +#if 1 + // CloseDoor(DOOR_CLOSE_1); + OpenDoor(DOOR_OPEN_1 | DOOR_COPY_BACK); +#else CloseDoor(DOOR_CLOSE_1); OpenDoor(DOOR_OPEN_1 | DOOR_COPY_BACK); +#endif } }