rnd-20140315-1-src
authorHolger Schemel <info@artsoft.org>
Sat, 15 Mar 2014 02:16:12 +0000 (03:16 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 09:01:21 +0000 (11:01 +0200)
src/conftime.h
src/editor.c
src/game.c
src/tools.c

index abd3cfd9a717266b35da251066d3bc438058730c..e565798e8605c021abda7542edea1aab2c7a844c 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "2014-03-13 13:44"
+#define COMPILE_DATE_STRING "2014-03-15 03:14"
index 1fe6e544b86c631277e8a35ac611a8225c28177a..99a3161da273d822bf56cbb46737065aa140b45e 100644 (file)
@@ -7743,8 +7743,15 @@ void CheckElementDescriptions()
       Error(ERR_WARN, "no element description for element '%s'", EL_NAME(i));
 }
 
       Error(ERR_WARN, "no element description for element '%s'", EL_NAME(i));
 }
 
+static boolean playfield_area_changed = FALSE;
+
 void DrawLevelEd()
 {
 void DrawLevelEd()
 {
+  int old_sx = SX;
+  int old_sy = SY;
+  int old_sxsize = SXSIZE;
+  int old_sysize = SYSIZE;
+
   StopAnimation();
 
   CloseDoor(DOOR_CLOSE_ALL);
   StopAnimation();
 
   CloseDoor(DOOR_CLOSE_ALL);
@@ -7754,11 +7761,32 @@ void DrawLevelEd()
   // FadeOut(REDRAW_ALL);
 #endif
 
   // 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 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
 #if 1
   OpenDoor(DOOR_OPEN_1 | DOOR_OPEN_2 | DOOR_NO_DELAY);
 #else
@@ -7836,6 +7864,8 @@ void DrawLevelEd()
   DrawEditModeWindow();
 
 #if 1
   DrawEditModeWindow();
 
 #if 1
+  FadeIn(playfield_area_changed ? REDRAW_ALL : REDRAW_FIELD);
+#else
   FadeIn(REDRAW_FIELD);
   // FadeIn(REDRAW_ALL);
 #endif
   FadeIn(REDRAW_FIELD);
   // FadeIn(REDRAW_ALL);
 #endif
@@ -7848,7 +7878,7 @@ void DrawLevelEd()
             DX, DY, DXSIZE, DYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
 #endif
 
             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();
   /* 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);
 
 
       CloseDoor(DOOR_CLOSE_ALL);
 
+#if 0
       BackToFront();           /* force redraw of undrawn special door */
       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();
 
 #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))
   {
       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);
     CloseDoor(DOOR_CLOSE_1);
     SetDoorState(DOOR_CLOSE_2);
+#endif
 
 #if 1
     if (quick_quit)
 
 #if 1
     if (quick_quit)
@@ -12400,15 +12444,24 @@ void RequestExitLevelEditor(boolean ask_if_level_has_changed,
 #endif
 
     game_status = GAME_MODE_MAIN;
 #endif
 
     game_status = GAME_MODE_MAIN;
+#if 1
+    DrawAndFadeInMainMenu(playfield_area_changed ? REDRAW_ALL : REDRAW_FIELD);
+#else
 #if 1
     DrawAndFadeInMainMenu(REDRAW_FIELD);
 #else
     DrawMainMenu();
 #if 1
     DrawAndFadeInMainMenu(REDRAW_FIELD);
 #else
     DrawMainMenu();
+#endif
 #endif
   }
   else
   {
 #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);
     CloseDoor(DOOR_CLOSE_1);
     OpenDoor(DOOR_OPEN_1 | DOOR_COPY_BACK);
+#endif
   }
 }
   }
 }
index 1a201dc120978a4f2f6d4fc32558b6b672731a10..172b4073c3d2364e5a5aa5b5d9463fc5981a7e20 100644 (file)
@@ -3533,6 +3533,34 @@ void InitGame()
 #endif
   int i, j, x, y;
 
 #endif
   int i, j, x, y;
 
