From bd826a8c1635d94fc84b15c785377b975a6cd7e1 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sat, 23 Mar 2024 15:17:46 +0100 Subject: [PATCH] added "effects" element graphics for native BD engine to level editor --- src/editor.c | 20 +++++++++++++++++++- src/game_bd/export_bd.h | 3 +++ src/tools.c | 6 ++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/editor.c b/src/editor.c index 721f4afe..750e0fa8 100644 --- a/src/editor.c +++ b/src/editor.c @@ -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) diff --git a/src/game_bd/export_bd.h b/src/game_bd/export_bd.h index f14d8f84..3b8c7721 100644 --- a/src/game_bd/export_bd.h +++ b/src/game_bd/export_bd.h @@ -65,6 +65,9 @@ struct GraphicInfo_BD Bitmap *bitmap; int src_x, src_y; int width, height; + + int graphic; + int frame; }; struct EngineSnapshotInfo_BD diff --git a/src/tools.c b/src/tools.c index aa15883d..26df7535 100644 --- a/src/tools.c +++ b/src/tools.c @@ -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) -- 2.34.1