rnd-20070401-1-src
[rocksndiamonds.git] / src / tools.c
index d556beb821b7ea5f5292e1be98b8f1eb32ad5f0b..9530644e204d1787fbe18e240867c44b5923b7e9 100644 (file)
@@ -557,6 +557,11 @@ void FadeExt(int fade_mask, int fade_mode)
     return;
   }
 
+#if 1
+  if (global.autoplay_leveldir)
+    fading.fade_mode = FADE_MODE_NONE;
+#endif
+
 #if 1
   if (fading.fade_mode == FADE_MODE_NONE)
     return;
@@ -657,25 +662,46 @@ void FadeCrossSaveBackbuffer()
   BlitBitmap(backbuffer, bitmap_db_cross, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
 }
 
+static void FadeSetLeaveNext(struct TitleFadingInfo fading_leave, boolean set)
+{
+  static struct TitleFadingInfo fading_leave_stored;
+
+  if (set)
+    fading_leave_stored = fading_leave;
+  else
+    fading = fading_leave_stored;
+}
+
 void FadeSetEnterMenu()
 {
   fading = menu.enter_menu;
+
+  FadeSetLeaveNext(fading, TRUE);      /* (keep same fade mode) */
 }
 
 void FadeSetLeaveMenu()
 {
   fading = menu.leave_menu;
+
+  FadeSetLeaveNext(fading, TRUE);      /* (keep same fade mode) */
+}
+
+void FadeSetEnterScreen()
+{
+  fading = menu.enter_screen[game_status];
+
+  FadeSetLeaveNext(menu.leave_screen[game_status], TRUE);      /* store */
 }
 
-void FadeSetStartItem()
+void FadeSetLeaveScreen()
 {
-  fading = menu.start_item;
+  FadeSetLeaveNext(menu.leave_screen[game_status], FALSE);     /* recall */
 }
 
 void FadeSetFromType(int type)
 {
   if (type & TYPE_ENTER_SCREEN)
-    FadeSetStartItem();
+    FadeSetEnterScreen();
   else if (type & TYPE_ENTER)
     FadeSetEnterMenu();
   else if (type & TYPE_LEAVE)
@@ -1807,15 +1833,29 @@ void getPreviewGraphicSource(int graphic, Bitmap **bitmap, int *x, int *y,
   {
     int width_mult, width_div;
     int height_mult, height_div;
-  } offset_calc[4] =
+#if 1
+  }
+  offset_calc[6] =
+#else
+  offset_calc[4] =
+#endif
   {
     { 0, 1,    0, 1    },
     { 0, 1,    2, 3    },
     { 1, 2,    2, 3    },
     { 3, 4,    2, 3    },
+#if 1
+    { 7, 8,    2, 3    },
+    { 15, 16,  2, 3    },
+#endif
   };
+#if 1
+  int offset_calc_pos = (tilesize < MICRO_TILESIZE / 4 ||
+                        tilesize > TILESIZE ? 5 : 5 - log_2(tilesize));
+#else
   int offset_calc_pos = (tilesize < MICRO_TILESIZE || tilesize > TILESIZE ? 3 :
                         5 - log_2(tilesize));
+#endif
   Bitmap *src_bitmap = graphic_info[graphic].bitmap;
   int width_mult = offset_calc[offset_calc_pos].width_mult;
   int width_div = offset_calc[offset_calc_pos].width_div;