+#if 1
+
+  StopAnimation();
+
+  if (!game.restart_level)
+    CloseDoor(DOOR_CLOSE_1);
+
+#if 1
+  if (level_editor_test_game)
+    FadeSkipNextFadeIn();
+  else
+    FadeSetEnterScreen();
+#else
+  if (level_editor_test_game)
+    fading = fading_none;
+  else
+    fading = menu.destination;
+#endif
+
+#if 1
+  FadeOut(REDRAW_FIELD);
+#else
+  if (do_fading)
+    FadeOut(REDRAW_FIELD);
+#endif
+
+#endif
+
   game_status = GAME_MODE_PLAYING;
 
 #if 1
   game_status = GAME_MODE_PLAYING;
 
 #if 1
@@ -4400,6 +4428,8 @@ void InitGame()
   game_status = GAME_MODE_MAIN;
 #endif
 
   game_status = GAME_MODE_MAIN;
 #endif
 
+#if 0
+
   StopAnimation();
 
   if (!game.restart_level)
   StopAnimation();
 
   if (!game.restart_level)
@@ -4424,6 +4454,8 @@ void InitGame()
     FadeOut(REDRAW_FIELD);
 #endif
 
     FadeOut(REDRAW_FIELD);
 #endif
 
+#endif
+
 #if 0
   game_status = GAME_MODE_PLAYING;
 #endif
 #if 0
   game_status = GAME_MODE_PLAYING;
 #endif
@@ -16445,6 +16477,12 @@ void RequestQuitGameExt(boolean skip_request, boolean quick_quit, char *message)
 {
   if (skip_request || Request(message, REQ_ASK | REQ_STAY_CLOSED))
   {
 {
   if (skip_request || Request(message, REQ_ASK | REQ_STAY_CLOSED))
   {
+#if 1
+    /* closing door required in case of envelope style request dialogs */
+    if (!skip_request)
+      CloseDoor(DOOR_CLOSE_1);
+#endif
+
 #if defined(NETWORK_AVALIABLE)
     if (options.network)
       SendToServer_StopPlaying(NETWORK_STOP_BY_PLAYER);
 #if defined(NETWORK_AVALIABLE)
     if (options.network)
       SendToServer_StopPlaying(NETWORK_STOP_BY_PLAYER);
@@ -16946,6 +16984,7 @@ static void HandleGameButtonsExt(int id)
        TapeStop();
       else
        RequestQuitGame(TRUE);
        TapeStop();
       else
        RequestQuitGame(TRUE);
+
       break;
 
     case GAME_CTRL_ID_PAUSE:
       break;
 
     case GAME_CTRL_ID_PAUSE:
index c6c5acf8c660eabdecc39a9e6aed4495a674f2bb..ac20e3c144e5b3567019de53c3ad60344ab517c5 100644 (file)
@@ -1017,11 +1017,28 @@ static void FadeExt(int fade_mask, int fade_mode, int fade_type)
       ClearRectangle(backbuffer, x, y, width, height);
 #endif
 
       ClearRectangle(backbuffer, x, y, width, height);
 #endif
 
+#if 1
+
+#if 1
+    BlitBitmap(backbuffer, window, x, y, width, height, x, y);
+
+    redraw_mask &= ~fade_mask;
+#else
+    /* always redraw area that was explicitly marked to fade */
+    redraw_mask |= fade_mask;
+
+    BackToFront();
+#endif
+
+#else
+
 #if 1
     BlitBitmap(backbuffer, window, x, y, width, height, x, y);
     redraw_mask = REDRAW_NONE;
 #if 1
     BlitBitmap(backbuffer, window, x, y, width, height, x, y);
     redraw_mask = REDRAW_NONE;
+    // (^^^ WRONG; should be "redraw_mask &= ~fade_mask" if done this way)
 #else
     BackToFront();
 #else
     BackToFront();
+#endif
 #endif
 
     return;
 #endif
 
     return;
@@ -2972,7 +2989,7 @@ void AnimateEnvelopeRequest(int anim_mode, int action)
               dst_x + xsize_size_left, dst_y + ysize_size_top);
 #endif
 
               dst_x + xsize_size_left, dst_y + ysize_size_top);
 #endif
 
-#if 1
+#if 0
     redraw_mask = REDRAW_FIELD | REDRAW_FROM_BACKBUFFER;
     // redraw_mask |= REDRAW_ALL | REDRAW_FROM_BACKBUFFER;
 #else
     redraw_mask = REDRAW_FIELD | REDRAW_FROM_BACKBUFFER;
     // redraw_mask |= REDRAW_ALL | REDRAW_FROM_BACKBUFFER;
 #else