added "effects" element graphics for native BD engine to level editor
authorHolger Schemel <info@artsoft.org>
Sat, 23 Mar 2024 14:17:46 +0000 (15:17 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 23 Mar 2024 17:52:44 +0000 (18:52 +0100)
src/editor.c
src/game_bd/export_bd.h
src/tools.c

index 721f4afe78e8e660381d31edddf6c5801051bdae..750e0fa846948a1776a980a4c681bb53fcb89f67 100644 (file)
@@ -7359,7 +7359,25 @@ static void ScrollEditorLevel(int from_x, int from_y, int scroll)
 static void getEditorGraphicSource(int element, int tile_size, Bitmap **bitmap,
                                   int *x, int *y)
 {
-  getSizedGraphicSource(el2edimg(element), 0, tile_size, bitmap, x, y);
+  int graphic = el2edimg(element);
+  int frame = 0;
+
+  if (graphic == IMG_UNKNOWN)
+  {
+    // no graphic defined -- if BD style, try to get runtime ("effect") element graphics
+    // (normal BD style elements have graphics, but runtime ("effects") elements do not)
+    int element_bd = map_element_RND_to_BD_cave(element);
+
+    if (element_bd != O_UNKNOWN)
+    {
+      struct GraphicInfo_BD *g_bd = &graphic_info_bd_object[element_bd][0];
+
+      graphic = g_bd->graphic;
+      frame   = g_bd->frame;
+    }
+  }
+
+  getSizedGraphicSource(graphic, frame, tile_size, bitmap, x, y);
 }
 
 static void CreateControlButtons(void)
index f14d8f843613e35d7ec16ad6337a97e35dd1b22f..3b8c77217a1db58881156841286f321035070df1 100644 (file)
@@ -65,6 +65,9 @@ struct GraphicInfo_BD
   Bitmap *bitmap;
   int src_x, src_y;
   int width, height;
+
+  int graphic;
+  int frame;
 };
 
 struct EngineSnapshotInfo_BD
index aa15883d5fd03fc5df01c9308e193dd80a6019c2..26df75352df7bb0345e1c4bf7b5a8ad081ffd93e 100644 (file)
@@ -10578,6 +10578,9 @@ void InitGraphicInfo_BD(void)
       g_bd->src_y  = src_y;
       g_bd->width  = TILEX;
       g_bd->height = TILEY;
+
+      g_bd->graphic = graphic;
+      g_bd->frame = frame;
     }
   }
 
@@ -10594,6 +10597,9 @@ void InitGraphicInfo_BD(void)
   g_bd->src_y  = src_y;
   g_bd->width  = TILEX;
   g_bd->height = TILEY;
+
+  g_bd->graphic = graphic;
+  g_bd->frame = 0;
 }
 
 void InitGraphicInfo_EM(void)