extended support for expanding wall settings in BD engine to level editor
[rocksndiamonds.git] / src / game_bd / main_bd.c
index e7844fcb6e2a4922c6d21552438f31ec564cf08f..6b3ba1043116ebfb468eccff1cb2b3c83f274adc 100644 (file)
@@ -250,9 +250,26 @@ static void UpdateGameDoorValues_BD(void)
 
 static void PrepareGameTileBitmap_BD(void)
 {
-  struct GraphicInfo_BD *g = &graphic_info_bd_object[O_STONE][0];
+  struct GraphicInfo_BD *g_template = &graphic_info_bd_color_template;
+  struct GraphicInfo_BD *g_default  = &graphic_info_bd_object[O_STONE][0];
 
-  gd_prepare_tile_bitmap(native_bd_level.cave, g->bitmap, 1);
+  gd_prepare_tile_bitmap(native_bd_level.cave, g_template->bitmap, 1);
+  gd_set_tile_bitmap_reference(g_default->bitmap);
+}
+
+void PreparePreviewTileBitmap_BD(Bitmap *bitmap, int scale_down_factor)
+{
+  gd_prepare_tile_bitmap(native_bd_level.cave, bitmap, scale_down_factor);
+}
+
+void SetPreviewTileBitmapReference_BD(Bitmap *bitmap)
+{
+  gd_set_tile_bitmap_reference(bitmap);
+}
+
+Bitmap *GetPreviewTileBitmap_BD(Bitmap *bitmap)
+{
+  return gd_get_tile_bitmap(bitmap);
 }
 
 unsigned int InitEngineRandom_BD(int seed)
@@ -369,6 +386,19 @@ void GameActions_BD(byte action[MAX_PLAYERS])
 
   play_game_func(game_bd.game, action[0]);
 
+  // scroll without iterating engine if player out of sight (mainly due to wrap-around)
+  // (this is needed to prevent broken tapes in case of viewport or tile size changes)
+  while (game_bd.game->out_of_window)
+  {
+    RedrawPlayfield_BD(TRUE);
+
+    BlitScreenToBitmap_BD(backbuffer);
+
+    BackToFront();
+
+    play_game_func(game_bd.game, action[0]);
+  }
+
   RedrawPlayfield_BD(FALSE);
 
   UpdateGameDoorValues_BD();
@@ -379,6 +409,11 @@ void GameActions_BD(byte action[MAX_PLAYERS])
 // graphics functions
 // ============================================================================
 
+Bitmap *GetTitleScreen_BD(void)
+{
+  return gd_get_title_screen_bitmap();
+}
+
 void CoverScreen_BD(void)
 {
   game_bd.cover_screen = FALSE;